Administrator
2023-09-05 bcc38a54b2ca8268d7233b1a0e8250d81ca4bd7d
l2/l2_data_manager_new.py
@@ -1,5 +1,6 @@
import io
import logging
import threading
import time as t
from code_attribute import big_money_num_manager, code_volumn_manager, code_data_util, industry_codes_sort, \
@@ -206,6 +207,7 @@
class L2TradeDataProcessor:
    unreal_buy_dict = {}
    volume_rate_info = {}
    __trade_thread_lock_dict = {}
    __codeActualPriceProcessor = CodeActualPriceProcessor()
    __ths_l2_trade_queue_manager = trade_queue_manager.thsl2tradequeuemanager()
    __thsBuy1VolumnManager = trade_queue_manager.THSBuy1VolumnManager()
@@ -595,8 +597,13 @@
            return False
        else:
            l2_log.debug(code, "可以下单,原因:{}", reason)
            if code not in cls.__trade_thread_lock_dict:
                cls.__trade_thread_lock_dict[code] = threading.RLock()
            cls.__trade_thread_lock_dict[code].acquire()
            try:
                l2_log.debug(code, "开始执行买入")
                trade_manager.start_buy(code, capture_timestamp, last_data,
                                        last_data_index)
@@ -616,7 +623,7 @@
                pass
            finally:
                # l2_log.debug(code, "m值影响因子:{}", l2_trade_factor.L2TradeFactorUtil.factors_to_string(code))
                pass
                cls.__trade_thread_lock_dict[code].release()
            return True
    # 是否可以取消
@@ -916,7 +923,11 @@
    @classmethod
    def __cancel_buy(cls, code):
        # 加锁
        if code not in cls.__trade_thread_lock_dict:
            cls.__trade_thread_lock_dict[code] = threading.RLock()
        try:
            cls.__trade_thread_lock_dict[code].acquire()
            l2_log.debug(code, "开始执行撤单")
            trade_manager.start_cancel_buy(code)
            l2_log.debug(code, "执行撤单成功")
@@ -925,6 +936,9 @@
            logging.exception(e)
            l2_log.debug(code, "执行撤单异常:{}", str(e))
            return False
        finally:
            cls.__trade_thread_lock_dict[code].release()
    @classmethod
    def cancel_buy(cls, code, msg=None, source="l2"):