From ab662be5c523b75c1bd28fc6bfcab2872b9623b3 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 12 六月 2025 15:22:06 +0800 Subject: [PATCH] bug修复 --- strategy/time_series_backtest.py | 30 ++++++++++++++++++------------ 1 files changed, 18 insertions(+), 12 deletions(-) diff --git a/strategy/time_series_backtest.py b/strategy/time_series_backtest.py index d9f007a..a8196a5 100644 --- a/strategy/time_series_backtest.py +++ b/strategy/time_series_backtest.py @@ -586,8 +586,8 @@ if ticks: for tick in ticks: code = tick["symbol"][-6:] - # if code not in self.fcodes: - # continue + if code not in self.fcodes: + continue if DEBUG_CODES and code not in DEBUG_CODES: continue @@ -648,12 +648,14 @@ if not stock_variables.浠婃棩鏈�浣庝环 or tick["price"] < stock_variables.浠婃棩鏈�浣庝环: stock_variables.浠婃棩鏈�浣庝环 = tick["price"] - - stock_variables.寮�鐩樺暒鏈�姝f澘鍧楁定鍋� = most_real_kpl_plate_limit_up_codes_info - - # compute_result = self.__run_backtest(code, stock_variables) - # self.__process_test_result(code, stock_variables, next_trade_day, stock_variables.褰撳墠浠�, - # time_str, compute_result) + if most_real_kpl_plate_limit_up_codes_info: + stock_variables.寮�鐩樺暒鏈�姝f澘鍧楁定鍋� = most_real_kpl_plate_limit_up_codes_info + # if time_str >= '09:30:00': + # if stock_variables.浠婃棩澶у崟鏁版嵁 and stock_variables.寮�鐩樺暒鏈�姝f澘鍧楁定鍋� and max( + # [len(stock_variables.寮�鐩樺暒鏈�姝f澘鍧楁定鍋�.get(x, [])) for x in stock_variables.浠g爜鏉垮潡]) >= 3: + # compute_result = self.__run_backtest(code, stock_variables) + # self.__process_test_result(code, stock_variables, next_trade_day, stock_variables.褰撳墠浠�, + # time_str, compute_result) # if len(real_codes) >= 2 and time_str > '09:30:00': # # print(time_str, plate) @@ -766,7 +768,7 @@ stock_variables.鏉垮潡鎴愪氦浠g爜 = self.deal_block_codes -# DEBUG_CODES = ['002365', '000953', '002907', '002688', '003020', '002900', '002082', '000566', '300204', '002317'] +# DEBUG_CODES = ['603040', '603758', '603286', '603586', '605255', '002048', '605208', '002806', '603266', '603788'] DEBUG_CODES = [] VOLUME_LOG_ENABLE = False @@ -775,7 +777,7 @@ DEBUG_BLOCKS = [] -BIG_ORDER_MONEY_THRESHOLD = 200e4 +BIG_ORDER_MONEY_THRESHOLD = 100e4 if __name__ == "__main__": back_test_dict = {} @@ -783,12 +785,16 @@ # "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-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"] + + # days = ["2025-06-09"] + days.reverse() for day in days: if day not in back_test_dict: # back_test_dict[day] = BackTest(day, "浠婃棩閲忔槸鍚﹁冻澶�.py") - back_test_dict[day] = BackTest(day, "浣庡惛鑴氭湰_杈ㄨ瘑搴v6.py") + back_test_dict[day] = BackTest(day, "strategy_script_v6.py") print("=========================", day) # back_test_dict[day].run_volume() back_test_dict[day].run() -- Gitblit v1.8.0