| | |
| | | from huaxin_client.l2_data_transform_protocol import L2DataCallBack |
| | | from log_module import log_export, async_log_util |
| | | from log_module.log import logger_local_huaxin_l2_error, logger_local_huaxin_l2_upload, logger_local_huaxin_l2_buy_no, \ |
| | | logger_local_huaxin_g_cancel, hx_logger_contact_debug, logger_system |
| | | logger_local_huaxin_g_cancel, hx_logger_contact_debug, logger_system, logger_local_huaxin_l2_orderdetail |
| | | from utils import tool |
| | | |
| | | order_detail_upload_active_time_dict = {} |
| | |
| | | # 添加委托详情 |
| | | def add_l2_order_detail(data, istransaction=False): |
| | | code = data["SecurityID"] |
| | | # 异步日志记录 |
| | | async_log_util.huaxin_l2_log.info(logger_local_huaxin_l2_orderdetail, data) |
| | | if code not in tmep_order_detail_queue_dict: |
| | | tmep_order_detail_queue_dict[code] = queue.Queue() |
| | | if istransaction: |
| | | pass |
| | | else: |
| | | pass |
| | | # 原来的格式 |
| | | # {"SecurityID": pOrderDetail['SecurityID'], "Price": pOrderDetail['Price'], |
| | | # "Volume": pOrderDetail['Volume'], |
| | |
| | | buy_order_nos_dict[data['SecurityID']] = set() |
| | | buy_order_nos_dict[data['SecurityID']].add(data['OrderNO']) |
| | | # 买入订单号需要记录日志 |
| | | log_buy_no_queue.put_nowait((data['SecurityID'], data['OrderNO'])) |
| | | async_log_util.huaxin_l2_log.info(logger_local_huaxin_l2_buy_no, f"{data['SecurityID']}#{data['OrderNO']}") |
| | | |
| | | tmep_order_detail_queue_dict[code].put( |
| | | (data['SecurityID'], data['Price'], data['Volume'], data['Side'], data['OrderType'], data['OrderTime'], |
| | |
| | | def __run_log(): |
| | | print("__run_log") |
| | | logger_system.info(f"l2_client __run_log 线程ID:{tool.get_thread_id()}") |
| | | while True: |
| | | try: |
| | | temp = log_buy_no_queue.get() |
| | | if temp: |
| | | logger_local_huaxin_l2_buy_no.info(f"{temp[0]}#{temp[1]}") |
| | | except: |
| | | pass |
| | | async_log_util.huaxin_l2_log.run_sync() |
| | | |
| | | |
| | | __upload_order_threads = {} |