From 327a8eb71ee0cf826ec4e5aadaceaf539065c3e0 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期三, 17 七月 2024 11:07:34 +0800 Subject: [PATCH] 解决订阅的bug --- servers/huaxin_trade_api_server.py | 29 +++-------------------------- 1 files changed, 3 insertions(+), 26 deletions(-) diff --git a/servers/huaxin_trade_api_server.py b/servers/huaxin_trade_api_server.py index 2a16a1f..b4e671f 100644 --- a/servers/huaxin_trade_api_server.py +++ b/servers/huaxin_trade_api_server.py @@ -435,32 +435,10 @@ datas = _datas[1] request_id = _datas[2] logger_l2_codes_subscript.info("({})璇诲彇L2浠g爜澶勭悊闃熷垪锛氭暟閲�-{}", request_id, len(datas)) - print("鏃堕棿鎴筹細", times) - print("鍐呭锛�", datas) # 鍙鐞�20s鍐呯殑鏁版嵁 if time.time() - times < 20: # 鑾峰彇娑ㄥ仠鍒楄〃涓殑鏁版嵁 # datas涓殑鏁版嵁鏍煎紡:(浠g爜, 鐜颁环, 娑ㄥ箙, 閲�, 鏃堕棿) - codes = [d[0] for d in datas] - # 9锛�25-9锛�30涔嬮棿鑾峰彇 - if int("092500") < int(tool.get_now_time_str().replace(":", "")) < int("092955"): - try: - limit_up_data_str = kpl_api.getLimitUpInfoNew() - limit_up_datas = json.loads(limit_up_data_str) - limit_up_datas = limit_up_datas["list"] - for d in limit_up_datas: - code = d[0] - if code in codes: - continue - if not tool.is_can_buy_code(code): - continue - limit_up_price = gpcode_manager.get_limit_up_price(d[0]) - if limit_up_price: - # 榛樿璁剧疆娑ㄥ仠锛岄噺涓�0 - datas.append((code, 0, float(limit_up_price), - tool.get_shadow_price(float(limit_up_price)), 100)) - except Exception as e: - logger_l2_codes_subscript.exception(e) if not datas: # 娌℃湁鏁版嵁闇�瑕佸鐞� continue @@ -472,9 +450,8 @@ root_data = {"type": ClientSocketManager.CLIENT_TYPE_CMD_L2, "data": datas} queue_other_w_l2_r.put_nowait(json.dumps(root_data)) - print("璁剧疆L2浠g爜缁撴潫") - # 濡傛灉鍦�9:24-9:30 闇�瑕佸姞杞芥澘鍧� - if int("092400") < int(tool.get_now_time_str().replace(":", "")) < int("093000"): + # 濡傛灉鍦�9:24-9:29 闇�瑕佸姞杞芥澘鍧� + if int("092400") < int(tool.get_now_time_str().replace(":", "")) < int("092900"): for d in datas: threading.Thread(target=lambda: KPLCodeJXBlockManager().load_jx_blocks(d[0], gpcode_manager.get_price( @@ -482,7 +459,7 @@ float(d[2]), KPLLimitUpDataRecordManager.get_current_reasons()), daemon=True).start() - time.sleep(1) + time.sleep(0.2) logger_l2_codes_subscript.info("({})鍙戦�佸埌鍗庨懌L2浠g爜澶勭悊闃熷垪锛氭暟閲�-{}", request_id, len(datas)) except Exception as e: logging.exception(e) -- Gitblit v1.8.0