我想使用Alpha Vantage API接收不同加密货币的健康指数。为了提取健康指数,我使用了两种不成功的方法: 方法:使用python Alpha Vantage库进行调用
from alpha_vantage.cryptocurrencies import CryptoCurrencies
ts = CryptoCurrencies(key="my_key", output_format="pandas")
data= ts.get_digital_crypto_rating(symbol='BTC')
print(data)
运行它时,我收到以下错误
ValueError: Error getting data from the api, no return was given.
B'way:使用直接调用API
import requests
API_URL = "https://www.alphavantage.co/query"
parameters = {
"function": "CRYPTO_RATING",
"symbol": "BTC",
"apikey": "my_key"}
response = requests.get(API_URL, params=parameters)
print(response.json())
使用这种方法,它似乎成功地进行了API调用,因为我接收<Response [200]>
,但接收数据的打印是{}
目前没有回答
相关问题 更多 >
编程相关推荐