Administrator
2024-04-15 a20fbda0343efeab3f477ba0d5596f4e9b867c66
新版深证下单完善
1个文件已修改
31 ■■■■ 已修改文件
l2/l2_data_manager_new.py 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py
@@ -1239,6 +1239,7 @@
    @classmethod
    def __cancel_buy(cls, code):
        with cls.__buy_lock_dict[code]:
        try:
            l2_log.debug(code, "开始执行撤单")
            trade_manager.start_cancel_buy(code)
@@ -1466,7 +1467,8 @@
        # 买入纯买额统计
        new_buy_exec_index, buy_nums, buy_count, rebegin_buy_pos, max_num_set_new, not_buy_msg = None, None, None, None, [], ""
        if order_begin_pos.mode == OrderBeginPosInfo.MODE_ACTIVE:
            threshold_money = order_begin_pos.threshold_money
            # 设置为总卖额
            threshold_money = order_begin_pos.sell_info[0]
            new_buy_exec_index, buy_nums, buy_count, rebegin_buy_pos, threshold_money_new, max_num_set_new, not_buy_msg = cls.__sum_buy_num_for_order_active(
                code,
                start_process_index,
@@ -1689,6 +1691,24 @@
        start_time_str = total_datas[start_index]["val"]["time"]
        # 获取最近的总卖信息
        refer_sell_data = cls.__L2MarketSellManager.get_refer_sell_data(code, start_time_str)
        if code.find("60") == 0:
            if refer_sell_data is None:
                # 设置默认卖信息
                refer_sell_data = (start_time_str, 0, 0, (round(float(total_datas[start_index]["val"]["price"]), 2), 0))
            # 上证:只要有一个涨停买的就是信号
            for i in range(start_index, end_index + 1):
                _val = total_datas[i]["val"]
                if not L2DataUtil.is_limit_up_price_buy(_val):
                    continue
                # 时间要>=09:30:00
                if tool.trade_time_sub(_val["time"], "09:30:00") < 0:
                    continue
                # 金额要大于50万
                if _val["num"] * float(_val["price"]) < 5000:
                    continue
                return True, i, [refer_sell_data[0], 0]
        else:
            # 深证
        if refer_sell_data is None and start_time_str != '09:30:00':
            return False, -1, "总卖为空"
        if refer_sell_data is None:
@@ -1737,10 +1757,12 @@
                    # 金额要大于50万
                    if _val["num"] * float(_val["price"]) < 5000:
                        continue
                    if last_index is None or (total_datas[last_index]["val"]["time"] == total_datas[i]["val"]["time"]):
                        if last_index is None or (
                                total_datas[last_index]["val"]["time"] == total_datas[i]["val"]["time"]):
                        if code.find("00") == 0 and threshold_money > 0:
                            # 深证非板上放量需要判断是否有信号
                            single = place_order_single_data_manager.L2TradeSingleDataManager.get_valid_trade_single(code,
                                single = place_order_single_data_manager.L2TradeSingleDataManager.get_valid_trade_single(
                                    code,
                                                                                                                     tool.to_time_with_ms(
                                                                                                                         _val['time'],
                                                                                                                         _val['tms']))
@@ -1764,8 +1786,6 @@
                    count = 0
                    start = None
            return False, -1, "未获取到激进买的起始信号"
        else:
            return False, -1, "不可激进买"
    @classmethod
    def __get_threshmoney(cls, code):
@@ -2141,6 +2161,7 @@
        if code.find("00") == 0 and threshold_money > 0:
            # 深证非板上放量
            max_space_time_ms = 1 * 1000
        # 不看纯买额
            threshold_num = 0
        # 不下单的信息