sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
6.06k stars 2.21k forks source link

don't take all data for some pairs #1139

Closed hossain93 closed 2 years ago

hossain93 commented 2 years ago

I get Historical Data with client.get_historical_klines but when I use toDate = str(datetime.datetime.strptime('02/02/2022', '%d/%m/%Y')) to get data for today I get below data image but it is for date 2020-06-20 how solve this problem

example pairs MKRUSDT SNXUSDT DOTUSDT DEFIUSDT YFIUSDT BALUSDT CRVUSDT TRBUSDT YFIIUSDT

varfigstar commented 2 years ago

It's beacuse you set end date. API check for oldest available data, build dataset with range from [OLDEST_AVAILABLE_DATE] to your [toDate] and return it. It's mean, that api build dataset from 2020.06.20 to 2022.02.02

To fix it - set fromDate by toDate