David-Woroniuk / Historic_Crypto

An open source Python library for scraping Historical Cryptocurrency data.
MIT License
90 stars 30 forks source link

Chunk problem #1

Closed carlok closed 3 years ago

carlok commented 3 years ago

Hello, thanks for your work. I might have found an odd behaviour. It seems that with a single chunk or two chunks, the time order changes. See

import datetime

from Historic_Crypto import HistoricalData

signal = 'ETH-EUR'
granularity = 86400
days = 300 # try 300 or 301
date_start = (datetime.datetime.now() - datetime.timedelta(days + 1)).strftime('%Y-%m-%d-00-00')
date_end = (datetime.datetime.now() - datetime.timedelta(1)).strftime('%Y-%m-%d-00-00')

print(HistoricalData(signal, granularity, date_start, date_end).retrieve_data(), signal)

As in the comment, try with 300 (single chunk) and 300 (two chunkes) 300 => from new to old 301 => from old to new

David-Woroniuk commented 3 years ago

Hi Carlo,

Thanks for spotting this - it is likely due to the different calls within the if/else branch relating to the 300 or larger sample. I am away from the office so can't update the PYPI package, but have updated the GitHub code.

Best,

David