Administrator
2024-05-31 bf0c90f3be2a35992ed00d4b395b5cc2280d06ac
L2早上订阅的下限降低/F撤修改/09:31:00之前不下单
5个文件已修改
44 ■■■■■ 已修改文件
huaxin_client/constant.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/l1_client.py 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/tool.py 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/cancel_buy_strategy.py 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/constant.py
@@ -12,7 +12,7 @@
TEST = True
L1_MIN_RATE = 3.0
L1_MIN_RATE_PRE = 1.0  # 早上订阅要多低点
L2_CODES_INFO_PATH = "/home/userzjj/logs/l2_codes.txt"
# 影子订单的量
SHADOW_ORDER_VOLUME = 100
huaxin_client/l1_client.py
@@ -251,10 +251,14 @@
            list_ = [level1_data_dict[k] for k in level1_data_dict]
            flist = []
            plist = []
            threshold_rate = constant.L1_MIN_RATE_PRE if int(tool.get_now_time_str().replace(":", "")) < int(
                "094000") else constant.L1_MIN_RATE
            for d in list_:
                if d[2] >= constant.L1_MIN_RATE:
                if d[2] >= threshold_rate:
                    # 涨幅小于5%的需要删除
                    flist.append(d)
                if d[0] in __position_codes:
                    plist.append(d)
            flist.sort(key=lambda x: x[2], reverse=True)
huaxin_client/tool.py
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
import datetime
import time
@@ -22,3 +23,8 @@
    if start1 < relative_timestamp < end1:
        return True
    return False
def get_now_time_str():
    time_str = datetime.datetime.now().strftime("%H:%M:%S")
    return time_str
l2/cancel_buy_strategy.py
@@ -283,19 +283,19 @@
    # 设置真实的下单位置
    def set_real_order_index(self, code, index, is_default):
        self.__set_real_order_index(code, index, is_default)
        if not is_default and code.find("60") == 0:
            try:
                # 统计未成交的最大单
                trade_index = 0
                trade_info = TradeBuyQueue().get_traded_index(code)
                if trade_info and not trade_info[1] and trade_info[0] is not None:
                    trade_index = trade_info[0]
                data = L2DataComputeUtil.compute_max_buy_order_info(code, trade_index, index)
                # 保存最大单
                self.__max_buy_order_num_cache[code] = data["val"]["num"]
                l2_log.f_cancel_debug(code, f"最大单计算:索引-{data['index']} 范围:{trade_index}-{index}")
            except Exception as e:
                logger_l2_error.exception(e)
        # if not is_default and code.find("60") == 0:
        try:
            # 统计未成交的最大单
            trade_index = 0
            trade_info = TradeBuyQueue().get_traded_index(code)
            if trade_info and not trade_info[1] and trade_info[0] is not None:
                trade_index = trade_info[0]
            data = L2DataComputeUtil.compute_max_buy_order_info(code, trade_index, index)
            # 保存最大单
            self.__max_buy_order_num_cache[code] = data["val"]["num"]
            l2_log.f_cancel_debug(code, f"最大单计算:索引-{data['index']} 范围:{trade_index}-{index}")
        except Exception as e:
            logger_l2_error.exception(e)
    def place_order_success(self, code):
        self.clear(code)
l2/l2_data_manager_new.py
@@ -961,8 +961,8 @@
        now_time_int = int(tool.get_now_time_str().replace(":", ""))
        if now_time_int >= 145700:
            return False, True, f"14:57后不能交易"
        if 130100 >= now_time_int >= 112900:
            return False, True, f"11:29:00-13:01:00不能交易"
        if 130100 >= now_time_int >= 112900 or now_time_int<93100:
            return False, True, f"09:31:00之前,11:29:00-13:01:00不能交易"
        # place_order_count = cls.__PlaceOrderCountManager.get_place_order_count(code)
        # if place_order_count > 0 and now_time_int >= 140000: