From 5b5d95b4b5e3767adf1610bbaf178fe3f6a9d891 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期二, 24 六月 2025 11:10:08 +0800
Subject: [PATCH] bug修复/策略完善

---
 strategy/strategy_manager.py |   51 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/strategy/strategy_manager.py b/strategy/strategy_manager.py
index 6551ec9..78252fe 100644
--- a/strategy/strategy_manager.py
+++ b/strategy/strategy_manager.py
@@ -20,6 +20,8 @@
 from trade.trade_manager import DealCodesManager, PlatePlaceOrderManager
 from utils import huaxin_util, tool
 
+BIG_ORDER_MAX_SPACE_TIME = 3
+
 
 @tool.singleton
 class TickSummaryDataManager:
@@ -194,7 +196,7 @@
         IS_BY_BIG_ORDER = False
         BIG_ORDER_MONEY_THRESHOLD = 200e4
         big_order_deals = self.__LowSuctionOriginDataExportManager.export_big_order_deal(BIG_ORDER_MONEY_THRESHOLD,
-                                                                                         max_deal_space=3)
+                                                                                         max_deal_space=BIG_ORDER_MAX_SPACE_TIME)
         if not big_order_deals or IS_BY_BIG_ORDER:
             big_order_deals = self.__LowSuctionOriginDataExportManager.export_big_order_deal_by(
                 BIG_ORDER_MONEY_THRESHOLD)
@@ -286,29 +288,38 @@
         for d in big_orders:
             try:
                 code = d[0]
-                # 鍙绠�200w浠ヤ笂鐨勪拱鍗�
-                if d[2][2] < 200e4:
-                    continue
-                if d[1] == 0:
-                    # 涔板崟
-                    if code not in self.big_order_buy:
-                        self.big_order_buy[code] = []
-                    self.big_order_buy[code].append(d[2])
-                else:
-                    # 鍗栧崟
-                    if code not in self.big_order_sell:
-                        self.big_order_sell[code] = []
-                    self.big_order_sell[code].append(d[2])
-                    if code not in codes:
-                        codes.append(code)
-                # 璁剧疆鐜颁环
-                if code in self.stock_variables_dict:
-                    self.stock_variables_dict[code].褰撳墠浠� = d[2][4]
+                try:
+                    # 鍙绠�200w浠ヤ笂鐨勪拱鍗�
+                    if d[2][2] < 200e4:
+                        continue
+                    if d[1] == 0:
+                        if tool.trade_time_sub(huaxin_util.convert_time(d[2][3]),
+                                               huaxin_util.convert_time(d[2][5])) > BIG_ORDER_MAX_SPACE_TIME:
+                            # 鎴愪氦瓒呰繃鎸囧畾鏃堕棿
+                            continue
+                        # 涔板崟
+                        if code not in self.big_order_buy:
+                            self.big_order_buy[code] = []
+                        self.big_order_buy[code].append(d[2])
+                        if code not in codes:
+                            codes.append(code)
+                    else:
+                        # 鍗栧崟
+                        if code not in self.big_order_sell:
+                            self.big_order_sell[code] = []
+                        self.big_order_sell[code].append(d[2])
+                finally:
+                    # 璁剧疆鐜颁环
+                    if code in self.stock_variables_dict:
+                        self.stock_variables_dict[code].褰撳墠浠� = d[2][4]
             except Exception as e:
                 logger_debug.error(f"{d}")
             # 椹卞姩涓嬪崟
         for code in codes:
-            self.__run(code, self.stock_variables_dict.get(code))
+            try:
+                self.__run(code, self.stock_variables_dict.get(code))
+            except Exception as e:
+                logger_debug.exception(e)
 
     def add_ticks(self, ticks):
         """

--
Gitblit v1.8.0