掘金社区

history 接口返回的字段和数据问题Pinned highlighted

jesse 发表在问题反馈 2021-07-25 10:59:24

问题反馈
156
1
0
  1. history接口返回字段中,没有股票代码,不方便用户将股票代码和股票价格做对应
  2. 输入的股票数量,和返回的股票数量不一致。
    示例代码:
    输入5个股票,返回的长度只有4

stock_str = ",".join( map( str, ['SHSE.600015', 'SHSE.600016', 'SHSE.600018', 'SHSE.600019', 'SHSE.600025']))    


print(stock_str)    


history_data = history(symbol=stock_str, frequency='1d', start_time='2017-07-28',  end_time='2017-07-28', fields='open, close, low, high, eob', adjust=ADJUST_PREV, df= False,skip_suspended=False)  


print(len(history_data))  


print((history_data))

运行结果:
SHSE.600015,SHSE.600016,SHSE.600018,SHSE.600019,SHSE.600025
4
[{'open': 5.837310791015625, 'close': 5.871728897094727, 'low': 5.823543548583984, 'high': 5.878612518310547, 'eob': datetime.datetime(2017, 7, 28, 0, 0, tzinfo=tzfile('PRC'))}, {'open': 6.138969421386719, 'close': 6.103069305419922, 'low': 6.067168712615967, 'high': 6.165894508361816, 'eob': datetime.datetime(2017, 7, 28, 0, 0, tzinfo=tzfile('PRC'))}, {'open': 5.6273417472839355, 'close': 5.683216094970703, 'low': 5.619359970092773, 'high': 5.6991801261901855, 'eob': datetime.datetime(2017, 7, 28, 0, 0, tzinfo=tzfile('PRC'))}, {'open': 8.723174095153809, 'close': 8.749421119689941, 'low': 8.670676231384277, 'high': 8.766921043395996, 'eob': datetime.datetime(2017, 7, 28, 0, 0, tzinfo=tzfile('PRC'))}]

补充说明:
600025华能水电 2017-07-28时还没上市,所以没有数据

评论: 1
  • fields='open, close, low, high, eob'加上symbol

    2021-07-26 09:22:40

Looks like your connection to 掘金量化社区 - 量化交易者的交流社区 was lost, please wait while we try to reconnect.