lagerfeuer / cryptocompare

Python3 Wrapper for the CryptoCompare API
MIT License
181 stars 73 forks source link

get_historical_price with list of coins #47

Closed thomashirtz closed 3 years ago

thomashirtz commented 3 years ago

I would like to know the historical value of coins from yesterday:

import cryptocompare
from datetime import datetime, timedelta
yesterday = datetime.now() - timedelta(1)

coin_list = ['BTC', 'XRP']
print(cryptocompare.get_historical_price(coin_list, 'EUR', yesterday))

I get the error:

[ERROR] There is no data for the symbol ['BTC', 'XRP'] .

Which forces me to request one coin at the time, which is quite slow..

lagerfeuer commented 3 years ago

Hey @thomashirtz,

this wrapper library was built around CryptoCompare's API. I just package the existing calls for Python. CryptoCompare does not offer a multi-coin request for the historical price, therefore it is not supported. Even if we had a wrapper around multiple calls, it would still be slow because we'd have N requests for N coins in the background.

See: https://min-api.cryptocompare.com/documentation?key=Historical&cat=dataPriceHistorical

I'm going to close this issue since I can't change the way CryptoCompare handles the request.