From 4076b6a15b3de78d71d4e5df18164b21cc706411 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 05 九月 2024 00:53:32 +0800 Subject: [PATCH] bug修复 --- api/outside_api_command_callback.py | 43 +++++++++++++++++++++++++++---------------- 1 files changed, 27 insertions(+), 16 deletions(-) diff --git a/api/outside_api_command_callback.py b/api/outside_api_command_callback.py index 2bdf7bc..3ea9aaa 100644 --- a/api/outside_api_command_callback.py +++ b/api/outside_api_command_callback.py @@ -33,13 +33,14 @@ logger_trade, logger_trade_position_api_request, logger_request_api, \ logger_real_place_order_position, logger_device from output import l2_output_util -from third_data import kpl_data_manager, kpl_util, history_k_data_manager +from third_data import kpl_data_manager, kpl_util, history_k_data_manager, huaxin_l1_data_manager from third_data.code_plate_key_manager import CodePlateKeyBuyManager from third_data.history_k_data_manager import HistoryKDataManager from third_data.history_k_data_util import JueJinApi, HistoryKDatasUtils from third_data.kpl_data_manager import KPLDataManager +from third_data.kpl_limit_up_data_manager import CodeLimitUpSequenceManager from third_data.kpl_util import KPLDataType -from trade import trade_manager, l2_trade_util +from trade import trade_manager, l2_trade_util, trade_data_manager import l2_data_util as l2_data_util_old from trade.huaxin import huaxin_trade_api, huaxin_trade_data_update, \ @@ -135,7 +136,7 @@ raise Exception("灏氭湭鑾峰彇鍒扮幇浠�") # 鑾峰彇涔�1閲戦 price = round(float(current_price), 2) - buy1_info = L1DataManager.current_buy1_dict.get(code) + buy1_info = huaxin_l1_data_manager.get_buy1_info(code) if buy1_info and buy1_info[0] * buy1_info[1] > 50 * 10000: # 濡傛灉涔�1鍦�50w浠ヤ笂灏卞姞涓�妗� price += 0.01 @@ -362,6 +363,23 @@ gpcode_manager.MustBuyCodesManager().remove_code(code) elif operate == outside_api_command_manager.OPERRATE_GET: codes = gpcode_manager.MustBuyCodesManager().list_code_cache() + datas = [] + for code in codes: + name = gpcode_manager.get_code_name(code) + datas.append(f"{name}:{code}") + fresult = {"code": 0, "data": datas} + elif code_list_type == outside_api_command_manager.CODE_LIST_GREEN: + if operate == outside_api_command_manager.OPERRATE_SET: + gpcode_manager.GreenListCodeManager().add_code(code) + name = gpcode_manager.get_code_name(code) + if not name: + results = HistoryKDatasUtils.get_gp_codes_names([code]) + if results: + gpcode_manager.CodesNameManager.add_first_code_name(code, results[code]) + elif operate == outside_api_command_manager.OPERRATE_DELETE: + gpcode_manager.GreenListCodeManager().remove_code(code) + elif operate == outside_api_command_manager.OPERRATE_GET: + codes = gpcode_manager.GreenListCodeManager().list_codes_cache() datas = [] for code in codes: name = gpcode_manager.get_code_name(code) @@ -817,7 +835,7 @@ except Exception as e: self.send_response({"code": 1, "msg": str(e)}, client_id, request_id) elif ctype == "get_delegated_buy_code_infos": - account_available_money = trade_manager.AccountAvailableMoneyManager().get_available_money_cache() + account_available_money = trade_data_manager.AccountMoneyManager().get_available_money_cache() # 鑾峰彇濮旀墭涓殑浠g爜 # current_delegates = huaxin_trade_record_manager.DelegateRecordManager().list_current_delegates() current_delegates, update_time = huaxin_trade_record_manager.DelegateRecordManager.list_by_day( @@ -1035,17 +1053,9 @@ limit_up_data = kpl_data_manager.KPLLimitUpDataRecordManager.record_code_dict.get(code) # 鑾峰彇褰撳墠鏉垮潡 try: - can_buy_result = CodePlateKeyBuyManager.can_buy(code) - if can_buy_result: - if can_buy_result[0]: - fdata['block'] = ",".join( - [f"{x[0]}-{x[1] + 1}({x[2]}&{x[3] - x[2]})" for x in can_buy_result[0]]) - else: - if can_buy_result[1]: - if limit_up_data: - fdata['block'] = f"{limit_up_data[5]}-鐙嫍" - else: - fdata['block'] = f"鐙嫍" + limit_up_sequence = CodeLimitUpSequenceManager.get_current_limit_up_sequence(code) + if limit_up_sequence: + fdata['block'] = f"{limit_up_sequence[0]}-{limit_up_sequence[1]}({limit_up_sequence[2]}&{limit_up_sequence[2] - limit_up_sequence[3]})" except: pass # 鑾峰彇娑ㄥ仠鏃堕棿 @@ -1184,7 +1194,8 @@ elif ctype == "get_buy_block_mode": # 鑾峰彇涔板叆鏉垮潡鐨勬ā寮� can_buy_unique_block = TradeBlockBuyModeManager().can_buy_unique_block() - self.send_response({"code": 0, "data": {"unique_block": 1 if can_buy_unique_block else 0 }, "msg": f""}, client_id, + self.send_response({"code": 0, "data": {"unique_block": 1 if can_buy_unique_block else 0}, "msg": f""}, + client_id, request_id) elif ctype == "set_buy_unique_block_mode": -- Gitblit v1.8.0