From 4f16bf0f1686e2a15fcbc43e17c727c81550609f Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 17 七月 2025 14:19:18 +0800 Subject: [PATCH] 人为设置的累计大单的策略修改 --- api/outside_api_command_callback.py | 82 ++++++++++++++++++++++++++++++++++++++--- 1 files changed, 76 insertions(+), 6 deletions(-) diff --git a/api/outside_api_command_callback.py b/api/outside_api_command_callback.py index eec88d9..fdb57b8 100644 --- a/api/outside_api_command_callback.py +++ b/api/outside_api_command_callback.py @@ -15,7 +15,7 @@ import inited_data import outside_api_command_manager from cancel_strategy.s_l_h_cancel_strategy import SCancelBigNumComputer, LCancelRateManager, \ - CancelRateHumanSettingManager + CancelRateHumanSettingManager, LCancelBigNumComputer, LDownCancelWatchIndexStatisticManager from code_attribute import gpcode_manager, code_volumn_manager, zyltgb_util, code_nature_analyse from code_attribute.code_data_util import ZYLTGBUtil from code_attribute.code_l1_data_manager import L1DataManager @@ -60,7 +60,7 @@ from trade.sell import sell_manager from trade.sell.sell_rule_manager import TradeRuleManager, SellRule from trade.trade_data_manager import RadicalBuyDealCodesManager -from trade.trade_manager import TradeTargetCodeModeManager, AutoCancelSellModeManager +from trade.trade_manager import TradeTargetCodeModeManager, AutoCancelSellModeManager, CodesContinueBuyMoneyManager from settings.trade_setting import MarketSituationManager, TradeBlockBuyModeManager from utils import socket_util, data_export_util, tool, huaxin_util, output_util, global_util, init_data_util from servers import server_util @@ -400,7 +400,13 @@ 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) + trade_record_log_util.add_green(code, "浜轰负鍔犵豢") + gpcode_manager.WantBuyCodesManager().add_code(code) + # 鍔犵櫧 + gpcode_manager.WhiteListCodeManager().add_code(code, is_human=True) + trade_record_log_util.add_white_buy(code, "鍔犵豢鍔犵櫧") + name = gpcode_manager.get_code_name(code) if not name: results = HistoryKDatasUtils.get_gp_codes_names([code]) @@ -408,7 +414,7 @@ gpcode_manager.CodesNameManager.add_first_code_name(code, results[code]) elif operate == outside_api_command_manager.OPERRATE_DELETE: gpcode_manager.GreenListCodeManager().remove_code(code) - gpcode_manager.WantBuyCodesManager().remove_code(code) + gpcode_manager.WhiteListCodeManager().remove_code(code) elif operate == outside_api_command_manager.OPERRATE_GET: codes = gpcode_manager.GreenListCodeManager().list_codes_cache() datas = [] @@ -880,12 +886,16 @@ [huaxin_util.TORA_TSTP_OST_Accepted, huaxin_util.TORA_TSTP_OST_PartTraded]) fdatas = [] if current_delegates: + codes_set = set() for c in current_delegates: try: if int(c["direction"]) != huaxin_util.TORA_TSTP_D_Buy: continue code = c["securityID"] + if code in codes_set: + continue orderSysID = c.get("orderSysID") + codes_set.add(code) code_name = gpcode_manager.get_code_name(code) # 鑾峰彇涓嬪崟浣嶇疆淇℃伅 order_begin_pos = TradePointManager().get_buy_compute_start_data_cache(code) @@ -1154,7 +1164,17 @@ fdata['mode'] = -1 except: pass - + # L鍚庡泭鎷揩鐓� + try: + current_info = LCancelBigNumComputer().statistic_l_down_watch_indexes_info(code) + last_info = LDownCancelWatchIndexStatisticManager().get_statistic_info(code) + fdata['l_down_watch_indexes_info'] = {} + if current_info: + fdata['l_down_watch_indexes_info']['current'] = current_info + if last_info: + fdata['l_down_watch_indexes_info']['last'] = last_info + except: + pass fdatas.append(fdata) except Exception as e: logger_debug.exception(e) @@ -1497,7 +1517,18 @@ client_id, request_id) return - TotalDealBigOrderThresholdMoneyManager().set_money(code, int(money)) + TotalDealBigOrderThresholdMoneyManager().set_money(code, int(money), + trade_manager.CodesTradeStateManager().get_trade_state_cache( + code)) + + # 濡傛灉鏄姞绾㈢姸鎬侊紝涓斿ぇ鍗曚笉澶熷氨闇�瑕佺Щ绾� + if gpcode_manager.MustBuyCodesManager().is_in_cache(code): + deal_big_order_info = radical_buy_data_manager.get_total_deal_big_order_info(code, + gpcode_manager.get_limit_up_price_as_num( + code)) + if deal_big_order_info[0] > 0: + gpcode_manager.MustBuyCodesManager().remove_code(code) + trade_record_log_util.add_common_msg(code, "绉荤孩", f"澶у崟闃堝�间慨鏀癸紙{money}锛�") self.send_response({"code": 0, "data": {}}, client_id, request_id) @@ -1505,13 +1536,52 @@ # 璁剧疆L鍚庢挙鍗曟瘮渚� code = data.get("code") rate = data.get("rate") - if rate < 0 or rate > 1: + if rate < 0 or rate > 2: self.send_response({"code": 1, "msg": "姣斾緥鑼冨洿涓嶅湪0-1涔嬮棿"}, client_id, request_id) return rate = round(rate, 2) + old_rate = LCancelRateManager().get_cancel_rate(0)[0] + # L鍚庢暟鎹揩鐓� + last_info = LCancelBigNumComputer().statistic_l_down_watch_indexes_info(code) + LDownCancelWatchIndexStatisticManager().set_statistic_info(code, last_info) CancelRateHumanSettingManager().set_l_down(code, rate) + # L鍚庨噸鏂板泭鎷� + if rate < old_rate: + # 鏀瑰皬鎵嶈兘閲嶆柊鍥婃嫭 + LCancelBigNumComputer().re_compute_l_down_watch_indexes(code) + self.send_response({"code": 0, "data": {}}, + client_id, + request_id) + + elif ctype == "get_continue_buy_info": + # 璁剧疆L鍚庢挙鍗曟瘮渚� + code = data.get("code") + money = CodesContinueBuyMoneyManager().get_continue_buy_money(code) + if money is None: + money = 0 + self.send_response({"code": 0, "data": {"money": money, "money_list": constant.AVAILABLE_BUY_MONEYS}}, + client_id, + request_id) + elif ctype == "set_continue_buy_money": + # 璁剧疆L鍚庢挙鍗曟瘮渚� + code = data.get("code") + money = data.get("money") + if money <= 0: + # 琛ㄧず绉婚櫎缁拱閲戦 + CodesContinueBuyMoneyManager().remove_continue_buy_money(code) + self.send_response({"code": 0, "data": {}}, + client_id, + request_id) + return + if money not in constant.AVAILABLE_BUY_MONEYS: + self.send_response({"code": 1, "msg": f"閲戦锛坽money}锛夋病鍦▄constant.AVAILABLE_BUY_MONEYS}涓�"}, + client_id, + request_id) + return + CodesContinueBuyMoneyManager().set_continue_buy_money(code, money) + l2_trade_util.remove_from_forbidden_trade_codes(code) self.send_response({"code": 0, "data": {}}, client_id, request_id) -- Gitblit v1.8.0