From fe1b515c6286f80a244e044236fb140ab7090495 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期日, 04 八月 2024 23:39:15 +0800
Subject: [PATCH] 板上放量下单规则修改

---
 l2/l2_data_manager_new.py |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/l2/l2_data_manager_new.py b/l2/l2_data_manager_new.py
index ed3e082..1b5610a 100644
--- a/l2/l2_data_manager_new.py
+++ b/l2/l2_data_manager_new.py
@@ -908,7 +908,7 @@
             # 鍒ゆ柇鏄惁涓烘澘涓婃斁閲忥細
             # 1.褰撳墠鎴愪氦浠蜂负娑ㄥ仠浠�
             # 2.鎬诲崠棰濅负0
-            if abs(float(limit_up_price) - float(trade_price)) < 0.001:
+            if abs(limit_up_price - float(trade_price)) < 0.001:
                 # 鑾峰彇鏈�杩戠殑闈炴定鍋滀环鎴愪氦鏃堕棿
                 not_limit_up_info = current_price_process_manager.get_trade_not_limit_up_info(code)
                 if not not_limit_up_info or tool.trade_time_sub(total_data[-1]['val']['time'],
@@ -919,8 +919,18 @@
                     if deal_list:
                         total_deal_volume = sum([x[1] for x in deal_list])
                     total_deal_money = int(total_deal_volume * float(limit_up_price))
-                    if total_deal_money < 200000:
-                        return False, True, f"鏉夸笂鏀鹃噺鎴愪氦閲戦涓嶈冻锛岃繎2s鎬绘垚浜ら噾棰濓細{total_deal_money}灏忎簬20w"
+                    # 鑾峰彇涔�1鐨勫皝鍗曢
+                    buy1_money = code_price_manager.Buy1PriceManager().get_latest_buy1_money(code)
+                    buy1_price = code_price_manager.Buy1PriceManager().get_buy1_price(code)
+                    if buy1_price and abs(limit_up_price - buy1_price) > 0.0001:
+                        # 涔�1鏈定鍋�
+                        buy1_money = 0
+
+                    if not buy1_money:
+                        buy1_money = 1
+                    deal_rate = round(total_deal_money / buy1_money, 2)
+                    if deal_rate < 0.05:
+                        return False, True, f"鏉夸笂鏀鹃噺鎴愪氦閲戦涓嶈冻锛岃繎2s鎬绘垚浜ゆ瘮渚�({deal_rate})锛歿total_deal_money}/{buy1_money}灏忎簬0.05"
             # 鍒ゆ柇鎴愪氦杩涘害鏄惁璺濈鎴戜滑鐨勪綅缃緢杩�
             trade_index, is_default = cls.__TradeBuyQueue.get_traded_index(code)
             if False and not is_default and trade_index:
@@ -2249,6 +2259,11 @@
             # 9:31涔嬪墠涓嬪崟锛屽畨鍏ㄧ瑪鏁版渶灏忎负5绗�
             if int(tool.get_now_time_str().replace(":", "")) < int("093100"):
                 safe_count = max(safe_count, 5)
+            # 娣辫瘉鐨勭エ锛岀涓�娆′笅鍗曞繀椤昏鏈�3绗斿畨鍏ㄧ瑪鏁�
+            if tool.is_sz_code(code):
+                place_order_count = trade_data_manager.PlaceOrderCountManager().get_place_order_count(code)
+                if place_order_count == 0:
+                    safe_count = max(safe_count, 3)
 
             if buy_count < safe_count:
                 not_buy_msg = f"銆恵i}銆戝畨鍏ㄧ瑪鏁颁笉瓒筹紝{buy_count}/{safe_count}"

--
Gitblit v1.8.0