From cd5863943c5c207601df5c91ec1159c41fb044fb Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期三, 04 九月 2024 18:13:52 +0800 Subject: [PATCH] 小群撤参数修改 --- utils/data_export_util.py | 27 ++++++++++++++++++++++----- 1 files changed, 22 insertions(+), 5 deletions(-) diff --git a/utils/data_export_util.py b/utils/data_export_util.py index 8e3137d..046716c 100644 --- a/utils/data_export_util.py +++ b/utils/data_export_util.py @@ -1,6 +1,7 @@ """ 鏁版嵁瀵煎嚭宸ュ叿 """ +import copy import json import logging import os @@ -13,7 +14,7 @@ import l2.l2_data_util from l2.huaxin import l2_huaxin_util from log_module import log, log_export -from l2 import l2_data_source_util +from l2 import l2_data_source_util, l2_data_util from log_module.log import logger_debug from trade import deal_big_money_manager from utils import tool @@ -29,7 +30,7 @@ # 鑾峰彇L2鐨勬暟鎹� -def get_l2_datas(code, today_datas=None, date=None, max_time=None): +def get_l2_datas(code, today_datas=None, date=None, end_index=None): __start_time = time.time() if date is None: date = tool.get_now_date_str() @@ -66,6 +67,14 @@ active_sell_set = active_sell_map.get(code) if not active_sell_set: active_sell_set = set() + # 濡傛灉鏈夋埅鑷充綅缃� + if end_index: + datas = copy.deepcopy(datas) + for i in range(len(datas)): + if datas[i]["index"] == end_index: + datas = datas[:i] + break + fdatas = export_l2_data(code, datas, process_indexs, trade_indexs, real_position_indexes, deal_list_dict, sell_nos, active_sell_set, cancel_reasons) return fdatas @@ -93,6 +102,11 @@ if trade_indexs[i][1] == index: return trade_indexs[i] return None + + # 鏈�鏂扮殑涓�鏉℃暟鎹� + latest_data = datas[-1] + latest_time_str_with_ms = l2.l2_data_util.L2DataUtil.get_time_with_ms(latest_data["val"]) + # 鏁版嵁棰勫鐞� num_operate_map = {} @@ -200,7 +214,8 @@ if int(data["val"]["operateType"]) == 0: cancel_data = l2.l2_data_util.local_today_canceled_buyno_map.get(code).get(str(data["val"]["orderNo"])) # 涔� - if cancel_data: + if cancel_data and latest_data["index"] >= cancel_data["index"]: + # 濡傛灉鎾ゅ崟绱㈠紩涓嶈兘姣旀渶杩戞暟鎹储寮曡繕澶� try: left_num = data["val"]["num"] - cancel_data["val"]["num"] if left_num > 0: @@ -213,8 +228,10 @@ else: deal_info = deal_list_dict.get(str(data["val"].get("orderNo"))) if deal_info and len(deal_info) >= 5: - cancel_info = l2_huaxin_util.convert_time(deal_info[4], - with_ms=True) + # 鎴愪氦鏃堕棿涓嶈兘姣斿綋鍓嶇储寮曟椂闂村ぇ + if tool.trade_time_sub_with_ms(cancel_info , latest_time_str_with_ms) <= 0: + cancel_info = l2_huaxin_util.convert_time(deal_info[4], + with_ms=True) format_data.append(cancel_info) cancel_order_info = None if trade_info: -- Gitblit v1.8.0