lagerfeuer / cryptocompare

Python3 Wrapper for the CryptoCompare API
MIT License
182 stars 74 forks source link

Getting all data for a coin #50

Closed farzinaa closed 3 years ago

farzinaa commented 3 years ago

Hi, I was wondering if there is a way to set the limit in historical data to ALL or MAX. eg: data = get_historical_price_minute('BTC', 'EUR', limit=ALL/MAX, exchange='CCCAGG', toTs=datetime.datetime.now())

I currently get "limit is larger than max value" when I use a large number for the limit.

Thanks.

lagerfeuer commented 3 years ago

Hi @farzinaa

For this, I'd have to quote the documentation from CryptoCompare. limit can be quite odd at times. Here's the relevant part:

The number of data points to return. If limit * aggregate > 2000 we reduce the limit param on our side. So a limit of 1000 and an aggerate of 4 would only return 2000 (max points) / 4 (aggregation size) = 500 total points + current one so 501. [ Min - 1] [ Max - 2000] [ Default - 30]

As far as I can tell, this limit is in place for all operations that have the limit parameter. I have no intentions of adding another parameter or allowing ALL or MAX because I feel it hides too much.

farzinaa commented 3 years ago

Thanks. In case some one else is having similar issues, here is a solution based on documentation: If you want to get all the available historical data, you can use limit=2000 and keep going back in time using the toTs param. You can then keep requesting batches using: &limit=2000&toTs={the earliest timestamp received}.