sammchardy / python-binance

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

futures_historical_klines raises start_time error #1052

Open ismailbayram opened 3 years ago

ismailbayram commented 3 years ago

Describe the bug futures_historical_klines method raises an exception below:

BinanceAPIException: APIError(code=-1023): Start time is greater than end time.

my parameters: symbol=XRPUSDT interval=5m start_dt=2021-09-25 22:10:00+00:00 end_dt=2021-09-29 09:30:00+00:00 limit=1000

To Reproduce Code snippet to reproduce the behavior:

candles = self.client.futures_historical_klines(symbol, interval,
                                                        str(start_dt),
                                                        str(end_dt),
                                                        limit=self.limit)

Expected behavior No exception raising.

Environment (please complete the following information):

Logs or Additional context I've debugged the library code block and print the variables (first_valid_ts, start_ts) in _historical_klines.

1970-01-01 00:00:00 2021-10-02 20:23:56
2021-09-29 09:35:00 2021-10-02 20:55:00
1970-01-01 00:00:00 2021-10-02 20:23:57
2021-09-25 22:10:00 2021-09-29 09:30:00
2021-09-29 09:30:00 2021-09-29 09:30:00
ZsenialisTeknos commented 3 years ago

start_kline_futures_socket doesn't give any response to me. I wonder if its working for somebody? The ticker socket works.