Administrator
2023-03-23 96dc1a4cc38b588f39387b5a85b9677100e357f1
l2/l2_data_manager_new.py
@@ -229,14 +229,13 @@
            # 计算量
            volume_rate = code_volumn_manager.get_volume_rate(code)
            volume_rate_index = code_volumn_manager.get_volume_rate_index(volume_rate)
            l2_log.debug(code,"量比:{},量索引:{}",volume_rate,volume_rate_index)
            cls.volume_rate_info[code] = (volume_rate, volume_rate_index)
            # 是否为首板代码
            is_first_code = gpcode_manager.FirstCodeManager.is_in_first_record(code)
            latest_time = add_datas[len(add_datas) - 1]["val"]["time"]
            # 时间差不能太大才能处理
            if l2.l2_data_util.L2DataUtil.is_same_time(now_time_str,
                                                       latest_time) and not l2_trade_util.is_in_forbidden_trade_codes(
                code):
            if not l2_trade_util.is_in_forbidden_trade_codes(code):
                # 判断是否已经挂单
                state = trade_manager.get_trade_state(code)
                start_index = len(total_datas) - len(add_datas)
@@ -245,8 +244,9 @@
                    # 已挂单
                    cls.__process_order(code, start_index, end_index, capture_timestamp, is_first_code)
                else:
                    # 未挂单
                    cls.__process_not_order(code, start_index, end_index, capture_timestamp, is_first_code)
                    # 未挂单,时间相差不大才能挂单
                    if 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)
            logger_l2_process.info("code:{} 处理数据范围: {}-{} 处理时间:{} 截图时间戳:{}", code, add_datas[0]["index"],
                                   add_datas[-1]["index"], round(t.time() * 1000) - __start_time,
@@ -321,8 +321,7 @@
                b_need_cancel, b_cancel_data = SecondCancelBigNumComputer.need_cancel(code, buy_single_index,
                                                                                      buy_exec_index, start_index,
                                                                                      end_index, total_data,
                                                                                      code_volumn_manager.get_volume_rate_index(
                                                                                          buy_volume_rate),
                                                                                      code_volumn_manager.get_volume_rate_index(buy_volume_rate),
                                                                                      cls.volume_rate_info[code][1],
                                                                                      is_first_code)
                if b_need_cancel:
@@ -566,9 +565,11 @@
                logging.exception(e)
            # 量比超过1.3的不能买
            volumn_rate = l2_trade_factor.L2TradeFactorUtil.get_volumn_rate_by_code(code)
            if volumn_rate >= 1.3:
            volumn_rate = cls.volume_rate_info[code][0]
            if not is_first_code and volumn_rate >= 1.3:
                return False, False, "最大量比超过1.3不能买"
            elif is_first_code and volumn_rate >= 1.1:
                return False, False, "首板最大量比超过1.1不能买"
            limit_up_time = limit_up_time_manager.get_limit_up_time(code)
            if limit_up_time is not None: