sammchardy / python-binance

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

Fix passing start_ts > end_ts when fetching historical klines #1165

Closed przemyslawgarlinski closed 2 years ago

przemyslawgarlinski commented 2 years ago

When end_ts is passed historical klines are fetched until Binance API returns no results. With every query start_ts is incremented. For the most part this cause one unnecessary query to Binance to be made, where start_ts is bigger than end_ts. Moreover, when fetching klines for future markets (not spot), Binance API returns an error in such condition (-1023). This makes it impossible to fetch klines for future markets when providing end_str param.

przemyslawgarlinski commented 2 years ago

972 #1052

sammchardy commented 2 years ago

Thanks @przemyslawgarlinski