From 09f84c4ecae2a71e07f6dd64e6066563599a62b6 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期二, 17 六月 2025 17:59:40 +0800
Subject: [PATCH] ‘功能完善

---
 strategy/time_series_backtest.py |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/strategy/time_series_backtest.py b/strategy/time_series_backtest.py
index a8196a5..4c90d2a 100644
--- a/strategy/time_series_backtest.py
+++ b/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"])
@@ -582,6 +585,21 @@
                             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 = "鍖栧伐"
+                # 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:
@@ -650,6 +668,7 @@
                         stock_variables.浠婃棩鏈�浣庝环 = tick["price"]
                     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:
@@ -695,6 +714,8 @@
 
                     if block_in_datas:
                         stock_variables.璧勯噾娴佸叆鏉垮潡 = block_in_datas
+
+                    stock_variables.褰撳墠浠� =  big_order[1][4]
                     compute_result = self.__run_backtest(code, stock_variables)
                     # print(compute_result)
                     self.__process_test_result(code, stock_variables, next_trade_day, big_order[1][4],
@@ -768,7 +789,7 @@
             stock_variables.鏉垮潡鎴愪氦浠g爜 = self.deal_block_codes
 
 
-# DEBUG_CODES =  ['603040', '603758', '603286', '603586', '605255', '002048', '605208', '002806', '603266', '603788']
+# DEBUG_CODES = ['603579', '300884']
 DEBUG_CODES = []
 
 VOLUME_LOG_ENABLE = False
@@ -777,18 +798,19 @@
 
 DEBUG_BLOCKS = []
 
-BIG_ORDER_MONEY_THRESHOLD = 100e4
+BIG_ORDER_MONEY_THRESHOLD = 200e4
 
 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-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-09"]
+    # days = ["2025-05-23"]
 
     days.reverse()
     for day in days:

--
Gitblit v1.8.0