From e1057fa87cbda64ec7bf88db4d944d1ee515b853 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期二, 31 十二月 2024 15:51:04 +0800
Subject: [PATCH] 将掘金的交易日历/K线替换为华鑫

---
 third_data/history_k_data_util.py |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/third_data/history_k_data_util.py b/third_data/history_k_data_util.py
index 10fe9ff..c64efb3 100644
--- a/third_data/history_k_data_util.py
+++ b/third_data/history_k_data_util.py
@@ -11,6 +11,7 @@
 import constant
 from db.redis_manager_delegate import RedisUtils
 from log_module.log import logger_request_api
+from third_data import hx_qc_value_util
 from utils import tool, middle_api_protocol
 from db import redis_manager_delegate as redis_manager
 
@@ -232,7 +233,8 @@
 
     @classmethod
     def get_history_tick_n(cls, code, count, fields=None):
-        return JueJinApi.get_history_tick_n(code, count, fields)
+        # return JueJinApi.get_history_tick_n(code, count, fields)
+        return hx_qc_value_util.get_history_k_bars(code, count)
 
     @classmethod
     def get_gp_current_info(cls, codes):
@@ -241,7 +243,7 @@
     # 杩斿洖鎸囧畾鏃ユ湡鐨勪笂涓氦鏄撴棩
     @classmethod
     def get_previous_trading_date(cls, date):
-        return JueJinApi.get_previous_trading_date(date)
+        return hx_qc_value_util.get_previous_trading_date(date)
 
     @classmethod
     def get_previous_trading_date_cache(cls, date):
@@ -275,11 +277,12 @@
     # 杩斿洖鎸囧畾鏃ユ湡鐨勪笅涓氦鏄撴棩
     @classmethod
     def get_next_trading_date(cls, date):
-        return JueJinApi.get_next_trading_date(date)
+        # return JueJinApi.get_next_trading_date(date)
+        return hx_qc_value_util.get_next_trading_date(date)
 
     @classmethod
     def get_trading_dates(cls, start_date, end_date):
-        return JueJinApi.get_trading_dates(start_date, end_date)
+        return hx_qc_value_util.get_trade_calendar(start_date, end_date)
 
     @classmethod
     def get_now_price(cls, codes):
@@ -334,13 +337,16 @@
 
 
 if __name__ == "__main__":
-    now_day = tool.get_now_date_str()
-    results = JueJinApi.get_history_instruments(JueJinApi.get_juejin_code_list_with_prefix(["600265"]),
-                                                tool.date_sub(now_day, 30), tool.date_sub(now_day, 1))
-    results = results[-5:]
-    normal = True
-    for r in results:
-        if r["sec_level"] != 1:
-            normal = False
-            break
+    print(HistoryKDatasUtils.get_previous_trading_date("2024-12-31"))
+    print(HistoryKDatasUtils.get_history_tick_n("000095", 10))
+
+    # now_day = tool.get_now_date_str()
+    # results = JueJinApi.get_history_instruments(JueJinApi.get_juejin_code_list_with_prefix(["600265"]),
+    #                                             tool.date_sub(now_day, 30), tool.date_sub(now_day, 1))
+    # results = results[-5:]
+    # normal = True
+    # for r in results:
+    #     if r["sec_level"] != 1:
+    #         normal = False
+    #         break
     # print(normal)

--
Gitblit v1.8.0