From dc07dced17c3bdcb96d73f356897bf61ef36f77e Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 30 八月 2023 18:17:12 +0800 Subject: [PATCH] bug修复 --- utils/hosting_api_util.py | 31 +++++++++++++++++++++++++------ 1 files changed, 25 insertions(+), 6 deletions(-) diff --git a/utils/hosting_api_util.py b/utils/hosting_api_util.py index 3eed44c..d8b5374 100644 --- a/utils/hosting_api_util.py +++ b/utils/hosting_api_util.py @@ -34,6 +34,9 @@ API_TYPE_CODE_ATRRIBUTE = "code_attribute" # 浠g爜灞炴�� API_TYPE_CODE_TRADE_STATE = "code_trade_state" # 浠g爜浜ゆ槗鐘舵�� API_TYPE_GET_ENV = "get_env" # 鑾峰彇鐜淇℃伅 +API_TYPE_SYNC_L1_TARGET_CODES = "sync_l1_subscript_codes" # 鍚屾L1闇�瑕佽闃呯殑浠g爜 +API_TYPE_SYSTEM_LOG = "system_log" # 绯荤粺鏃ュ織 + # 瓒呮椂鏃堕棿2s TIMEOUT = 5.0 @@ -206,7 +209,7 @@ def export_l2_data(code, blocking=True): request_id, client = __request(ClientSocketManager.CLIENT_TYPE_TRADE, {"type": API_TYPE_EXPORT_L2, "code": code, - "sinfo": f"cb_{API_TYPE_CODE_LIST}_{round(time.time() * 1000)}"}) + "sinfo": f"cb_{API_TYPE_EXPORT_L2}_{round(time.time() * 1000)}"}) return __read_response(client, request_id, blocking) @@ -214,7 +217,7 @@ def everyday_init(blocking=True): request_id, client = __request(ClientSocketManager.CLIENT_TYPE_TRADE, {"type": API_TYPE_INIT, - "sinfo": f"cb_{API_TYPE_CODE_LIST}_{round(time.time() * 1000)}"}) + "sinfo": f"cb_{API_TYPE_INIT}_{round(time.time() * 1000)}"}) return __read_response(client, request_id, blocking) @@ -222,7 +225,7 @@ def refresh_trade_data(type, blocking=True): request_id, client = __request(ClientSocketManager.CLIENT_TYPE_TRADE, {"type": API_TYPE_REFRESH_TRADE_DATA, "ctype": type, - "sinfo": f"update_trade_data_{round(time.time() * 1000)}"}) + "sinfo": f"cb_{API_TYPE_REFRESH_TRADE_DATA}_{round(time.time() * 1000)}"}) return __read_response(client, request_id, blocking) @@ -230,7 +233,7 @@ def get_code_attribute(code, blocking=True): request_id, client = __request(ClientSocketManager.CLIENT_TYPE_TRADE, {"type": API_TYPE_CODE_ATRRIBUTE, "code": code, - "sinfo": f"update_trade_data_{round(time.time() * 1000)}"}) + "sinfo": f"cb_{API_TYPE_CODE_ATRRIBUTE}_{round(time.time() * 1000)}"}) return __read_response(client, request_id, blocking) @@ -238,7 +241,7 @@ def get_code_trade_state(code, blocking=True): request_id, client = __request(ClientSocketManager.CLIENT_TYPE_TRADE, {"type": API_TYPE_CODE_TRADE_STATE, "code": code, - "sinfo": f"update_trade_data_{round(time.time() * 1000)}"}) + "sinfo": f"{API_TYPE_CODE_TRADE_STATE}_{round(time.time() * 1000)}"}) return __read_response(client, request_id, blocking) @@ -246,7 +249,23 @@ def get_env_info(blocking=True): request_id, client = __request(ClientSocketManager.CLIENT_TYPE_TRADE, {"type": API_TYPE_GET_ENV, - "sinfo": f"update_trade_data_{round(time.time() * 1000)}"}) + "sinfo": f"cb_{API_TYPE_GET_ENV}_{round(time.time() * 1000)}"}) + return __read_response(client, request_id, blocking) + + +# 鑾峰彇鐜淇℃伅 +def sync_l1_subscript_codes(blocking=True): + request_id, client = __request(ClientSocketManager.CLIENT_TYPE_TRADE, + {"type": API_TYPE_SYNC_L1_TARGET_CODES, + "sinfo": f"cb_{API_TYPE_SYNC_L1_TARGET_CODES}_{round(time.time() * 1000)}"}) + return __read_response(client, request_id, blocking) + + +# 鑾峰彇绯荤粺鏃ュ織 +def get_system_logs(start_index, count, blocking=True): + request_id, client = __request(ClientSocketManager.CLIENT_TYPE_TRADE, + {"type": API_TYPE_SYSTEM_LOG, "start_index": start_index, "count": count, + "sinfo": f"cb_{API_TYPE_SYSTEM_LOG}_{round(time.time() * 1000)}"}) return __read_response(client, request_id, blocking) -- Gitblit v1.8.0