Administrator
2023-10-31 5abf971a584cec748e3c691e1a359815d649d2f6
L2卡位减少至30个
4个文件已修改
32 ■■■■■ 已修改文件
constant.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/cancel_buy_strategy.py 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/data_export_util.py 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
constant.py
@@ -132,7 +132,7 @@
# 华鑫L2的卡位数量
HUAXIN_L2_MAX_CODES_COUNT = 50
HUAXIN_L2_MAX_CODES_COUNT = 30
TRADE_WAY_HUAXIN = "huaxin"
TRADE_WAY_JUEJIN = "juejin"
l2/cancel_buy_strategy.py
@@ -16,6 +16,7 @@
from db import redis_manager_delegate as redis_manager
from db.redis_manager_delegate import RedisUtils
from l2.l2_data_manager import OrderBeginPosInfo
from log_module import async_log_util
from utils import tool
from l2.transaction_progress import TradeBuyQueue
from trade import trade_queue_manager, l2_trade_factor, trade_record_log_util
@@ -576,10 +577,12 @@
                self.__compute_watch_index(code, buy_single_index)
        except Exception as e:
            l2_log.h_cancel_debug(code, "设置成交进度位置出错:{}", str(e))
            logger_l2_h_cancel.exception(e)
            async_log_util.exception(logger_l2_h_cancel, e)
    # 设置真实下单位置
    def set_real_place_order_index(self, code, index, buy_single_index):
        if buy_single_index is None:
            return
        try:
            # 计算触发位置
            min_num = int(5000 / (float(gpcode_manager.get_limit_up_price(code))))
@@ -606,6 +609,7 @@
                temp_index = int(temp_count * 9 / 10)
                self.__start_compute_index_dict[code] = not_cancel_indexes[temp_index]
        except Exception as e:
            async_log_util.exception(logger_l2_h_cancel,e)
            l2_log.h_cancel_debug(code, "设置真实下单位置出错:{}", str(e))
    def need_cancel(self, code, buy_single_index, buy_exec_index, start_index, end_index, total_data,
@@ -1476,6 +1480,7 @@
                if left_count > 0:
                    total_count += left_count
                    if total_count >= 2:
                        l2_log.f_cancel_debug(code, f"交易进度距离下单位置纯买单数超过2单")
                        return False
        return True
l2/l2_data_manager_new.py
@@ -474,7 +474,7 @@
                                                                                          cls.volume_rate_info[code][1],
                                                                                          is_first_code)
                if b_need_cancel and b_cancel_data:
                    return b_cancel_data, "H撤销比例触发阈值"
                    return b_cancel_data, "H撤"
            except Exception as e:
                if constant.TEST:
                    logging.exception(e)
@@ -511,7 +511,7 @@
                                                                                                  end_index, total_data,
                                                                                                  is_first_code)
                if b_need_cancel and b_cancel_data:
                    return b_cancel_data, f"L撤销比例触发阈值({extra_msg})"
                    return b_cancel_data, f"L撤({extra_msg})"
            except Exception as e:
                async_log_util.error(logger_l2_error,
                                     f"L撤出错 参数:buy_single_index-{_buy_single_index} buy_exec_index-{_buy_exec_index} 错误原因:{str(e)}")
@@ -1035,10 +1035,12 @@
            # 尝试计算快速成交信号
            has_single, _index, sell_info = cls.__compute_fast_order_begin_pos(code, compute_start_index,
                                                                               compute_end_index)
            fast_msg = None
            if has_single:
                order_begin_pos.mode = OrderBeginPosInfo.MODE_FAST
                order_begin_pos.sell_info = sell_info
            elif _index is not None and _index < 0:
                fast_msg = sell_info
                continue_count = cls.__l2PlaceOrderParamsManagerDict[code].get_begin_continue_buy_count()
                # 有买入信号
                has_single, _index = cls.__compute_order_begin_pos(code, max(
@@ -1056,13 +1058,12 @@
                order_begin_pos.num = 0
                order_begin_pos.count = 0
                order_begin_pos.buy_single_index = buy_single_index
                if sell_info:
                    order_begin_pos.threshold_money = sell_info[1]
                l2_log.debug(code, "获取到买入信号起始点:{} ,计算范围:{}-{} ,量比:{},数据:{} 模式:{}", buy_single_index,
                l2_log.debug(code, "获取到买入信号起始点:{} ,计算范围:{}-{} ,量比:{},数据:{} 模式:{}({})", buy_single_index,
                             compute_start_index,
                             compute_end_index, cls.volume_rate_info[code], total_datas[buy_single_index],
                             order_begin_pos.mode)
                             order_begin_pos.mode, fast_msg)
        # _start_time = l2_data_log.l2_time(code, tool.get_now_timestamp() - _start_time, "下单信号计算时间")
utils/data_export_util.py
@@ -114,31 +114,31 @@
        limit_price = ""
        if int(data["val"]["limitPrice"]) == 1:
            limit_price = "涨停"
            limit_price = "T"
        elif int(data["val"]["limitPrice"]) == 2:
            limit_price = "跌停"
            limit_price = "D"
        operateDesc = ""
        if int(data["val"]["operateType"]) == 0:
            if len(limit_price) > 0:
                operateDesc = '买 ({})'.format(limit_price)
                operateDesc = '买{}'.format(limit_price)
            else:
                operateDesc = '买'
        elif int(data["val"]["operateType"]) == 1:
            if len(limit_price) > 0:
                operateDesc = '买撤 ({})'.format(limit_price)
                operateDesc = '买撤{}'.format(limit_price)
            else:
                operateDesc = '买撤'
        elif int(data["val"]["operateType"]) == 2:
            if len(limit_price) > 0:
                operateDesc = '卖 ({})'.format(limit_price)
                operateDesc = '卖{}'.format(limit_price)
            else:
                operateDesc = '卖'
        elif int(data["val"]["operateType"]) == 3:
            if len(limit_price) > 0:
                operateDesc = '卖撤 ({})'.format(limit_price)
                operateDesc = '卖撤{}'.format(limit_price)
            else:
                operateDesc = '卖撤'
        format_data.append(operateDesc)