From 3b2b30708614ee604bc28c7db359544688ede3f6 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 03 六月 2024 19:10:30 +0800 Subject: [PATCH] 可转债回撤 --- log_module/log_export.py | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/log_module/log_export.py b/log_module/log_export.py index fe86b3c..75168a1 100644 --- a/log_module/log_export.py +++ b/log_module/log_export.py @@ -59,7 +59,6 @@ def load_latest_market_info(date=tool.get_now_date_str()): path = f"{constant.get_path_prefix()}/{constant.LOG_DIR}/huaxin_local/l2/market.{date}.log" fdatas = {} - MAX_LINE = 5000 with open(path, 'r') as file: file.seek(0, 2) @@ -86,8 +85,25 @@ return fdatas +def load_transactions(date=tool.get_now_date_str()): + path = f"{constant.get_path_prefix()}/{constant.LOG_DIR}/huaxin_local/l2/transaction.{date}.log" + fdatas = [] + with open(path, 'r') as file: + lines = file.readlines() + for line in lines: + start_index = line.find("]") + if start_index<0: + continue + line = line[start_index + 1:].strip() + data = eval(line) + fdatas.append(data) + return fdatas + + + + if __name__ == "__main__": - fdatas = load_latest_market_info() + fdatas = load_latest_market_info("2024-05-29") print(fdatas) pass -- Gitblit v1.8.0