From 7de28c45eb5fc393bfed07ffbefb69dc63eeaa4d Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 09 一月 2025 15:36:04 +0800 Subject: [PATCH] BUG修复 --- third_data/history_k_data_util.py | 32 +++++++++++++++++++++++++++----- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/third_data/history_k_data_util.py b/third_data/history_k_data_util.py index 42573e8..aada0ae 100644 --- a/third_data/history_k_data_util.py +++ b/third_data/history_k_data_util.py @@ -234,10 +234,13 @@ @classmethod def get_history_tick_n(cls, code, count, fields=None): # return JueJinApi.get_history_tick_n(code, count, fields) - try: - return hx_qc_value_util.get_history_k_bars(code, count) - except Exception as e: - logger_debug.exception(e) + if constant.is_windows(): + return JueJinApi.get_history_tick_n(code, count, fields) + else: + try: + return hx_qc_value_util.get_history_k_bars(code, count) + except Exception as e: + logger_debug.exception(e) @classmethod @@ -247,7 +250,10 @@ # 杩斿洖鎸囧畾鏃ユ湡鐨勪笂涓氦鏄撴棩 @classmethod def get_previous_trading_date(cls, date): - return hx_qc_value_util.get_previous_trading_date(date) + if constant.is_windows(): + return JueJinApi.get_previous_trading_date(date) + else: + return hx_qc_value_util.get_previous_trading_date(date) @classmethod def get_previous_trading_date_cache(cls, date): @@ -350,6 +356,22 @@ return results +def get_k_bar_dead_date(): + """ + 鑾峰彇K绾跨殑鎴鏃ユ湡 + @return: + """ + dates = HistoryKDatasUtils.get_latest_trading_date_cache(5) + latest_trading_date = None + if dates: + latest_trading_date = dates[0] + if latest_trading_date is None: + raise Exception("娌℃湁鑾峰彇鍒颁笂涓�涓氦鏄撴棩鐨勬棩鏈�") + # 4鐐逛箣鍚庢敼涓鸿幏鍙栦粖鏃ョ殑鏁版嵁 + if tool.get_now_time_as_int() > 160000: + latest_trading_date = tool.get_now_date_str() + return latest_trading_date + if __name__ == "__main__": print(HistoryKDatasUtils.get_previous_trading_date("2024-12-31")) print(HistoryKDatasUtils.get_history_tick_n("000095", 10)) -- Gitblit v1.8.0