My Problem:
I am trying to retrieve the daily prices in € or $ (EUR or USD) of Bitcoin (BTC) from the alpha vantage API in python, however it appears to return the following Error Message
: Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for DIGITAL_CURRENCY_DAILY.
I have used the API extensively in the past and I can guarantee that this has works just fine over the last years.
Any help is greatly appreciated!
What I’ve tried:
I have boiled down the problem to a minimal working example to highlight that the API in general appears to work as expected, but this specific pairing of currencies appears to be broken:
import requests
import time
API_FUNCTION = "DIGITAL_CURRENCY_DAILY"
for CRY in ["LTC","BTC","WBTC"]:
print(f"--- {CRY} ---")
for CUR in ["EUR","USD","AUD","CNY"]:
#--- Query API ---
url = f"https://www.alphavantage.co/query?function={API_FUNCTION}&symbol={CRY}&market={CUR}&apikey={API_KEY}&datatype=json"
response = requests.get(url)
data = response.json()
is_failure = "Error Message" in data
#--- Print Result ---
print(CUR,response,"FAILURE!" if is_failure else "SUCCESS!")
print("\t",data["Error Message" if is_failure else "Meta Data"])
time.sleep(12.0) # Wait to not exceed 5 calls/minute free API restriction
I try to query the prices on a daily basis for all combinations of 3 Cryptocurrencies [“Litecoin”,“Bitcoin”,“Wrapped Bitcoin”] and 4 physical currencies [“Euro”,“US Dollar”,“Australian Dollar”,“Renminbi”].
The following observations can be made:
- LTC: As expected, all calls succeed for Litecoin
- BTC: For Bitcoin all calls succeed, except for EUR and USD
- WBTC: The attempt to retrieve the price of bitcoin through another cryptocurrency pegged to Bitcoin fails on all calls, even though ‘WBTC’ is listed as a a supported digital currency on the Alpha Vantage documentation page Digital currency list.
The full output of the code example above is as follows: I tried to provide the full output log, but for some unfortunate reason my post was flagged with Your question appears to be spam.
.
PS:
I know that one solution would be to query the price in another currency and then apply the exchange rate between be desired and the queried physical currency, but that seems like a hack I’d rather avoid if at all possible.