From d2a4dd9c837f8df2a19e58f7fb4c81a91c114b67 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期五, 15 八月 2025 13:15:32 +0800 Subject: [PATCH] 自动加想接口 --- utils/init_data_util.py | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/utils/init_data_util.py b/utils/init_data_util.py index be4543b..93d3ac5 100644 --- a/utils/init_data_util.py +++ b/utils/init_data_util.py @@ -14,18 +14,19 @@ def re_set_price_pres(codes, force=False): # 閫氳繃鍘嗗彶鏁版嵁缂撳瓨鑾峰彇 - result = HistoryKDatasUtils.get_gp_latest_info(codes) - for item in result: - symbol = item['symbol'] - symbol = symbol.split(".")[1] - pre_close = tool.to_price(decimal.Decimal(str(item['pre_close']))) - gpcode_manager.CodePrePriceManager.set_price_pre(symbol, pre_close, force) + for code in codes: + result = HistoryKDatasUtils.get_history_tick_n(code, 1) + for item in result: + symbol = item['symbol'] + symbol = symbol.split(".")[1] + pre_close = tool.to_price(decimal.Decimal(str(item['close']))) + gpcode_manager.CodePrePriceManager().set_price_pre(symbol, pre_close, force) # 鑾峰彇杩�90澶╃殑鏈�澶ч噺涓庢渶杩戠殑閲� # 鑾峰彇鏈�杩戜竴娆℃定鍋�/娑ㄥ仠涓嬩竴涓氦鏄撴棩鐨勬渶澶у�� -def get_volumns_by_code(code, count=60): - datas = HistoryKDatasUtils.get_history_tick_n(code, count, "open,high,low,close,volume,pre_close,bob,amount") +def get_volumns_by_code(code, count=60, juejin=False): + datas = HistoryKDatasUtils.get_history_tick_n(code, count, "open,high,low,close,volume,pre_close,bob,amount", juejin=juejin) if not datas: return None # 璁$畻 @@ -121,8 +122,8 @@ if d["volume"] > max_volume_info[0]: max_volume_info = (d["volume"], d) if max_volume_info: - return max_volume_info[0] - return None + return max_volume_info[0], max_volume_info[1]['bob'].strftime("%Y-%m-%d") + return None, None # 杩斿洖锛�(60澶╂渶澶ч噺,鏄ㄦ棩閲�,閲忓弬鑰冩棩鏈�,鍙傝�冮噺鎹粖浜ゆ槗鏃ユ暟) -- Gitblit v1.8.0