From 96dc1a4cc38b588f39387b5a85b9677100e357f1 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期四, 23 三月 2023 23:55:40 +0800
Subject: [PATCH] 首板买入打分机制

---
 l2/l2_data_manager_new.py |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/l2/l2_data_manager_new.py b/l2/l2_data_manager_new.py
index e4dfe44..bc39a88 100644
--- a/l2/l2_data_manager_new.py
+++ b/l2/l2_data_manager_new.py
@@ -229,14 +229,13 @@
             # 璁$畻閲�
             volume_rate = code_volumn_manager.get_volume_rate(code)
             volume_rate_index = code_volumn_manager.get_volume_rate_index(volume_rate)
+            l2_log.debug(code,"閲忔瘮锛歿}锛岄噺绱㈠紩锛歿}",volume_rate,volume_rate_index)
             cls.volume_rate_info[code] = (volume_rate, volume_rate_index)
             # 鏄惁涓洪鏉夸唬鐮�
             is_first_code = gpcode_manager.FirstCodeManager.is_in_first_record(code)
             latest_time = add_datas[len(add_datas) - 1]["val"]["time"]
             # 鏃堕棿宸笉鑳藉お澶ф墠鑳藉鐞�
-            if l2.l2_data_util.L2DataUtil.is_same_time(now_time_str,
-                                                       latest_time) and not l2_trade_util.is_in_forbidden_trade_codes(
-                code):
+            if not l2_trade_util.is_in_forbidden_trade_codes(code):
                 # 鍒ゆ柇鏄惁宸茬粡鎸傚崟
                 state = trade_manager.get_trade_state(code)
                 start_index = len(total_datas) - len(add_datas)
@@ -245,8 +244,9 @@
                     # 宸叉寕鍗�
                     cls.__process_order(code, start_index, end_index, capture_timestamp, is_first_code)
                 else:
-                    # 鏈寕鍗�
-                    cls.__process_not_order(code, start_index, end_index, capture_timestamp, is_first_code)
+                    # 鏈寕鍗�,鏃堕棿鐩稿樊涓嶅ぇ鎵嶈兘鎸傚崟
+                    if l2.l2_data_util.L2DataUtil.is_same_time(now_time_str, latest_time):
+                        cls.__process_not_order(code, start_index, end_index, capture_timestamp, is_first_code)
 
             logger_l2_process.info("code:{} 澶勭悊鏁版嵁鑼冨洿: {}-{} 澶勭悊鏃堕棿:{} 鎴浘鏃堕棿鎴筹細{}", code, add_datas[0]["index"],
                                    add_datas[-1]["index"], round(t.time() * 1000) - __start_time,
@@ -321,8 +321,7 @@
                 b_need_cancel, b_cancel_data = SecondCancelBigNumComputer.need_cancel(code, buy_single_index,
                                                                                       buy_exec_index, start_index,
                                                                                       end_index, total_data,
-                                                                                      code_volumn_manager.get_volume_rate_index(
-                                                                                          buy_volume_rate),
+                                                                                      code_volumn_manager.get_volume_rate_index(buy_volume_rate),
                                                                                       cls.volume_rate_info[code][1],
                                                                                       is_first_code)
                 if b_need_cancel:
@@ -566,9 +565,11 @@
                 logging.exception(e)
 
             # 閲忔瘮瓒呰繃1.3鐨勪笉鑳戒拱
-            volumn_rate = l2_trade_factor.L2TradeFactorUtil.get_volumn_rate_by_code(code)
-            if volumn_rate >= 1.3:
+            volumn_rate = cls.volume_rate_info[code][0]
+            if not is_first_code and volumn_rate >= 1.3:
                 return False, False, "鏈�澶ч噺姣旇秴杩�1.3涓嶈兘涔�"
+            elif is_first_code and volumn_rate >= 1.1:
+                return False, False, "棣栨澘鏈�澶ч噺姣旇秴杩�1.1涓嶈兘涔�"
 
             limit_up_time = limit_up_time_manager.get_limit_up_time(code)
             if limit_up_time is not None:

--
Gitblit v1.8.0