From dc6097632b647f3797f086b7d93e1ae32260de4f Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 10 十月 2024 18:34:19 +0800 Subject: [PATCH] 增加接口/加绿规则更改 --- api/outside_api_command_callback.py | 26 ++++++++++++++++++++------ 1 files changed, 20 insertions(+), 6 deletions(-) diff --git a/api/outside_api_command_callback.py b/api/outside_api_command_callback.py index 0ac54ec..5f800bc 100644 --- a/api/outside_api_command_callback.py +++ b/api/outside_api_command_callback.py @@ -26,7 +26,7 @@ l2_data_source_util, cancel_buy_strategy from l2.code_price_manager import Buy1PriceManager -from l2.l2_data_manager import TradePointManager +from l2.l2_data_manager import TradePointManager, OrderBeginPosInfo from l2.l2_data_util import L2DataUtil from l2.l2_transaction_data_manager import HuaXinBuyOrderManager, BigOrderDealManager from log_module import async_log_util, log_export @@ -281,10 +281,14 @@ code_list_type = data["code_list_type"] operate = data["operate"] code = data.get("code") + if code and not tool.is_can_buy_code(code): + raise Exception(f"涓嶆槸鍙互浜ゆ槗鐨勪唬鐮侊細{code}") fresult = {"code": 0} if code_list_type == outside_api_command_manager.CODE_LIST_WANT: if operate == outside_api_command_manager.OPERRATE_SET: gpcode_manager.WantBuyCodesManager().add_code(code) + # 鍔犳兂涔板崟瑕佷粠榛戝悕鍗曠Щ闄� + l2_trade_util.remove_from_forbidden_trade_codes(code) name = gpcode_manager.get_code_name(code) if not name: results = HistoryKDatasUtils.get_gp_codes_names([code]) @@ -439,7 +443,8 @@ white = gpcode_manager.WhiteListCodeManager().is_in_cache(code) black = l2_trade_util.is_in_forbidden_trade_codes(code) pause_buy = gpcode_manager.PauseBuyCodesManager().is_in_cache(code) - + must_buy = gpcode_manager.MustBuyCodesManager().is_in_cache(code) + green = gpcode_manager.GreenListCodeManager().is_in_cache(code) desc_list = [] if want: desc_list.append("銆愭兂涔板崟銆�") @@ -449,6 +454,12 @@ desc_list.append("銆愰粦鍚嶅崟銆�") if pause_buy: desc_list.append("銆愭殏涓嶄拱銆�") + if must_buy: + desc_list.append("銆愮孩鍚嶅崟銆�") + if green: + desc_list.append("銆愮豢鍚嶅崟銆�") + + result = {"code": 0, "data": {"code_info": (code, code_name), "desc": "".join(desc_list)}} self.send_response(result, client_id, request_id) except Exception as e: @@ -866,7 +877,7 @@ # 鑾峰彇涓嬪崟浣嶇疆淇℃伅 order_begin_pos = TradePointManager().get_buy_compute_start_data_cache(code) if order_begin_pos is None or order_begin_pos.buy_single_index is None: - continue + order_begin_pos = OrderBeginPosInfo(buy_single_index=0, buy_exec_index=0) l2_data_util.load_l2_data(code) total_datas = l2_data_util.local_today_datas.get(code) trade_index, is_default = transaction_progress.TradeBuyQueue().get_traded_index(code) @@ -874,6 +885,8 @@ trade_index = 0 # 涓嬪崟浣嶇疆 place_order_index = SCancelBigNumComputer().get_real_place_order_index_cache(code) + if place_order_index is None: + place_order_index = 0 # 璁$畻淇″彿浣嶇疆鍒扮湡瀹炰笅鍗曚綅缃殑鎬讳拱锛堜笉绠℃槸鍚﹀凡鎾わ級 total_nums = 0 for i in range(order_begin_pos.buy_single_index, place_order_index): @@ -1257,8 +1270,8 @@ # 璁剧疆涔板叆閲戦鍜屾暟閲� normal = data["normal"] radical = data["radical"] - BuyMoneyAndCountSetting().set_normal_buy_data(normal[0],json.loads( normal[1])) - BuyMoneyAndCountSetting().set_radical_buy_data(radical[0],json.loads( radical[1])) + BuyMoneyAndCountSetting().set_normal_buy_data(normal[0], json.loads(normal[1])) + BuyMoneyAndCountSetting().set_radical_buy_data(radical[0], json.loads(radical[1])) data = { "normal": BuyMoneyAndCountSetting().get_normal_buy_setting(), "radical": BuyMoneyAndCountSetting().get_radical_buy_setting() @@ -1270,7 +1283,8 @@ # 璁剧疆涔板叆閲戦鍜屾暟閲� data = { "normal": BuyMoneyAndCountSetting().get_normal_buy_setting(), - "radical": BuyMoneyAndCountSetting().get_radical_buy_setting() + "radical": BuyMoneyAndCountSetting().get_radical_buy_setting(), + "moneys":constant.AVAILABLE_BUY_MONEYS } self.send_response({"code": 0, "data": data, "msg": f""}, client_id, -- Gitblit v1.8.0