Administrator
5 天以前 0ce5457b060bddc2ab65e4ff094159781cd15deb
‘功能完善
7个文件已修改
42 ■■■■■ 已修改文件
log_module/log.py 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/strategy_manager.py 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/strategy_script_v6.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/strategy_variable_factory.py 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/test.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/time_series_backtest.py 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
log_module/log.py
@@ -63,6 +63,9 @@
        logger.add(self.get_path("system", "system"), filter=lambda record: record["extra"].get("name") == "system",
                   rotation="00:00", compression="zip", enqueue=True)
        # 显示在控制台
        logger.add(sys.stdout,
                   filter=lambda record: record["extra"].get("name") == "system", enqueue=True)
        logger.add(self.get_path("ths", "buy_1_volumn"),
                   filter=lambda record: record["extra"].get("name") == "buy_1_volumn",
@@ -186,7 +189,8 @@
                   rotation="00:00", compression="zip", enqueue=True)
    def get_path(self, dir_name, log_name):
        path_str = "{}/ls_logs/gp/{}/{}".format(constant.get_path_prefix(), dir_name, log_name) + ".{time:YYYY-MM-DD}.log"
        path_str = "{}/ls_logs/gp/{}/{}".format(constant.get_path_prefix(), dir_name,
                                                log_name) + ".{time:YYYY-MM-DD}.log"
        # print(path_str)
        return path_str
main.py
@@ -110,8 +110,8 @@
    # 初始化数据
    strategy_manager.low_suction_strtegy = strategy_manager.LowSuctionStrategy(tool.get_now_date_str())
    logger_system.info("初始化策略对象成功")
    strategy_manager.low_suction_strtegy.load_data()
    logger_system.info("加载策略数据成功")
    # -------启动L2 market订阅------
    __run_l2_market_subscript()
strategy/strategy_manager.py
@@ -105,7 +105,7 @@
    """
    def __init__(self, day, script_name="strategy_script_v6.py",
                 settings=StrategyParamsSettingsManager().get_settings()):
                 settings=StrategyParamsSettingsManager().get_settings(), need_load_data = False):
        self.now_day = day
        # 买大单:{代码:[大单数据]}
        self.big_order_buy = {}
@@ -153,6 +153,7 @@
        self.data_loader = DataLoader(self.now_day, cache_path=f"{constant.get_path_prefix()}/datas")
        self.__LowSuctionOriginDataExportManager = LowSuctionOriginDataExportManager(self.now_day)
        if need_load_data:
        self.load_data()
    def load_data(self):
strategy/strategy_script_v6.py
@@ -149,11 +149,11 @@
                continue
            orderids.add(o[0])
            big_order_money += o[1]
    threshold_money = max(sv.自由流通市值 // 1000, 200e4)
    threshold_money = max(1.5 * sv.自由流通市值 // 1000, 200e4)
    limit_up_codes_count = max([(p, len(sv.开盘啦最正板块涨停.get(p, []))) for p in can_buy_plates], key=lambda x: x[1])[1]
    threshold_money *= max(10 - limit_up_codes_count + 3, 5) / 10
    # threshold_money *= max(10 - limit_up_codes_count + 3, 5) / 10
    if big_order_money < threshold_money:
        return False, f"({big_order_money}/{threshold_money})大单金额不足"
strategy/strategy_variable_factory.py
@@ -236,7 +236,7 @@
                           (tool.is_can_buy_code(x[0]) and x[0] in valid_codes and x[0] not in exclude_codes)]
                # 取前1/3且涨停数是前10
                max_count = len(results) // 3 if len(results) % 3 == 0 else len(results) // 3 + 1
                results = results[:max_count]
                # results = results[:max_count]
                # 取前10
                results = results[:10]
                codes = [x[0] for x in results]
@@ -669,9 +669,9 @@
if __name__ == "__main__":
    __load_target_codes_v1()
    # __load_target_codes_v1()
    __DataLoader = DataLoader("2025-06-12")
    __DataLoader = DataLoader("2025-06-17")
    # __test_jx_blocks(__DataLoader)
    # instance = StockVariables()
@@ -689,7 +689,7 @@
    results = __DataLoader.load_target_plate_and_codes()
    # for k in results:
    #     print(k, results[k])
    plates = ["汽车零部件", "文化传媒", "谷子经济"]
    plates = ["脑机接口"]
    print("==========新题材=======")
    for p in plates:
        print(p, results.get(p))
strategy/test.py
@@ -22,8 +22,8 @@
if __name__ == "__main__":
    # print("======3个票涨停之后买+开盘价>=-3")
    # statistic_average(r"C:\Users\Administrator\Desktop\3个票涨停之后买.txt")
    print("======3个票涨停之后买")
    statistic_average(r"C:\Users\Administrator\Desktop\3个票涨停之后买.txt")
    # print("======3个票涨停之后买+不限开盘涨幅+3个涨停之后大单打折")
    # statistic_average(r"C:\Users\Administrator\Desktop\3个票涨停之后买_不限开盘涨幅.txt")
    codes = set()
strategy/time_series_backtest.py
@@ -585,6 +585,8 @@
                            if p not in most_real_kpl_plate_limit_up_codes_info:
                                most_real_kpl_plate_limit_up_codes_info[p] = []
                            most_real_kpl_plate_limit_up_codes_info[p].append(code)
                # print(time_str, "涨停数大于3个", [p for p in most_real_kpl_plate_limit_up_codes_info if
                #                             len(most_real_kpl_plate_limit_up_codes_info[p]) >= 3])
                # ---------测试--------
                # test_plate = "化工"
@@ -785,7 +787,7 @@
            stock_variables.板块成交代码 = self.deal_block_codes
# DEBUG_CODES = ['600727']
# DEBUG_CODES = ['603579', '300884']
DEBUG_CODES = []
VOLUME_LOG_ENABLE = False
@@ -798,12 +800,13 @@
if __name__ == "__main__":
    back_test_dict = {}
    # days = ["2025-05-06", "2025-05-07", "2025-05-08", "2025-05-09", "2025-05-12", "2025-05-13", "2025-05-14",
    #         "2025-05-15", "2025-05-16", "2025-05-19", "2025-05-20",  "2025-05-21", "2025-05-22"]
    days = ["2025-05-12", "2025-05-13", "2025-05-14", "2025-05-15", "2025-05-16", "2025-05-19", "2025-05-20",
            "2025-05-21", "2025-05-22", "2025-05-23", "2025-05-26", "2025-05-27", "2025-05-28", "2025-05-29",
            "2025-05-30", "2025-06-03", "2025-06-04", "2025-06-05", "2025-06-06", "2025-06-09", "2025-06-10",
            "2025-06-11", "2025-06-12", "2025-06-13", "2025-06-16", "2025-06-17"]
            "2025-05-30", "2025-06-03"]
    # days = ["2025-05-12", "2025-05-13", "2025-05-14", "2025-05-15", "2025-05-16", "2025-05-19", "2025-05-20",
    #         "2025-05-21", "2025-05-22", "2025-05-23", "2025-05-26", "2025-05-27", "2025-05-28", "2025-05-29",
    #         "2025-05-30", "2025-06-03", "2025-06-04", "2025-06-05", "2025-06-06", "2025-06-09", "2025-06-10",
    #         "2025-06-11", "2025-06-12", "2025-06-13", "2025-06-16", "2025-06-17"]
    # days = ["2025-06-13"]