Administrator
2024-02-29 4349e51c0ef43a77e8a1e59723f481a9cfa97c8d
大单规则修改/策略参数微调
5个文件已修改
64 ■■■■■ 已修改文件
l2/cancel_buy_strategy.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/deal_big_money_manager.py 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_server.py 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/l2_trade_factor.py 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/cancel_buy_strategy.py
@@ -1670,7 +1670,7 @@
        # 统计未撤订单的数量与金额
        total_datas = local_today_datas.get(code)
        # 是否是下单5分钟内
        if tool.trade_time_sub(tool.get_now_time_str(), total_datas[real_order_index]['val']['time']) > 5 * 60:
        if tool.trade_time_sub(tool.get_now_time_str(), total_datas[real_order_index]['val']['time']) > 3 * 60:
            return False, "下单超过5分钟"
        total_left_count = 0
l2/l2_data_manager_new.py
@@ -1856,10 +1856,10 @@
                continue
            max_buy_num_set = cls.__filter_not_deal_indexes(code, max_buy_num_set)
            if place_order_count == 0:
                if len(max_buy_num_set) < 1:
                    not_buy_msg = f"【{i}】首次下单无大单"
                    continue
            big_money_count_threshhold = cls.__l2PlaceOrderParamsManagerDict[code].get_big_num_count()
            if len(max_buy_num_set) < big_money_count_threshhold:
                not_buy_msg = f"【{i}】大单不满足要求,需要:{big_money_count_threshhold} 总:{len(max_buy_num_set)}"
                continue
            try:
                info = cls.__trade_log_placr_order_info_dict[code]
trade/deal_big_money_manager.py
@@ -82,11 +82,23 @@
                    total_num += data["val"]["num"] * data["re"]
        return total_num
    def get_deal_ordernos(self, code):
        return self.__deal_orderno_cache.get(code)
# 统计大单总共成交手数
def get_deal_big_money_num(code):
    val = DealOrderNoManager().get_deal_nums(code, l2_data_util.local_today_buyno_map.get(code))
    return val
# 统计大单成交笔数
def get_deal_big_money_count(code):
    ordernos = DealOrderNoManager().get_deal_ordernos(code)
    if ordernos:
        return len(ordernos)
    return 0
if __name__ == "__main__":
    pass
trade/huaxin/huaxin_trade_server.py
@@ -1468,7 +1468,6 @@
                                else:
                                    not_deal_total_big_num_after += val["num"]
                            real_place_order_after_count = 0
                            real_place_order_after_num = 0
@@ -1505,14 +1504,19 @@
                                     "big_num_count": total_big_count,
                                     "big_num_money": output_util.money_desc(
                                         total_big_num * float(limit_up_price) * 100),
                                     "not_deal_big_num_count": (not_deal_total_big_count_pre, not_deal_total_big_count_after),
                                     "not_deal_big_num_count": (
                                      not_deal_total_big_count_pre, not_deal_total_big_count_after),
                                     "not_deal_big_num_money": (output_util.money_desc(
                                         not_deal_total_big_num_pre * float(limit_up_price) * 100),output_util.money_desc(
                                         not_deal_total_big_num_after * float(limit_up_price) * 100)),
                                         not_deal_total_big_num_pre * float(limit_up_price) * 100),
                                                                output_util.money_desc(
                                                                    not_deal_total_big_num_after * float(
                                                                        limit_up_price) * 100)),
                                     "left_count": total_left_count,
                                     "volume_rate": volume_rate,
                                     "left_money": output_util.money_desc(total_left_num * float(limit_up_price) * 100),
                                     "pay_attention": need_pay_attention
                                     "pay_attention": need_pay_attention,
                                     "trade_progress_percent": round(output_util.money_desc(
                                         total_left_num * float(limit_up_price) * 100) * 100 / buy1_money, 2),  # 成交进度比例
                                     }
                            fdatas.append(fdata)
                        except Exception as e:
trade/l2_trade_factor.py
@@ -6,7 +6,7 @@
from code_attribute import big_money_num_manager, limit_up_time_manager, global_data_loader, gpcode_manager
import constant
from trade import trade_manager
from trade import trade_manager, deal_big_money_manager
from utils import global_util, tool
@@ -159,21 +159,17 @@
    # 获取需要的大单个数
    def get_big_num_count(self):
        # if self.is_first_code:
        #     if self.buy_rank < 2:
        #         return 0
        #     elif self.buy_rank == 2:
        #         return 1
        #     elif self.buy_rank == 3:
        #         return 2
        counts = [1, 1, 1, 1, 0, 0, 0, 0]
        volume_rate_index = self.volume_rate_index
        if self.volume_rate_index >= len(counts):
            volume_rate_index = -1
        # 第一次下单必须为2个
        # if self.is_first_place_order(self.code):
        #     return 2
        return counts[volume_rate_index]
        # counts = [1, 1, 1, 1, 0, 0, 0, 0]
        # volume_rate_index = self.volume_rate_index
        # if self.volume_rate_index >= len(counts):
        #     volume_rate_index = -1
        # return counts[volume_rate_index]
        # 有大单成交就不需要大单了,没有大单成交就需要大单
        deal_big_money_count = deal_big_money_manager.get_deal_big_money_count(self.code)
        if deal_big_money_count > 0:
            return 0
        else:
            return 1
    # 获取安全笔数影响比例
    def get_safe_count_rate(self):