Administrator
2024-06-14 1471480f5307d9f75b6e87e246cc14c131fb4639
l2/l2_data_manager_new.py
@@ -954,6 +954,9 @@
    @classmethod
    def __can_buy_first(cls, code):
        if code.find("60") == 0:
            return False, True, f"上证暂不交易"
        if not cls.__TradeStateManager.is_can_buy_cache():
            return False, True, f"今日已禁止交易"
@@ -1064,13 +1067,15 @@
                    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)
                    left_count, left_money = cancel_buy_strategy.L2DataComputeUtil.compute_left_buy_order(code, trade_index, total_data[-1]["index"],
                                                                                      limit_up_price,
                                                                                      min_money=min_money)
                    left_count, left_money = cancel_buy_strategy.L2DataComputeUtil.compute_left_buy_order(code,
                                                                                                          trade_index,
                                                                                                          total_data[
                                                                                                              -1][
                                                                                                              "index"],
                                                                                                          limit_up_price,
                                                                                                          min_money=min_money)
                    if left_count < 1:
                        return False, False, f"没有已挂或者成交的大单"
        # 暂时注释想买单功能
        if not cls.__WantBuyCodesManager.is_in_cache(code):
@@ -1509,7 +1514,8 @@
        threshold_money = threshold_money_new
        order_begin_pos.threshold_money = threshold_money
        l2_log.debug(code, "范围:{}-{} m值-{} 量比:{} rebegin_buy_pos:{} clear_buy_single:{}", compute_start_index, compute_end_index,
        l2_log.debug(code, "范围:{}-{} m值-{} 量比:{} rebegin_buy_pos:{} clear_buy_single:{}", compute_start_index,
                     compute_end_index,
                     threshold_money, cls.volume_rate_info[code][0],
                     rebegin_buy_pos, clear_buy_single)
@@ -1555,13 +1561,14 @@
            # 记录买入信号位置
            if not clear_buy_single:
                # 没有清除信号位置就保存下单位置信息
                cls.__save_order_begin_data(code, OrderBeginPosInfo(buy_single_index=buy_single_index, buy_exec_index=-1,
                                                                    buy_compute_index=compute_end_index, num=buy_nums,
                                                                    count=buy_count,
                                                                    mode_desc=order_begin_pos.mode_desc,
                                                                    max_num_set=max_num_set_new, mode=order_begin_pos.mode,
                                                                    sell_info=order_begin_pos.sell_info,
                                                                    threshold_money=threshold_money))
                cls.__save_order_begin_data(code,
                                            OrderBeginPosInfo(buy_single_index=buy_single_index, buy_exec_index=-1,
                                                              buy_compute_index=compute_end_index, num=buy_nums,
                                                              count=buy_count,
                                                              mode_desc=order_begin_pos.mode_desc,
                                                              max_num_set=max_num_set_new, mode=order_begin_pos.mode,
                                                              sell_info=order_begin_pos.sell_info,
                                                              threshold_money=threshold_money))
                # 记录没下单原因
                async_log_util.info(logger_l2_not_buy_reasons, f"{code}#{not_buy_msg}")
                _start_time = t.time()