| | |
| | | code = data['SecurityID'] |
| | | if code in buy_order_nos_dict: |
| | | if data['BuyNo'] in buy_order_nos_dict[code]: |
| | | if code not in latest_big_order_transaction_orders_dict: |
| | | latest_big_order_transaction_orders_dict[code] = set() |
| | | latest_big_order_transaction_orders_dict[code].add(data['BuyNo']) |
| | | temp_list = latest_big_order_transaction_orders_dict.get(code) |
| | | if not temp_list: |
| | | temp_list = [] |
| | | if temp_list: |
| | | if temp_list[-1] != data['BuyNo']: |
| | | temp_list.append(data['BuyNo']) |
| | | if len(temp_list) > 10: |
| | | temp_list = temp_list[-10:] |
| | | latest_big_order_transaction_orders_dict[code] = temp_list |
| | | else: |
| | | temp_list.append(data['BuyNo']) |
| | | |
| | | |
| | | |
| | | |
| | | tmep_transaction_queue_dict[code].put((data['SecurityID'], data['TradePrice'], data['TradeVolume'], |
| | | data['OrderTime'], data['MainSeq'], data['SubSeq'], data['BuyNo'], |
| | | data['SellNo'], data['ExecType'])) |
| | |
| | | if code not in target_codes: |
| | | return |
| | | # 如果最近的活动时间小于2s就不需要运行 |
| | | if code not in order_detail_upload_active_time_dict or time.time() - order_detail_upload_active_time_dict[code] > 2: |
| | | if code not in order_detail_upload_active_time_dict or time.time() - order_detail_upload_active_time_dict[ |
| | | code] > 2: |
| | | t = threading.Thread(target=lambda: __run_upload_order(code, l2_data_callback), daemon=True) |
| | | t.start() |
| | | __upload_order_threads[code] = t |
| | | |
| | | if code not in transaction_upload_active_time_dict or time.time() - transaction_upload_active_time_dict[code] > 2: |
| | | if code not in transaction_upload_active_time_dict or time.time() - transaction_upload_active_time_dict[ |
| | | code] > 2: |
| | | t = threading.Thread(target=lambda: __run_upload_trans(code, l2_data_callback), daemon=True) |
| | | t.start() |
| | | __upload_trans_threads[code] = t |
| | |
| | | # 目标代码加入2s之后启动守护 |
| | | if time.time() - target_codes_add_time[code] > 2: |
| | | if code not in __upload_order_threads or not __upload_order_threads[code].is_alive(): |
| | | t = threading.Thread(target=lambda: __run_upload_order(code, _l2_data_callback), daemon=True) |
| | | t = threading.Thread(target=lambda: __run_upload_order(code, _l2_data_callback), |
| | | daemon=True) |
| | | t.start() |
| | | __upload_order_threads[code] = t |
| | | logger_local_huaxin_l2_upload.info(f"重新创建L2订单上传线程:{code}") |
| | | if code not in __upload_trans_threads or not __upload_trans_threads[code].is_alive(): |
| | | t = threading.Thread(target=lambda: __run_upload_trans(code, _l2_data_callback), daemon=True) |
| | | t = threading.Thread(target=lambda: __run_upload_trans(code, _l2_data_callback), |
| | | daemon=True) |
| | | t.start() |
| | | __upload_trans_threads[code] = t |
| | | logger_local_huaxin_l2_upload.info(f"重新创建L2成交上传线程:{code}") |
| | |
| | | pass |
| | | finally: |
| | | time.sleep(3) |
| | | |
| | | t = threading.Thread(target=lambda: upload_daemon(), daemon=True) |
| | | t.start() |
| | | |