我最近尝试使用集成开发环境 IDLE 在 Python 中检索有关特定股票价格的财务信息;为了完成这个任务,我尝试使用一个称为 alphavantage 的 Python 模块,它是我通过在 MacOS 终端中使用 pip 安装的 Alpha Vantage API 的连接。该模块的说明在它的信息页面上,在这个网址:
https://pypi.org/project/alphavantage/
我已经运行了页面上引用的以下程序:
from alphavantage.price_history import (
AdjustedPriceHistory, get_results, PriceHistory, IntradayPriceHistory,
filter_dividends
)
history = AdjustedPriceHistory(period='D')
results = history.get('AAPL')
dividends = list(filter_dividends(results.records))
IDLE 提供了以下错误消息:
Traceback (most recent call last):
File "/Users/surengrigorian/Documents/FirstExperiment.py", line 7, in <module>
results = history.get('AAPL')
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/alphavantage/price_history.py", line 133, in get
return self.get_results(ticker, response, retrieved_at)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/alphavantage/price_history.py", line 136, in get_results
updated_at, timezone, is_intraday = self.transform_meta_data(response['Meta Data'])
KeyError: 'Meta Data'
请您就此事提供帮助吗?我目前正在使用 Python 3,我已经明确安装了该模块,并且我拥有一个正在运行该程序的单独文件。谢谢您的帮助。