From 967abfe26abe09c26df61fe48bab1d64e2253cef Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期三, 20 十一月 2024 15:26:37 +0800 Subject: [PATCH] 添加新接口 --- log_module/log_export.py | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/log_module/log_export.py b/log_module/log_export.py index cc587fa..67a02b8 100644 --- a/log_module/log_export.py +++ b/log_module/log_export.py @@ -389,6 +389,26 @@ return fdatas +# 鍔犺浇涔板叆寰楀垎璁板綍 +def load_trade_recod_by_type(type_, date=tool.get_now_date_str()): + path = f"{constant.get_path_prefix()}/logs/gp/trade/trade_record.{date}.log" + fdatas = [] + lines = __load_file_content(path) + for line in lines: + data_index = line.find(f"{type_}") + if data_index > 0: + line = line.split(" - ")[1] + time_str = line[line.find("[") + 1:line.find("[") + 9] + data = line[line.find("]") + 1:].strip() + data_json = json.loads(data) + type = data_json["type"] + code = data_json["code"] + if type != type_: + continue + fdatas.append((time_str,code, type, data_json["data"])) + return fdatas + + def load_cancel_buy_reasons(code, date=tool.get_now_date_str()): """ 鑾峰彇鎾ゅ崟鍘熷洜 -- Gitblit v1.8.0