Administrator
2024-05-15 283c3566f86f1c3d808290b0797b2f57b690d975
W撤/L后囊括规则修改
1个文件已修改
25 ■■■■■ 已修改文件
l2/cancel_buy_strategy.py 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/cancel_buy_strategy.py
@@ -23,7 +23,7 @@
from utils import tool
from l2.transaction_progress import TradeBuyQueue
from trade import trade_queue_manager, l2_trade_factor, trade_record_log_util, trade_manager
from trade import trade_queue_manager, l2_trade_factor, trade_record_log_util, trade_manager, trade_data_manager
from l2 import l2_log, l2_data_source_util
from l2.l2_data_util import L2DataUtil, local_today_num_operate_map, local_today_datas, local_today_buyno_map, \
    local_today_canceled_buyno_map
@@ -121,10 +121,9 @@
                                                                                                     canceled_buyno_map)
            if left_count > 0:
                total_count += 1
                if total_count>=max_count:
                if total_count >= max_count:
                    return i
        return end_index
class SCancelBigNumComputer:
@@ -2069,13 +2068,18 @@
                # 实际下单位后方所有涨停纯买额≤1000万或没有任何大单(≥299万)
                return True, f"P撤:封单纯买额-{round(left_money / 100, 1)}万 大单数量-{total_big_num_count} 下单位-{real_order_index} 成交位-{real_trade_index}"
        return False, "不满足撤单条件"
    # w撤
    def need_cancel_for_w(self,code):
    def need_cancel_for_w(self, code):
        real_order_index_info = self.__get_real_order_index_cache(code)
        if not real_order_index_info:
            return False, "没找到真实下单位"
        if real_order_index_info[1]:
            return False, "真实下单位为默认"
        place_order_count = trade_data_manager.PlaceOrderCountManager().get_place_order_count(code)
        if place_order_count>1:
            return False, "不是初次下单"
        trade_index, is_default = TradeBuyQueue().get_traded_index(code)
        if trade_index is None:
            return False, "没获取到成交进度位"
@@ -2084,15 +2088,18 @@
        total_datas = local_today_datas.get(code)
        if tool.trade_time_sub(total_datas[-1]['val']['time'], total_datas[real_order_index]['val']['time']) > 60:
            return False, "超过守护时间"
        limit_up_price = round(float(gpcode_manager.get_limit_up_price(code)) , 2)
        end_index = L2DataComputeUtil.compute_end_index(code, real_order_index+1, total_datas[-1]["index"],limit_up_price, 10)
        limit_up_price = round(float(gpcode_manager.get_limit_up_price(code)), 2)
        end_index = L2DataComputeUtil.compute_end_index(code, real_order_index + 1, total_datas[-1]["index"],
                                                        limit_up_price, 10)
        # 从成交进度位到截至位置计算大单
        min_money =  l2_data_util.get_big_money_val(limit_up_price)
        left_count, left_money = L2DataComputeUtil.compute_left_buy_order(code,trade_index,end_index,limit_up_price,min_money=min_money)
        min_money = l2_data_util.get_big_money_val(limit_up_price)
        left_count, left_money = L2DataComputeUtil.compute_left_buy_order(code, trade_index, end_index, limit_up_price,
                                                                          min_money=min_money)
        if left_count < 1:
            return True, f"大单数量:{left_count}"
            return True, f"范围:{real_order_index}-{end_index}  大单数量:{left_count}"
        return False, "大单数量够"
# ---------------------------------G撤-------------------------------
class GCancelBigNumComputer:
    __real_place_order_index_dict = {}