From 832d70d984316e43048a84ad61d0c8a12c319993 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期四, 11 四月 2024 18:47:20 +0800
Subject: [PATCH] 深证买入方式改造

---
 l2/l2_data_manager_new.py |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/l2/l2_data_manager_new.py b/l2/l2_data_manager_new.py
index 075aaf9..7f2d3f1 100644
--- a/l2/l2_data_manager_new.py
+++ b/l2/l2_data_manager_new.py
@@ -317,8 +317,17 @@
                 local_today_datas[code] = []
             if total_datas:
                 _start_index = total_datas[-1]["index"] + 1
-            datas = l2_huaxin_util.get_format_l2_datas(code, origin_datas,
-                                                       gpcode_manager.get_limit_up_price(code), _start_index)
+
+            # 濡傛灉鏄澘涓婏紝灏遍渶瑕佸墧闄ゆ澘涓婂崠鏁版嵁, 榛樿涓嶅墧闄�
+            filter_limit_up_sell = False
+            trade_price_info = HuaXinSellOrderStatisticManager.get_latest_trade_price_info(code)
+            limit_up_price = gpcode_manager.get_limit_up_price(code)
+            if limit_up_price:
+                limit_up_price = round(float(limit_up_price), 2)
+            if trade_price_info and limit_up_price and trade_price_info[0] == limit_up_price:
+                filter_limit_up_sell = True
+            datas = l2_huaxin_util.get_format_l2_datas(code, origin_datas, limit_up_price, _start_index,
+                                                       filter_limit_up_sell)
             __start_time = round(t.time() * 1000)
             if len(datas) > 0:
                 cls.process_add_datas(code, datas, 0, __start_time)
@@ -1645,8 +1654,11 @@
         start_time_str = total_datas[start_index]["val"]["time"]
         # 鑾峰彇鏈�杩戠殑鎬诲崠淇℃伅
         refer_sell_data = cls.__L2MarketSellManager.get_refer_sell_data(code, start_time_str)
-        if refer_sell_data is None:
+        if refer_sell_data is None and start_time_str != '09:30:00':
             return False, -1, "鎬诲崠涓虹┖"
+        if refer_sell_data is None:
+            refer_sell_data = (start_time_str, 0, 0, (round(float(total_datas[start_index]["val"]["price"]), 2), 0))
+            l2_log.debug(code, f"涓㈠け鎬诲崠棰濓紝璁剧疆榛樿涓�0锛岃绠楄寖鍥达細{start_index}-{end_index}")
         # 鑾峰彇褰撳墠鏄惁鍙縺杩涗拱
         # 鑾峰彇鏉垮潡鏄惁鍙互婵�杩涗拱
         # 鍙拱鐨勬澘鍧�, 鏄惁鐙嫍, 娑堟伅, 鍙拱鐨勫己鍔挎澘鍧�, 鍏抽敭璇�, 婵�杩涗拱鐨勬澘鍧�
@@ -2159,8 +2171,14 @@
             if not trigger_buy:
                 not_buy_msg = f"銆恵i}銆戞病鏈変拱鍗曡Е鍙�"
                 continue
-            if buy_count < 1:
-                not_buy_msg = f"銆恵i}銆戝畨鍏ㄧ瑪鏁颁笉瓒筹紝{buy_count}/{1}"
+
+            safe_count = 1
+            if threshold_money <= 0:
+                # 鏉夸笂涓嬪崟闇�瑕佸畨鍏ㄧ瑪鏁�3绗�
+                safe_count = 3
+
+            if buy_count < safe_count:
+                not_buy_msg = f"銆恵i}銆戝畨鍏ㄧ瑪鏁颁笉瓒筹紝{buy_count}/{safe_count}"
                 continue
 
             # max_buy_num_set = cls.__filter_not_deal_indexes(code, max_buy_num_set)

--
Gitblit v1.8.0