From 517f6c8ce6c68bfcd652ceeb7b79f79408dfec76 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期二, 28 五月 2024 18:25:13 +0800
Subject: [PATCH] 注释NB撤/bug修改/手动拉黑前撤单/

---
 trade/trade_result_manager.py        |    5 ++++-
 l2/l2_transaction_data_processor.py  |   14 +++++++-------
 trade/huaxin/huaxin_trade_server.py  |   12 +++++++++++-
 third_data/code_plate_key_manager.py |    9 +++++----
 test/l2_trade_test.py                |    9 ++++++++-
 5 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/l2/l2_transaction_data_processor.py b/l2/l2_transaction_data_processor.py
index 77ceadf..ff3bed5 100644
--- a/l2/l2_transaction_data_processor.py
+++ b/l2/l2_transaction_data_processor.py
@@ -150,13 +150,13 @@
                     cancel_result = FCancelBigNumComputer().need_cancel_for_deal_fast(code, buy_progress_index)
                     if cancel_result[0]:
                         L2TradeDataProcessor.cancel_buy(code, f"F鎾�:{cancel_result[1]}")
-                    if not cancel_result[0]:
-                        try:
-                            cancel_result = NBCancelBigNumComputer().need_cancel(code, buy_progress_index)
-                            if cancel_result[0]:
-                                L2TradeDataProcessor.cancel_buy(code, f"澶у競鍊兼棤澶у崟鎾�:{cancel_result[1]}")
-                        except:
-                            pass
+                    # if not cancel_result[0]:
+                    #     try:
+                    #         cancel_result = NBCancelBigNumComputer().need_cancel(code, buy_progress_index)
+                    #         if cancel_result[0]:
+                    #             L2TradeDataProcessor.cancel_buy(code, f"澶у競鍊兼棤澶у崟鎾�:{cancel_result[1]}")
+                    #     except:
+                    #         pass
 
                     if not cancel_result[0] and buy_progress_index_changed:
                         try:
diff --git a/test/l2_trade_test.py b/test/l2_trade_test.py
index 3a8f0bc..73d0941 100644
--- a/test/l2_trade_test.py
+++ b/test/l2_trade_test.py
@@ -235,7 +235,7 @@
 
     # @unittest.skip("璺宠繃姝ゅ崟鍏冩祴璇�")
     def test_block(self):
-        code = "002055"
+        code = "001376"
         # KPLCodeJXBlockManager().load_jx_blocks(code, 23.52,23.62,
         #                                        kpl_data_manager.KPLLimitUpDataRecordManager.get_current_reasons())
         #
@@ -254,6 +254,13 @@
                                                      latest_current_limit_up_records,
                                                      block_info.get_before_blocks_dict(),
                                                      kpl_data_manager.KPLLimitUpDataRecordManager.get_current_limit_up_reason_codes_dict())
+        can_buy_result = CodePlateKeyBuyManager.can_buy(code)
+        print(can_buy_result)
+        if can_buy_result:
+            if can_buy_result[0]:
+                blocks = ",".join([f"{x[0]}-{x[1] + 1}({x[2]}&{x[3] - x[2]})" for x in can_buy_result[0]])
+                print(blocks)
+
         # l2.l2_data_manager_new.L2TradeDataProcessor.can_buy_first(code, None)
 
     @unittest.skip("璺宠繃姝ゅ崟鍏冩祴璇�")
diff --git a/third_data/code_plate_key_manager.py b/third_data/code_plate_key_manager.py
index 582bb39..173a91a 100644
--- a/third_data/code_plate_key_manager.py
+++ b/third_data/code_plate_key_manager.py
@@ -699,7 +699,7 @@
         block_codes_records = set()
         if limit_up_record_datas:
             for k in limit_up_record_datas:
-                if code_limit_up_reasons_dict.get(k[3]) == block:
+                if block in code_limit_up_reasons_dict.get(k[3]):
                     block_codes_records.add(k[3])
 
         if not block_codes:
@@ -759,7 +759,7 @@
 
         if current_shsz_rank < len(current_open_limit_up_codes) + max_rank:
             return True, False, f"銆恵block}銆戝墠鎺掍唬鐮侊細{current_shsz_rank}", is_strong_block, is_active_buy, current_shsz_rank, len(
-                block_codes),len(block_codes_records)
+                block_codes), len(block_codes_records)
         else:
             return False, False, f"銆恵block}銆戝墠鎺掍唬鐮侊細{front_current_shsz_rank_codes} 瓒呰繃{len(current_open_limit_up_codes) + max_rank}涓�", is_strong_block, is_active_buy, current_shsz_rank, len(
                 block_codes), len(block_codes_records)
