我用程序想调用过去大约4-5个交易日的历史数据计算均线数值,不是刚上市的合约,都是主力合约。可是日志反馈失败:Failed to get trading dates: ‘TqApi’ object has no attribute ‘get_trading_dates’
代码如下:
# 获取过去几个交易日日期
trading_dates = await get_previous_trading_dates(api, current_time, symbol)
if not trading_dates:
logging.error(f”{symbol} Failed to get trading dates, retrying…”)
continue
# 获取历史 K 线数据
klines = await get_historical_klines(api, symbol, trading_dates)
if klines.empty:
logging.error(f”{symbol} Failed to get K-line data, retrying…”)
continue
请问哪里有问题呢?谢谢