From 3f8499a0b83304132facd8758acc1a99a1008c69 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期四, 23 十一月 2023 19:14:26 +0800
Subject: [PATCH] bug修复

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

diff --git a/l2/l2_data_manager_new.py b/l2/l2_data_manager_new.py
index 9bab0dd..9fb0a2d 100644
--- a/l2/l2_data_manager_new.py
+++ b/l2/l2_data_manager_new.py
@@ -29,7 +29,7 @@
 import l2.l2_data_util
 from log_module.log import logger_l2_trade_buy, logger_l2_process, logger_l2_error, logger_debug
 
-from trade.trade_data_manager import CodeActualPriceProcessor
+from trade.trade_data_manager import CodeActualPriceProcessor, PlaceOrderCountManager
 
 from trade.trade_manager import TradeTargetCodeModeManager, AccountAvailableMoneyManager
 
@@ -236,6 +236,7 @@
     __LatestCancelIndexManager = LatestCancelIndexManager()
     __L2MarketSellManager = L2MarketSellManager()
     __L2LimitUpSellManager = L2LimitUpSellManager()
+    __PlaceOrderCountManager = PlaceOrderCountManager()
 
     # 鑾峰彇浠g爜璇勫垎
     @classmethod
@@ -382,7 +383,11 @@
             # 鏄惁涓洪鏉夸唬鐮�
             is_first_code = True  # gpcode_manager.FirstCodeManager().is_in_first_record(code)
             # 璁$畻閲�
-            volume_rate = code_volumn_manager.get_volume_rate(code)
+            current_sell = cls.__L2MarketSellManager.get_current_total_sell_data(code)
+            total_sell_volume = 0
+            if current_sell and len(current_sell) > 2:
+                total_sell_volume = current_sell[2]
+            volume_rate = code_volumn_manager.get_volume_rate(code, total_sell_volume=total_sell_volume)
             volume_rate_index = code_volumn_manager.get_volume_rate_index(volume_rate)
             # 璁$畻鍒嗗��
             limit_up_time = cls.__LimitUpTimeManager.get_limit_up_time_cache(code)
@@ -831,14 +836,33 @@
             HighIncreaseCodeManager().add_code(code)
             return False, True, f"鑲′环澶т簬{constant.MAX_CODE_PRICE}鍧�"
 
+        place_order_count = cls.__PlaceOrderCountManager.get_place_order_count(code)
+        if place_order_count and place_order_count >= 10:
+            l2_trade_util.forbidden_trade(code, msg="褰撴棩涓嬪崟娆℃暟宸茶揪10娆�")
+            return False, True, f"褰撴棩涓嬪崟娆℃暟宸茶揪10娆�"
+
+        # -------閲忕殑绾︽潫--------
+        if cls.volume_rate_info[code][0] < 0.2:
+            return False, True, f"褰撴棩閲忔瘮({cls.volume_rate_info[code][0]})灏忎簬0.2"
+        k_format = code_nature_analyse.CodeNatureRecordManager().get_k_format_cache(code)
+        if k_format and (k_format[1][0] or k_format[3][0]):
+            # 鑲′环鍒涙柊楂樻垨鑰呴�艰繎鍓嶉珮
+            if cls.volume_rate_info[code][0] < 0.3:
+                return False, True, f"鑲′环鍒涙柊楂樻垨鑰呴�艰繎鍓嶉珮,褰撴棩閲忔瘮({cls.volume_rate_info[code][0]})灏忎簬0.3"
         if code_nature_analyse.LatestMaxVolumeManager().is_latest_max_volume(code):
             # 鏈�杩戝嚑澶╂湁鏈�澶ч噺锛屽垽鏂噺姣旀槸鍚﹀ぇ浜�60%
             if cls.volume_rate_info[code][0] < 0.6:
                 HighIncreaseCodeManager().add_code(code)
                 return False, True, f"杩戞棩鍑虹幇鏈�澶ч噺锛屽綋鏃ラ噺姣�({cls.volume_rate_info[code][0]})灏忎簬0.6"
 
+        # ------鑷敱娴侀�氬競鍊肩害鏉�------
+        zyltgb = global_util.zyltgb_map.get(code)
+        if zyltgb:
+            if zyltgb < 10 * 100000000:
+                return False, True, f"鑷敱娴侀�氬皬浜�10浜匡紙{zyltgb}锛�"
+
+        total_data = local_today_datas.get(code)
         if constant.L2_SOURCE_TYPE == constant.L2_SOURCE_TYPE_HUAXIN:
-            total_data = local_today_datas.get(code)
             trade_price = current_price_process_manager.get_trade_price(code)
             if trade_price is None:
                 return False, True, f"灏氭湭鑾峰彇鍒板綋鍓嶆垚浜や环"
@@ -907,7 +931,7 @@
             return False, True, f"鐐告澘鍚庢渶浣庝环璺岃嚦5%浠ヤ笅"
 
         # 鍥炲皝鐨勭エ锛屼笅13:15涔板叆闇�瑕佸垽鏂澘鍧楁槸鍚︿负鐙嫍
-        if open_limit_up_lowest_price and int(tool.get_now_time_str().replace(":", "")) > 131500:
+        if open_limit_up_lowest_price and int(total_data[-1]["val"]["time"].replace(":", "")) > 131500:
             # 鑾峰彇褰撳墠绁ㄧ殑娑ㄥ仠鍘熷洜
             if code in LimitUpCodesPlateKeyManager.today_total_limit_up_reason_dict:
                 limit_up_reason = kpl_data_manager.KPLLimitUpDataRecordManager.get_current_block(code)

--
Gitblit v1.8.0