| | |
| | | @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 |
| | |
| | | # 返回指定日期的上个交易日 |
| | | @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): |
| | |
| | | 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)) |