| | |
| | | api.Init() |
| | | |
| | | logger_system.info("L1订阅服务启动成功") |
| | | # 测试链路 |
| | | # level1_data_dict["000969"] = ( |
| | | # "000969", 9.46, 9.11, 771000*100, time.time()) |
| | | # level1_data_dict["002292"] = ( |
| | | # "002292", 8.06, 9.96, 969500 * 100, time.time()) |
| | | # TODO 测试链路 |
| | | # spi.l1_data_queue.append(( |
| | | # "000969", 9.46, 9.11, 771000*100, time.time(),9.46,10000)) |
| | | # spi.l1_data_queue.append(( |
| | | # "002292", 8.06, 9.96, 969500 * 100, time.time(),8.06,10000)) |
| | | |
| | | threading.Thread(target=__read_from_strategy, args=(queue_l1_trade_r_strategy_w,), daemon=True).start() |
| | | # 等待程序结束 |
| | |
| | | print("run_sync", add_to_common_log) |
| | | logger_system.info(f"run_sync 线程ID:{tool.get_thread_id()}") |
| | | while True: |
| | | # val = self.__log_queue.get() |
| | | try: |
| | | val = self.__log_queue.get() |
| | | if not add_to_common_log: |
| | |
| | | __add_data({"type": "position_list"}) |
| | | |
| | | |
| | | def test(): |
| | | time.sleep(2) |
| | | position_codes =["000333"] |
| | | queue_l1_trade_r_strategy_w.put_nowait( |
| | | {"type": "set_target_codes", "data": list(position_codes)}) |
| | | |
| | | # 运行 |
| | | def run(queue_l1_trade_r_strategy_w_): |
| | | global queue_l1_trade_r_strategy_w |
| | | queue_l1_trade_r_strategy_w = queue_l1_trade_r_strategy_w_ |
| | | t1 = threading.Thread(target=lambda: __read_update_task_queue(), daemon=True) |
| | | t1.start() |
| | | # threading.Thread(target=lambda: test(), daemon=True).start() |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | |
| | | if type_ == "upload_l1_trade_datas": |
| | | # 处理专为交易提供的L1数据 |
| | | L1DataProcessor.set_l1_trade_codes_info(val) |
| | | async_log_util.info(logger_local_huaxin_l1_trade_info, val) |
| | | async_log_util.info(logger_local_huaxin_l1_trade_info, f"{val}") |
| | | except Exception as e: |
| | | logger_local_huaxin_l1_trade_info.exception(e) |
| | | logging.exception(e) |