| | |
| | | import threading |
| | | import time |
| | | import concurrent.futures |
| | | from typing import List |
| | | |
| | | from huaxin_client import command_manager, l2_data_transform_protocol |
| | | from huaxin_client import command_manager |
| | | from huaxin_client import constant |
| | | from huaxin_client import l2_data_manager |
| | | import lev2mdapi |
| | | from huaxin_client.code_queue_distribute_manager import CodeQueueDistributeManager, CodeDataCallbackDistributeManager |
| | | from huaxin_client.code_queue_distribute_manager import CodeDataCallbackDistributeManager |
| | | from huaxin_client.command_manager import L2ActionCallback |
| | | from huaxin_client.l2_data_manager import L2DataUploadManager |
| | | from huaxin_client.l2_data_transform_protocol import L2DataCallBack |
| | | from log_module import log, async_log_util |
| | | from log_module.async_log_util import huaxin_l2_log |
| | | from log_module.log import logger_local_huaxin_l2_subscript, logger_system, logger_local_huaxin_l2_transaction, \ |
| | | logger_local_huaxin_g_cancel, logger_l2_codes_subscript |
| | | from log_module.log import logger_local_huaxin_l2_subscript, logger_system, logger_l2_codes_subscript |
| | | from utils import tool |
| | | |
| | | ###B类### |
| | |
| | | |
| | | def __process_codes_data(self, codes_data, from_cache=False, delay=0.0): |
| | | |
| | | if from_cache and self.codes_volume_and_price_dict: |
| | | return |
| | | |
| | | if not self.is_login and not constant.TEST: |
| | | raise Exception("L2尚未登录") |
| | | if delay > 0: |
| | |
| | | self.is_login = True |
| | | logger_system.info(f"L2行情登录成功") |
| | | # 初始设置值 |
| | | if tool.trade_time_sub(tool.get_now_time_str(), "09:20:00") > 0: |
| | | threading.Thread( |
| | | target=lambda: self.__process_codes_data(self.__get_latest_datas(), from_cache=True, delay=6.0), |
| | | target=lambda: self.__process_codes_data(self.__get_latest_datas(), from_cache=True, delay=60), |
| | | daemon=True).start() |
| | | |
| | | def OnRspSubMarketData(self, pSpecificSecurity, pRspInfo, nRequestID, bIsLast): |