Administrator
2024-06-11 306f896df9ad1a51dd30b291284a22c12e16597f
更改板上放量不足规则/L前囊括规则修改
3个文件已修改
47 ■■■■■ 已修改文件
cancel_strategy/s_l_h_cancel_strategy.py 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_transaction_data_manager.py 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cancel_strategy/s_l_h_cancel_strategy.py
@@ -1014,11 +1014,16 @@
                    break
        changed = True
        if code in self.__last_l_up_compute_info:
            if self.__last_l_up_compute_info[code] == watch_indexes:
        __last_l_up_compute_info = self.__last_l_up_compute_info.get(code)
        if __last_l_up_compute_info:
            if __last_l_up_compute_info == watch_indexes:
                changed = False
        # 保存数据
        if changed:
            threshold_time = 1 if tool.is_sz_code(code) else 2
            if  time.time() - __last_l_up_compute_info[0] < threshold_time:
                l2_log.l_cancel_debug(code, f"L前监控更新太频繁:{threshold_time}")
                return
            l2_log.l_cancel_debug(code, f"L前监控范围:{watch_indexes} 计算范围:{start_index}-{end_index}")
            self.__set_near_by_trade_progress_indexes(code, buy_single_index, watch_indexes)
        self.__last_l_up_compute_info[code] = (time.time(), watch_indexes)
l2/l2_data_manager_new.py
@@ -1022,19 +1022,14 @@
                not_limit_up_info = current_price_process_manager.get_trade_not_limit_up_info(code)
                if not not_limit_up_info or tool.trade_time_sub(total_data[-1]['val']['time'],
                                                                not_limit_up_info[1]) > 10:
                    # 非涨停价成交10s后才有可能判断为板上放量
                    sell_data = cls.__L2MarketSellManager.get_current_total_sell_data(code)
                    if sell_data and sell_data[1] <= 0:
                        # 板上放量,判断是否有放量,放量才会下单
                        # 获取最近1s的主动卖金额
                        min_time = total_data[order_begin_pos.buy_single_index]['val']['time']
                        min_time = tool.trade_time_add_second(min_time, -1)
                        sell_orders = HuaXinSellOrderStatisticManager.get_latest_transaction_datas(code,
                                                                                                   min_deal_time=min_time)
                        sell_order_num = sum([x[1] for x in sell_orders])
                        sell_money = int(float(limit_up_price) * sell_order_num)
                        if sell_money < 200000:
                            return False, True, f"板上放量金额不足,近1s总卖:{sell_money}小于20w"
                    # 获取最近2s的成交
                    deal_list = HuaXinSellOrderStatisticManager.get_latest_2s_continue_deal_volumes(code)
                    total_deal_volume = 0
                    if deal_list:
                        total_deal_volume = sum([x[1] for x in deal_list])
                    total_deal_money = int(total_deal_volume * float(limit_up_price))
                    if total_deal_money < 200000:
                        return False, True, f"板上放量成交金额不足,近2s总成交金额:{total_deal_money}小于20w"
            # 判断成交进度是否距离我们的位置很近
            trade_index, is_default = cls.__TradeBuyQueue.get_traded_index(code)
            if False and not is_default and trade_index:
l2/l2_transaction_data_manager.py
@@ -316,6 +316,23 @@
        return fdatas
    @classmethod
    def get_latest_2s_continue_deal_volumes(cls, code):
        """
        获取最近2s的成交量分布
        @param code:
        @return: [(时间,量)]
        """
        deal_list = cls.__deal_volume_list_dict.get(code)
        if not deal_list:
            return 0, None
        fdatas = [deal_list[-1]]
        # 从倒数第二个数据计算
        for i in range(len(deal_list) - 1, -1, -1):
            if tool.trade_time_sub(fdatas[0][0], deal_list[i][0]) < 2:
                fdatas.append(deal_list[i])
        return fdatas
    @classmethod
    def clear_latest_deal_volume(cls, code):
        if code in cls.__deal_volume_list_dict:
            cls.__deal_volume_list_dict.pop(code)