Alpha Vantage API - Cryptocurrencies ValueError:从 api 获取数据时出错,未给出返回值

问题描述

我想使用 Alpha Vantage API 接收不同加密货币的健康指数。为了提取健康指数,我使用了两种不成功的方法: A'way:使用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]>,但接收数据的打印结果是 {}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)