python - Alpha vantage API "invalid api call" - 日内和货币数字货币汇率
问题描述
当我尝试获取加密货币的日内数据时,它会返回invalid api call
当我将其更改为每天时,请求工作正常。ForeignExchange 和 TimeSeries 也运行良好,只有加密货币和盘中的汇率。
这是我的代码:
from alpha_vantage.cryptocurrencies import CryptoCurrencies
ts = CryptoCurrencies(key="my_key", output_format="pandas")
data= ts.get_digital_currency_exchange_rate(symbol='BTC',market='USD')
这是我得到的错误:
ValueError: Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for CURRENCY_EXCHANGE_RATE.
解决方案
有两个问题:
- Alpha Vantage 平台不提供对加密货币的日内支持。如果您查看文档,您会看到它有每日、每周和每月,但没有日内。
- 要获得 in 的价格,
BTC
您USD
必须使用ForeignExchange
. 这是您调整后的正常工作代码:
from alpha_vantage.foreignexchange import ForeignExchange
ts = ForeignExchange(key="my_key", output_format="pandas")
data= ts.get_currency_exchange_rate(from_currency='BTC',to_currency='USD')
print(data)
推荐阅读
- android - JetPack Jetifier 的 Android Crashlytics 问题
- python - 如何使用 pymongo 解析所有集合的数据
- ios - Stripe Radar 规则不适用于 Apple Pay 待授权
- msbuild - 全新安装时 GAC 缺少 netstandard.dll
- react-native-ios - 使用 iOS 模拟器,React Native 应用程序卡在空白屏幕上
- intellij-idea - IDEA编辑器中字符的宽度不一样
- http - netcat - 接收包含多个文件的多部分 TCP/HTTP 响应
- javascript - Window.top.opener is null/undefined in the child window opened from gmail in all browsers
- mysql - 在 Istio 中连接到 MySQL (AWS RDS)
- android - tensorflow-lite and nnapi hw acceleration for embedded linux