Administrator
2024-04-10 9a8a924d75fd4e29c4c14c86c041c00ba89f615a
l2/l2_data_manager_new.py
@@ -458,8 +458,9 @@
                    cls.__process_order(code, start_index, end_index, capture_timestamp, is_first_code)
                else:
                    # 未挂单,时间相差不大才能挂单
                    # if tool.trade_time_sub(latest_time, "09:32:00") < 0 or l2.l2_data_util.L2DataUtil.is_same_time(now_time_str, latest_time):
                    cls.__process_not_order(code, start_index, end_index, capture_timestamp, is_first_code)
                    if tool.trade_time_sub(latest_time, "09:32:00") < 0 or l2.l2_data_util.L2DataUtil.is_same_time(
                            now_time_str, latest_time):
                        cls.__process_not_order(code, start_index, end_index, capture_timestamp, is_first_code)
            l2_log.info(code, logger_l2_process, "code:{} 处理数据范围: {}-{} 处理时间:{} 线程ID:{}", code,
                        add_datas[0]["index"],
                        add_datas[-1]["index"], round(t.time() * 1000) - __start_time,
@@ -1305,6 +1306,9 @@
            # ------------------------------确定信号种类----------------------------------
            # 第一步:获取激进下单信号
            continue_count = cls.__l2PlaceOrderParamsManagerDict[code].get_begin_continue_buy_count()
            # if code.find('60') == 0:
            # 激进买
            continue_count = 1
            has_single, _index, sell_info = cls.__compute_active_order_begin_pos(code, continue_count, max(
                (compute_start_index - continue_count - 1) if new_add else compute_start_index, 0), compute_end_index)
            fast_msg = None
@@ -1651,18 +1655,22 @@
            # 有可买板块,有激进买板块
            # 第一步: 计算总卖额
            threshold_money, sell_1_price = refer_sell_data[1], refer_sell_data[3][0]
            for i in range(start_index - 1, -1, -1):
                val = total_datas[i]["val"]
                if tool.compare_time(val["time"], refer_sell_data[0]) <= 0:
                    break
                if L2DataUtil.is_sell(val):
                    threshold_money += val["num"] * int(float(val["price"]) * 100)
                elif L2DataUtil.is_sell_cancel(val):
                    threshold_money -= val["num"] * int(float(val["price"]) * 100)
                elif L2DataUtil.is_buy(val):
                    # 判断价格(大于卖1) 被买吃掉
                    if round(float(val["price"]), 2) - sell_1_price >= 0:
            if code.find("60") == 0:
                threshold_money = 0
            else:
                for i in range(start_index - 1, -1, -1):
                    val = total_datas[i]["val"]
                    if tool.compare_time(val["time"], refer_sell_data[0]) < 0:
                        # 将本s的计算上去
                        break
                    if L2DataUtil.is_sell(val):
                        threshold_money += val["num"] * int(float(val["price"]) * 100)
                    elif L2DataUtil.is_sell_cancel(val):
                        threshold_money -= val["num"] * int(float(val["price"]) * 100)
                    elif L2DataUtil.is_buy(val):
                        # 判断价格(大于卖1) 被买吃掉
                        if round(float(val["price"]), 2) - sell_1_price >= 0:
                            threshold_money -= val["num"] * int(float(val["price"]) * 100)
            # 第二步:计算起始信号
            second_930 = 9 * 3600 + 30 * 60 + 0
            total_datas = local_today_datas.get(code)