Administrator
2025-02-11 d1bad2d58461e524b5707871a61a4ea0a9502ce6
扫入下单策略修改
3个文件已修改
40 ■■■■ 已修改文件
code_attribute/code_volumn_manager.py 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/buy_radical/radical_buy_data_manager.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/buy_radical/radical_buy_strategy.py 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
code_attribute/code_volumn_manager.py
@@ -7,7 +7,7 @@
# yesterday 昨天的量
import json
from code_attribute import gpcode_manager
from code_attribute import gpcode_manager, code_nature_analyse
from db.redis_manager_delegate import RedisUtils
from log_module import async_log_util
from utils import global_util, tool
@@ -93,12 +93,15 @@
        @param limit_up_price:
        @return:
        """
        # 60个交易日未涨停取
        k_format = code_nature_analyse.CodeNatureRecordManager().get_k_format_cache(code)
        has_limit_up_in_60 = True
        if k_format and not k_format[13]:
            has_limit_up_in_60 = False
        volume = self.get_max_volume_in_5days(code)
        if volume * limit_up_price >= 3.14e8:
        if volume * limit_up_price >= 3.14e8 and has_limit_up_in_60:
            return volume
        return int(self.get_reference_volume_as_money_y(code)*1e8/limit_up_price)
        return int(self.get_reference_volume_as_money_y(code) * 1e8 / limit_up_price)
    def get_volume_rate_refer_in_5days(self, code, total_sell_volume=0):
        """
trade/buy_radical/radical_buy_data_manager.py
@@ -1608,9 +1608,9 @@
        # 要下单的且不是创业版的目标代码大单数量打8折
        if is_first_limit_up_buy(code):
            # 首封不打折
            total_lack_money = int(total_threshold_money - total_deal_money)
            total_lack_money = int(total_threshold_money*0.8 - total_deal_money)
        else:
            total_lack_money = int(total_threshold_money * 0.8 - total_deal_money)
            total_lack_money = int(total_threshold_money - total_deal_money)
        if total_lack_money < 0:
            total_lack_money = 0
    if current_lack_money == 0 and total_lack_money == 0:
trade/buy_radical/radical_buy_strategy.py
@@ -71,7 +71,7 @@
def process_limit_up_active_buy_deal(code, transaction_datas, is_almost_open_limit_up=False):
    """
    涨停主动买成交
    计算抛压消耗之后是否能下单
    @param code:
    @param transaction_datas:   # ((data['SecurityID'], data['TradePrice'], data['TradeVolume'],
        #           data['OrderTime'], data['MainSeq'], data['SubSeq'], data['BuyNo'],
@@ -155,19 +155,32 @@
    # 剩余涨停卖金额
    left_limit_up_sell_money = selling_num * price
    # 如果剩余总卖小于100w直接根据L2买入
    if left_limit_up_sell_money < 100e4:
        return BUY_MODE_BY_L2, f"剩余总卖小于100w({left_limit_up_sell_money})"
    # 每次上板的大单与金额
    big_order_count = radical_buy_data_manager.EveryLimitupBigDealOrderManager().get_big_buy_deal_order_count(code)
    big_order_money = radical_buy_data_manager.EveryLimitupBigDealOrderManager().get_big_buy_deal_order_money(code)
    if big_order_count >= 2:
        average_big_order_money = int(big_order_money / big_order_count)
        if average_big_order_money > left_limit_up_sell_money:
            # 剩余总卖小于均大单才能下单
            return BUY_MODE_DIRECT, f"剩余涨停总卖额-{left_limit_up_sell_money},均大单-{average_big_order_money}"
            # 如果是深证且卖一大于5000w可不判断大单是否满足
            if tool.is_sz_code(code) and refer_sell_money >= 5e7:
                return BUY_MODE_DIRECT, f"剩余涨停总卖额-{left_limit_up_sell_money},均大单-{average_big_order_money}, 总抛压大({refer_sell_money})"
            else:
                # 判断大单是否满足
                total_lack_money_info = radical_buy_data_manager.get_total_deal_big_order_info(code,
                                                                                               gpcode_manager.get_limit_up_price_as_num(
                                                                                                   code),
                                                                                               is_for_buy=True)
                if total_lack_money_info[0] <= 0:
                    return BUY_MODE_DIRECT, f"剩余涨停总卖额-{left_limit_up_sell_money},均大单-{average_big_order_money}, 大单足够"
    else:
        average_big_order_money = 0
        # 如果剩余总卖小于100w直接根据L2买入
    if left_limit_up_sell_money < 100e4:
        return BUY_MODE_BY_L2, f"剩余总卖小于100w({left_limit_up_sell_money})"
    return BUY_MODE_NONE, f"均大单-{average_big_order_money}({big_order_money}/{big_order_count}),剩余涨停卖:{left_limit_up_sell_money}"
    # #总卖 = 涨停主动买成交的累计金额 + 处于委托状态的涨停卖金额
    # total_sell = __deal_active_buy_total_money[code] + left_limit_up_sell_money