Open dignitas123 opened 1 year ago
Bug confirmed.
Well, I have to say, since get_historical_klines()
is not directly mapped into a binance API as most methods in this library do, it is buggy and has been reported several times, causing lots of trouble.
And here's why only coin futures method has this bug:
get_historical_klines()
will try to locate a earliest valid timestamp
of a symbol, and using max(start_timestamp, earliest_avaliable)
as the real para when requesting klines. limit
set to 1
.I'll try to fix this, no promise though.
Meanwhile, if you know what you're doing, I strongly suggest fetching klines directly by:
These methods are directly mapped to one corresponding binance API and will do nothing else.
To anyone who concerns:
The difference between startTime and endTime can only be up to 200 days.
startTime
, endTime
and limit
are all set, only most recent limit data from endTime will be returned. (In spot/fut, most earliest limit data from startTime will be returned.)
Describe the bug Using COIN-M methods (using python-binance) is causing weird erros. Analogous USD-M with same parameters are working fine.
To Reproduce This works:
client.get_historical_klines( symbol="SOLBUSD", interval="1m", start_str="2022-09-27 11:54:17.480347+00:00", end_str="2022-09-27 13:54:17.480347+00:00", klines_type=HistoricalKlinesType.FUTURES, ) This throws error BinanceAPIException: APIError(code=-4088): Maximum time interval is 200 days.
client.get_historical_klines( symbol="SOLUSD_PERP", interval="1m", start_str="2022-09-27 11:54:17.480347+00:00", end_str="2022-09-27 12:54:17.480347+00:00", klines_type=HistoricalKlinesType.FUTURES_COIN, )
Expected behavior Don't throw error, get candlestick array.
Environment (please complete the following information):