From 1d9184bfe1ac61703abfb3a9a4072608bfa28654 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 30 八月 2023 18:02:15 +0800 Subject: [PATCH] bug修复 --- middle_api_server.py | 32 ++++++++++++++++++++++++-------- 1 files changed, 24 insertions(+), 8 deletions(-) diff --git a/middle_api_server.py b/middle_api_server.py index 8026490..e86d280 100644 --- a/middle_api_server.py +++ b/middle_api_server.py @@ -63,7 +63,7 @@ type_ = data_json['type'] if type(type_) == int: # 澶勭悊鏁板瓧鍨婽YPE - return_str = self.process_num_type(sk, type_, data_str) + return_str = self.process_num_type(sk, type_, data_str) break is_sign_right = socket_util.is_client_params_sign_right(data_json) @@ -89,7 +89,7 @@ price = prices[0][1] # 涓嬪崟 result = hosting_api_util.trade_order(hosting_api_util.TRADE_DIRECTION_BUY, code, volume, - round(float(price), 2)) + round(float(price), 2)) if result: resultJSON = result print("涓嬪崟缁撴灉锛�", resultJSON) @@ -109,8 +109,8 @@ orderSysID = codes_data.get("orderSysID") accountId = codes_data.get("accountId") if code: - result = hosting_api_util.trade_cancel_order(hosting_api_util.TRADE_DIRECTION_BUY, code, - orderSysID, True) + result = hosting_api_util.trade_cancel_order(hosting_api_util.TRADE_DIRECTION_BUY, code,accountId, + orderSysID, True) print("---鎾ゅ崟缁撴灉----") print(result) if result["code"] == 0: @@ -139,7 +139,8 @@ # 宸茬幇浠风殑5妗d环鍗� price = prices[0][1] - 0.04 - result = hosting_api_util.trade_order(hosting_api_util.TRADE_DIRECTION_SELL, code, volume, price) + result = hosting_api_util.trade_order(hosting_api_util.TRADE_DIRECTION_SELL, code, volume, + price) if result["code"] == 0: return_str = json.dumps({"code": 0, "msg": ""}) else: @@ -189,15 +190,19 @@ elif type_ == "get_huaxin_subscript_codes": # 鑾峰彇鍗庨懌璁㈤槄鐨勪唬鐮� fresults = global_data_cache_util.huaxin_subscript_codes + update_time = global_data_cache_util.huaxin_subscript_codes_update_time + if update_time is None: + update_time = '' return_str = json.dumps( - {"code": 0, "data": {"count": len(fresults), "list": fresults}, "msg": ""}) + {"code": 0, "data": {"count": len(fresults), "list": fresults, "update_time": update_time}, + "msg": ""}) pass elif type_ == "export_l2_data": # 瀵煎嚭L2鏁版嵁 code = data_json["data"]["code"] hosting_api_util.export_l2_data(code) return_str = json.dumps( - {"code": 0, "data": {}, "msg": ""}) + {"code": 0, "data": {}, "msg": ""}) elif type_ == 'everyday_init': # 姣忔棩鍒濆鍖� hosting_api_util.everyday_init() @@ -222,6 +227,17 @@ elif type_ == 'get_env_info': # 鑾峰彇鐜淇℃伅 result = hosting_api_util.get_env_info() + return_str = json.dumps(result) + elif type_ == 'sync_l1_subscript_codes': + # 鑾峰彇鐜淇℃伅 + result = hosting_api_util.sync_l1_subscript_codes() + return_str = json.dumps(result) + + elif type_ == 'get_system_logs': + # 鑾峰彇鐜淇℃伅 + start_index = data_json["data"]["start_index"] + count = data_json["data"]["count"] + result = hosting_api_util.get_system_logs(start_index,count) return_str = json.dumps(result) elif type_ == 'test_redis': redis = redis_manager.RedisManager(5).getRedisNoPool() @@ -387,7 +403,7 @@ elif type == 504: # 鑾峰彇浜ゆ槗鐩爣浠g爜妯″紡 result = hosting_api_util.get_trade_mode() - return_str =json.dumps(result) + return_str = json.dumps(result) except Exception as e: return_str = json.dumps({"code": 1, "msg": str(e)}) return return_str -- Gitblit v1.8.0