Administrator
2024-12-31 e1057fa87cbda64ec7bf88db4d944d1ee515b853
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)