Administrator
5 天以前 994079acd0ac30a32e2b0391881890be16b0afc0
strategy/time_series_backtest.py
@@ -298,6 +298,9 @@
        if code_ in self.stock_variables_dict:
            return
        if code_ == '002907':
            print("")
        stock_variables = StrategyVariableFactory.create_from_history_data(
            timeline_data["kline_data"].get(code_), timeline_data["minute_data"].get(code_),
            timeline_data["limit_up_record_data"].get(code_), timeline_data["trade_days"])
@@ -583,6 +586,19 @@
                                most_real_kpl_plate_limit_up_codes_info[p] = []
                            most_real_kpl_plate_limit_up_codes_info[p].append(code)
                # ---------测试--------
                # test_plate = "化工"
                # if len(most_real_kpl_plate_limit_up_codes_info.get(test_plate, [])) >= 3:
                #     print("测试开始=========")
                #     code_plates_for_buy = self.current_data["code_plates_for_buy"]
                #     plate_codes = [c for c in code_plates_for_buy if test_plate in code_plates_for_buy[c]]
                #     print(f"{test_plate}满足", time_str, plate_codes)
                #     for c in plate_codes:
                #         sv: StockVariables = self.stock_variables_dict.get(c)
                #         if sv and sv.当前价 > sv.昨日收盘价:
                #             print(c)
                #     print("测试完毕=========")
            if ticks:
                for tick in ticks:
                    code = tick["symbol"][-6:]
@@ -650,6 +666,7 @@
                        stock_variables.今日最低价 = tick["price"]
                    if most_real_kpl_plate_limit_up_codes_info:
                        stock_variables.开盘啦最正板块涨停 = most_real_kpl_plate_limit_up_codes_info
                    # if time_str >= '09:30:00':
                    #     if stock_variables.今日大单数据 and stock_variables.开盘啦最正板块涨停 and max(
                    #             [len(stock_variables.开盘啦最正板块涨停.get(x, [])) for x in stock_variables.代码板块]) >= 3:
@@ -768,7 +785,7 @@
            stock_variables.板块成交代码 = self.deal_block_codes
# DEBUG_CODES =  ['603040', '603758', '603286', '603586', '605255', '002048', '605208', '002806', '603266', '603788']
# DEBUG_CODES = ['600727']
DEBUG_CODES = []
VOLUME_LOG_ENABLE = False
@@ -777,7 +794,7 @@
DEBUG_BLOCKS = []
BIG_ORDER_MONEY_THRESHOLD = 100e4
BIG_ORDER_MONEY_THRESHOLD = 200e4
if __name__ == "__main__":
    back_test_dict = {}
@@ -786,9 +803,9 @@
    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-11", "2025-06-12", "2025-06-13", "2025-06-16"]
    # days = ["2025-06-09"]
    # days = ["2025-06-13"]
    days.reverse()
    for day in days: