From ad615df734b4d82f9a83a7d1805ac9fabdf01a53 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期四, 21 八月 2025 18:27:39 +0800
Subject: [PATCH] 200元股价以下的不足4手算4手/撤单率设置为100%不计算L后后半段撤单

---
 api/outside_api_command_callback.py |   74 +++++++++++++++++++++++++++++-------
 1 files changed, 59 insertions(+), 15 deletions(-)

diff --git a/api/outside_api_command_callback.py b/api/outside_api_command_callback.py
index 60bdf01..6c1a734 100644
--- a/api/outside_api_command_callback.py
+++ b/api/outside_api_command_callback.py
@@ -20,7 +20,7 @@
 from code_attribute.code_data_util import ZYLTGBUtil
 from code_attribute.code_l1_data_manager import L1DataManager
 from code_attribute.gpcode_manager import CodePrePriceManager, CodesNameManager, WantBuyCodesManager, \
-    HumanRemoveForbiddenManager, HumanForbiddenManager
+    HumanRemoveForbiddenManager, HumanForbiddenManager, CodesContinueBuyMoneyManager
 from db import mysql_data_delegate as mysql_data, redis_manager_delegate as redis_manager
 from db.redis_manager_delegate import RedisUtils
 from huaxin_client import l1_subscript_codes_manager
@@ -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, CodesContinueBuyMoneyManager, \
+from trade.trade_manager import TradeTargetCodeModeManager, AutoCancelSellModeManager, \
     CodesTradeStateManager
 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
@@ -320,11 +320,11 @@
             elif code_list_type == outside_api_command_manager.CODE_LIST_BLACK:
                 if operate == outside_api_command_manager.OPERRATE_SET:
                     # 鍏堟墜鍔ㄦ挙鍗�
-                    try:
-                        l2_data_manager_new.L2TradeDataProcessor.cancel_buy(code, "鎵嬪姩鎷夐粦",
-                                                                            cancel_type=trade_constant.CANCEL_TYPE_HUMAN)
-                    except Exception as e:
-                        logger_debug.exception(e)
+                    # try:
+                    #     l2_data_manager_new.L2TradeDataProcessor.cancel_buy(code, "鎵嬪姩鎷夐粦",
+                    #                                                         cancel_type=trade_constant.CANCEL_TYPE_HUMAN)
+                    # except Exception as e:
+                    #     logger_debug.exception(e)
                     l2_trade_util.forbidden_trade(code, msg="鎵嬪姩鍔犲叆 trade_server", force=True)
                     WantBuyCodesManager().remove_code(code)
                     HumanRemoveForbiddenManager().remove_code(code)
@@ -806,7 +806,7 @@
             current_price = L1DataManager.get_l1_current_price(code)
             if current_price:
                 fdata["cost_price"] = current_price
-                pre_close_price = CodePrePriceManager.get_price_pre_cache(code)
+                pre_close_price = CodePrePriceManager().get_price_pre_cache(code)
                 if current_price and pre_close_price:
                     rate = round((float(current_price) - float(pre_close_price)) / float(pre_close_price), 4)
                     fdata["cost_price_rate"] = rate
@@ -1032,7 +1032,7 @@
                         except Exception as e:
                             logger_debug.exception(e)
 
-                result = {"code": 0, "data": {"account_available_money": account_available_money, "delegates": fdatas}}
+                result = {"code": 0, "data": {"account_available_money": account_available_money, "delegates": fdatas, "rate_of_increase_step": constant.L_DOWN_RATE_INCREASE_STEP}}
                 self.send_response(result, client_id, request_id)
             elif ctype == "get_delegated_buy_code_infos_v2":
                 account_available_money = trade_data_manager.AccountMoneyManager().get_available_money_cache()
@@ -1126,6 +1126,11 @@
                             l_down_cancel_rate, must_buy, cancel_rate_info = LCancelRateManager.get_cancel_rate(code,
                                                                                                                 buy_mode=OrderBeginPosInfo.MODE_RADICAL)
 
+                            # 璁$畻澶у崟鎴愪氦
+                            # (缂哄皯鐨勮祫閲�, 鍑�鎴愪氦閲戦, 瑕佹眰鐨勫ぇ鍗曢噾棰�, 璁$畻寰楀埌鐨勫ぇ鍗曢槇鍊奸噾棰�, 浜轰负璁剧疆鐨勫ぇ鍗�)
+                            deal_big_money_info = radical_buy_data_manager.get_total_deal_big_order_info(
+                                code, gpcode_manager.get_limit_up_price_as_num(code))
+
                             fdata = {"id": orderSysID, "code_info": (code, code_name),
                                      "buy1_money": output_util.money_desc(buy1_money),
                                      "left_count": total_left_count,
@@ -1137,8 +1142,11 @@
                                      "block": '',
                                      "trade_queue": [],
                                      "l_down_cancel_rate": l_down_cancel_rate,
-                                     "l_down_cancel_rate_info": cancel_rate_info,
+                                     "l_down_cancel_rate_info": cancel_rate_info
                                      }
+                            if deal_big_money_info:
+                                fdata["deal_big_money_info"] = deal_big_money_info
+
                             limit_up_data = kpl_data_manager.KPLLimitUpDataRecordManager.record_code_dict.get(code)
                             # 鑾峰彇褰撳墠鏉垮潡
                             try:
@@ -1430,7 +1438,9 @@
                                     "special_codes_max_block_in_rank": constant.RADICAL_BUY_TOP_IN_INDEX_WITH_SPECIAL,
                                     "ignore_block_in_money_market_strong": constant.IGNORE_BLOCK_IN_MONEY_MARKET_STRONG,
                                     "buy_first_limit_up": 1 if constant.CAN_BUY_FIRST_LIMIT_UP else 0,
-                                    "can_auto_add_white": 1 if constant.CAN_AUTO_ADD_WHITE else 0
+                                    "can_auto_add_white": 1 if constant.CAN_AUTO_ADD_WHITE else 0,
+                                    "can_auto_add_want_buy_codes": 1 if constant.CAN_AUTO_ADD_WANT_BUY_CODES else 0,
+                                    "can_auto_l_down_rate_change": 1 if constant.CAN_AUTO_L_DOWN_RATE_CHANGE else 0
                                     }}
                 self.send_response({"code": 0, "data": data, "msg": f""},
                                    client_id,
@@ -1457,6 +1467,15 @@
                     if radical_buy.get('can_auto_add_white') is not None:
                         constant.CAN_AUTO_ADD_WHITE = True if radical_buy.get(
                             'can_auto_add_white') else False
+                    if radical_buy.get('can_auto_add_want_buy_codes') is not None:
+                        constant.CAN_AUTO_ADD_WANT_BUY_CODES = True if radical_buy.get(
+                            'can_auto_add_want_buy_codes') else False
+
+                    if radical_buy.get('can_auto_l_down_rate_change') is not None:
+                        constant.CAN_AUTO_L_DOWN_RATE_CHANGE = True if radical_buy.get(
+                            'can_auto_l_down_rate_change') else False
+
+
 
                 self.send_response({"code": 0, "data": {}, "msg": f""},
                                    client_id,
@@ -1556,14 +1575,22 @@
                                        request_id)
                     return
                 rate = round(rate, 2)
-                old_rate = LCancelRateManager().get_cancel_rate(0)[0]
+                old_rate = LCancelRateManager().get_cancel_rate(code)[0]
                 CancelRateHumanSettingManager().set_l_down(code, rate)
                 # L鍚庨噸鏂板泭鎷�
                 # if rate < old_rate:
-                    # 鏀瑰皬鎵嶈兘閲嶆柊鍥婃嫭
+                # 鏀瑰皬鎵嶈兘閲嶆柊鍥婃嫭
                 trade_record_log_util.add_common_msg(code, "L鍚庨噸鏂板泭鎷�", msg=f"淇敼鎾ゅ崟姣斾緥: {old_rate}->{rate}")
-                LCancelBigNumComputer().re_compute_l_down_watch_indexes(code, is_force=True)
+                LCancelBigNumComputer().re_compute_l_down_watch_indexes(code, is_force=True, is_human=True)
 
+                self.send_response({"code": 0, "data": {}},
+                                   client_id,
+                                   request_id)
+            elif ctype == "remove_l_down_rate":
+                # 鍒犻櫎L鍚庢挙鍗曟瘮渚�
+                code = data.get("code")
+                CancelRateHumanSettingManager().remove_l_down(code)
+                trade_record_log_util.add_common_msg(code, "鍒犻櫎L鍚庨璁炬瘮渚�")
                 self.send_response({"code": 0, "data": {}},
                                    client_id,
                                    request_id)
@@ -1599,7 +1626,24 @@
                 self.send_response({"code": 0, "data": {}},
                                    client_id,
                                    request_id)
-
+            elif ctype == "set_code_today_ex_rights":
+                # 浠g爜浠婃棩闄ゆ潈锛岄渶瑕佹洿鏂癒绾�
+                code = data.get("code")
+                volumes_data = history_k_data_manager.update_history_k_bars_of_code(code, force=True, juejin=True)
+                if not volumes_data:
+                    result = {"code": 1, "msg": "鎷夊彇K绾垮け璐�"}
+                else:
+                    # 鏇存柊鏄ㄦ棩鏀剁洏浠锋暟鎹�
+                    CodePrePriceManager().set_price_pre(code, volumes_data[0]['close'], force=True)
+                    gpcode_manager.clear_limit_up_price_cache(code)
+                    limit_up_price = gpcode_manager.get_limit_up_price_as_num(code)
+                    # 鏇存柊K绾跨壒寰佹暟鎹�
+                    k_format = code_nature_analyse.get_k_format(code, limit_up_price, volumes_data)
+                    code_nature_analyse.CodeNatureRecordManager().save_k_format(code, k_format)
+                    result = {"code": 0, "msg": "璁剧疆鎴愬姛"}
+                self.send_response(result,
+                                   client_id,
+                                   request_id)
         except Exception as e:
             logging.exception(e)
             logger_debug.exception(e)

--
Gitblit v1.8.0