Administrator
2024-06-25 d32408fbada1ecf354f5d6a086bdfb8a974a8e59
30大单处理
8个文件已修改
86 ■■■■■ 已修改文件
cancel_strategy/s_l_h_cancel_strategy.py 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/cancel_buy_strategy.py 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_transaction_data_manager.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2_data_util.py 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
msg/buy_order_msg_manager.py 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_server.py 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/tool.py 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cancel_strategy/s_l_h_cancel_strategy.py
@@ -1002,6 +1002,7 @@
        """
        watch_indexes = set()
        total_datas = local_today_datas.get(code)
        is_ge_code = tool.is_ge_code(code)
        try:
            # 真实下单位置后面的数据就只看大单
            MIN_NUM = int(5000 / (float(gpcode_manager.get_limit_up_price(code))))
@@ -1027,7 +1028,7 @@
                            code))
                    if left_count > 0:
                        after_count += 1
                        if l2_data_util.is_big_money(val):
                        if l2_data_util.is_big_money(val,is_ge_code):
                            watch_indexes.add(i)
                            # 记录索引的位置
                            self.__set_cancel_l_down_after_place_order_index(code, i, after_count - 1)
@@ -1200,6 +1201,7 @@
            return
        # 重新囊括1笔
        real_place_order_info = self.__real_place_order_index_dict.get(code)
        is_ge_code = tool.is_ge_code(code)
        if real_place_order_info and real_place_order_info[0] > index:
            total_datas = local_today_datas.get(code)
            min_num = int(5000 / (float(gpcode_manager.get_limit_up_price(code))))
@@ -1241,7 +1243,7 @@
                                                                                                                 code))
                    if left_count > 0:
                        left_count_after += 1
                        if l2_data_util.is_big_money(val) and j not in watch_indexes:
                        if l2_data_util.is_big_money(val, is_ge_code) and j not in watch_indexes:
                            watch_indexes.add(j)
                            self.__set_cancel_l_down_after_place_order_index(code, j, left_count_after - 1)
                            break
l2/cancel_buy_strategy.py
@@ -480,7 +480,8 @@
        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)
        min_money = l2_data_util.get_big_money_val(limit_up_price, tool.is_ge_code(code))
        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:
l2/l2_data_manager_new.py
@@ -1066,7 +1066,7 @@
                        trade_index = 0
                    limit_up_price = round(float(gpcode_manager.get_limit_up_price(code)), 2)
                    # 从成交进度位到截至位置计算大单
                    min_money = l2_data_util.get_big_money_val(limit_up_price)
                    min_money = l2_data_util.get_big_money_val(limit_up_price, tool.is_ge_code(code))
                    left_count, left_money = cancel_buy_strategy.L2DataComputeUtil.compute_left_buy_order(code,
                                                                                                          trade_index,
                                                                                                          total_data[
@@ -1967,6 +1967,7 @@
        bigger_num = round(5000 / limit_up_price)
        not_buy_msg = ""
        is_ge_code = tool.is_ge_code(code)
        for i in range(compute_start_index, compute_end_index + 1):
            data = total_datas[i]
            _val = total_datas[i]["val"]
@@ -1984,7 +1985,7 @@
                            return None, buy_nums, buy_count, ii, max_buy_num_set, f"【{i}】信号不连续,囊括时间-{max_space_time_ms}ms"
            # 涨停买
            if L2DataUtil.is_limit_up_price_buy(_val):
                if l2_data_util.is_big_money(_val):
                if l2_data_util.is_big_money(_val,is_ge_code):
                    max_buy_num_set.add(i)
                if _val["num"] >= bigger_num:
                    trigger_buy = True
@@ -2095,6 +2096,7 @@
        place_order_count = trade_data_manager.PlaceOrderCountManager().get_place_order_count(code)
        if place_order_count is None:
            place_order_count = 0
        is_ge_code = tool.is_ge_code(code)
        for i in range(compute_start_index, compute_end_index + 1):
            data = total_datas[i]
            _val = total_datas[i]["val"]
@@ -2118,7 +2120,7 @@
                threshold_num = round(threshold_money / (limit_up_price * 100))
            # 涨停买
            elif L2DataUtil.is_limit_up_price_buy(_val):
                if l2_data_util.is_big_money(_val):
                if l2_data_util.is_big_money(_val, is_ge_code):
                    max_buy_num_set.add(i)
                trigger_buy = True
                # 只统计59万以上的金额
@@ -2233,6 +2235,7 @@
        not_buy_msg = ""
        max_buy_num_set = set(max_num_set)
        active_buy_blocks = cls.get_active_buy_blocks(code)
        is_ge_code = tool.is_ge_code(code)
        for i in range(compute_start_index, compute_end_index + 1):
            data = total_datas[i]
            _val = total_datas[i]["val"]
@@ -2259,7 +2262,7 @@
            elif L2DataUtil.is_limit_up_price_buy(_val):
                if _val['num'] < bigger_threshold_num:
                    continue
                if l2_data_util.is_big_money(_val):
                if l2_data_util.is_big_money(_val, is_ge_code):
                    max_buy_num_set.add(i)
                trigger_buy = True
                # 只统计59万以上的金额
l2/l2_transaction_data_manager.py
@@ -175,7 +175,7 @@
        big_buy_datas = []
        normal_buy_datas = []
        # 大单阈值
        threshold_big_money = l2_data_util.get_big_money_val(limit_up_price)
        threshold_big_money = l2_data_util.get_big_money_val(limit_up_price, tool.is_ge_code(code))
        for data in datas:
            # q.append((data['SecurityID'], data['TradePrice'], data['TradeVolume'],
            #                   data['OrderTime'], data['MainSeq'], data['SubSeq'], data['BuyNo'],
l2_data_util.py
@@ -28,30 +28,44 @@
# 是否为大单
def is_big_money(val):
def is_big_money(val, is_ge=False):
    """
    判断是否为大单
    @param val: l2数据
    @param is_ge: 是否为创业板
    @return:
    """
    price = float(val["price"])
    money = price * val["num"]
    if price > 3.0:
        if money >= 29900 or val["num"] >= 7999:
    if is_ge:
        if money >= 29900 or val["num"] >= 2999:
            return True
        else:
            return False
    else:
        max_money = price * 10000
        if money >= max_money * 0.95:
            return True
        if price > 3.0:
            if money >= 29900 or val["num"] >= 7999:
                return True
            else:
                return False
        else:
            return False
            max_money = price * 10000
            if money >= max_money * 0.95:
                return True
            else:
                return False
# 获取大资金的金额
def get_big_money_val(limit_up_price):
    if limit_up_price > 3.0:
        return min(299 * 10000, round(limit_up_price * 7999 * 100))
def get_big_money_val(limit_up_price, is_ge=False):
    if is_ge:
        return min(299 * 10000, round(limit_up_price * 2999 * 100))
    else:
        max_money = limit_up_price * 10000 * 100
        return int(max_money * 0.95)
        if limit_up_price > 3.0:
            return min(299 * 10000, round(limit_up_price * 7999 * 100))
        else:
            max_money = limit_up_price * 10000 * 100
            return int(max_money * 0.95)
# if int(val["num"]) >= constant.BIG_MONEY_NUM:
#     return True
msg/buy_order_msg_manager.py
@@ -59,6 +59,7 @@
    real_place_order_after_count = 0
    real_place_order_after_money = 0
    is_ge_code = tool.is_ge_code(code)
    # 统计真实下单位置后面未撤的金额
    for i in range(real_order_index, total_datas[-1]["index"]):
@@ -66,7 +67,7 @@
        if not L2DataUtil.is_limit_up_price_buy(val):
            continue
        # 是不是大单
        if not l2_data_util.is_big_money(val):
        if not l2_data_util.is_big_money(val, is_ge_code):
            continue
        canceled_data = l2.l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2(code,
trade/huaxin/huaxin_trade_server.py
@@ -1457,13 +1457,13 @@
                            # 获取已经成交的大单数量
                            total_big_num = 0
                            total_big_count = 0
                            is_ge_code = tool.is_ge_code(code)
                            for i in range(0, trade_index):
                                val = total_datas[i]["val"]
                                if not L2DataUtil.is_limit_up_price_buy(val):
                                    continue
                                # 是不是大单
                                if not l2_data_util_old.is_big_money(val):
                                if not l2_data_util_old.is_big_money(val, is_ge_code):
                                    continue
                                canceled_data = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2(
@@ -1482,12 +1482,13 @@
                            not_deal_total_big_count_pre = 0
                            not_deal_total_big_num_after = 0
                            not_deal_total_big_count_after = 0
                            is_ge_code = tool.is_ge_code(code)
                            for i in range(trade_index, total_datas[-1]["index"] + 1):
                                val = total_datas[i]["val"]
                                if not L2DataUtil.is_limit_up_price_buy(val):
                                    continue
                                # 是不是大单
                                if not l2_data_util_old.is_big_money(val):
                                if not l2_data_util_old.is_big_money(val, is_ge_code):
                                    continue
                                canceled_data = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2(
@@ -1514,14 +1515,14 @@
                            real_place_order_after_count = 0
                            real_place_order_after_num = 0
                            is_ge_code = tool.is_ge_code(code)
                            # 统计真实下单位置后面未撤的金额
                            for i in range(place_order_index, total_datas[-1]["index"]):
                                val = total_datas[i]["val"]
                                if not L2DataUtil.is_limit_up_price_buy(val):
                                    continue
                                # 是不是大单
                                if not l2_data_util_old.is_big_money(val):
                                if not l2_data_util_old.is_big_money(val, is_ge_code):
                                    continue
                                canceled_data = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2(
@@ -1723,7 +1724,7 @@
                # 获取大单成交列表
                code = data["code"]
                data_list = BigOrderDealManager().get_total_buy_money_list(code)
                bigger_money = l2_data_util_old.get_big_money_val(float(gpcode_manager.get_limit_up_price(code)))
                bigger_money = l2_data_util_old.get_big_money_val(float(gpcode_manager.get_limit_up_price(code)), tool.is_ge_code(code))
                fdatas = []
                for d in data_list:
                    if d < bigger_money:
utils/tool.py
@@ -405,6 +405,14 @@
    """
    return get_market_type(code) == MARKET_TYPE_SZSE
def is_ge_code(code):
    """
    是否是创业板
    @param code:
    @return:
    """
    return code.find("30")==0
if __name__ == "__main__":
    print(is_sz_code("0000"))