import threading import asyncio from ws_client import start_ws_clients, stop_all_threads from ws_server import start_websocket_server from data_processing import log_and_save_fill_probabilities # 启动 WebSocket 客户端 start_ws_clients() # 启动定期保存和打印线程 log_and_save_thread = threading.Thread(target=log_and_save_fill_probabilities) log_and_save_thread.start() # 启动 WebSocket 服务器 asyncio.run(start_websocket_server()) # 停止所有线程(在需要停止时调用) # stop_all_threads()