@@ -814,7 +814,8 @@
                 current_limit_up_block_codes_dict,
                 high_level_code_blocks=high_level_general_code_blocks,
                 high_level_block_codes=high_level_general_block_codes)
-            fresults.append((block, can_buy, unique, msg, is_strong, is_active_buy, current_rank, block_limit_up_count, block_limit_up_record_count))
+            fresults.append((block, can_buy, unique, msg, is_strong, is_active_buy, current_rank, block_limit_up_count,
+                             block_limit_up_record_count))
         return fresults, keys
 
     # 鏄惁鍙互涓嬪崟
@@ -823,7 +824,7 @@
     @classmethod
     def can_buy(cls, code):
         if constant.TEST:
-            return [("娴嬭瘯", 0, 1)], True, cls.BLOCK_TYPE_NONE, [], set(), ["鍖栧伐"]
+            return [("娴嬭瘯", 0, 1, 1)], True, cls.BLOCK_TYPE_NONE, [], set(), ["鍖栧伐"]
         # if True:
         #     # 娴嬭瘯
         #     return True, "涓嶅垽鏂澘鍧楄韩浣�"
diff --git a/trade/huaxin/huaxin_trade_server.py b/trade/huaxin/huaxin_trade_server.py
index 531fd60..8507844 100644
--- a/trade/huaxin/huaxin_trade_server.py
+++ b/trade/huaxin/huaxin_trade_server.py
@@ -875,6 +875,11 @@
                     fresult = {"code": 0, "data": datas}
             elif code_list_type == outside_api_command_manager.CODE_LIST_BLACK:
                 if operate == outside_api_command_manager.OPERRATE_SET:
+                    # 鍏堟墜鍔ㄦ挙鍗�
+                    try:
+                        l2_data_manager_new.L2TradeDataProcessor.cancel_buy(code,"鎵嬪姩鎷夐粦")
+                    except Exception as e:
+                        logger_debug.exception(e)
                     l2_trade_util.forbidden_trade(code, msg="鎵嬪姩鍔犲叆 trade_server")
                     WantBuyCodesManager().remove_code(code)
                     name = gpcode_manager.get_code_name(code)
@@ -1582,7 +1587,7 @@
                                 can_buy_result = CodePlateKeyBuyManager.can_buy(code)
                                 if can_buy_result:
                                     if can_buy_result[0]:
-                                        fdata['block'] = ",".join([f"{x[0]}-{x[1]+1},({x[2]}&{x[3]-x[2]})" for x in can_buy_result[0]])
+                                        fdata['block'] = ",".join([f"{x[0]}-{x[1]+1}({x[2]}&{x[3]-x[2]})" for x in can_buy_result[0]])
                                     else:
                                         if can_buy_result[1]:
                                             if limit_up_data:
@@ -1603,8 +1608,13 @@
                                                                                                      real_place_order_index,
                                                                                                      9)
                                     fdata['trade_queue'] = trade_queue
+                                # 鑷敱娴侀�氳偂鏈�
+                                zyltgb = global_util.zyltgb_map.get(code)
+                                if zyltgb is not None:
+                                    fdata['zyltgb'] = output_util.money_desc(zyltgb)
                             except:
                                 pass
+
                             fdatas.append(fdata)
                         except Exception as e:
                             logger_debug.exception(e)
diff --git a/trade/trade_result_manager.py b/trade/trade_result_manager.py
index 2cd857e..c463c78 100644
--- a/trade/trade_result_manager.py
+++ b/trade/trade_result_manager.py
@@ -6,7 +6,7 @@
 from cancel_strategy.s_l_h_cancel_strategy import SCancelBigNumComputer
 from code_attribute.gpcode_manager import MustBuyCodesManager
 from l2 import l2_data_manager, place_order_single_data_manager
-from l2.cancel_buy_strategy import  FCancelBigNumComputer, \
+from l2.cancel_buy_strategy import FCancelBigNumComputer, \
     NewGCancelBigNumComputer, JCancelBigNumComputer, NBCancelBigNumComputer
 from l2.l2_data_manager import OrderBeginPosInfo
 from l2.l2_data_util import local_today_datas, L2DataUtil
@@ -129,6 +129,9 @@
     if from_real_cancel:
         __latest_cancel_l2_data_dict[code] = total_datas[-1]
 
+    # 鎾ゅ崟鎴愬姛闇�瑕佺Щ闄ょ孩鍚嶅崟
+    MustBuyCodesManager().remove_code(code)
+
 
 # 鏍规嵁鎾ゅ崟鏃堕棿鍒ゆ柇鏄惁鍙互涓嬪崟
 def can_place_order_for_cancel_time(code, buy_exec_data):

--
Gitblit v1.8.0