python-binance icon indicating copy to clipboard operation
python-binance copied to clipboard

Making start_str argument optional for futures historical klines

Open mkaanerkoc opened this issue 1 year ago • 2 comments

Hoi hoi,

I recognized not so important but quite nice low-hanging fruit in the futures wrapper methods.

The function below accepts start_str as mandatory argument. However, by API definition it is not mandatory and user can choose to retrieve recent data by giving only limit argument ( actually, it is me ).

def futures_historical_klines(self, symbol, interval, start_str, end_str=None, limit=500):

I also checked spot methods and this parameter is optional there. so it means underlying '_historical_klines' method is supporting optional start_str argument.

def get_historical_klines(self, symbol, interval, start_str=None, end_str=None, limit=1000,
                              klines_type: HistoricalKlinesType = HistoricalKlinesType.SPOT):

I would like to learn if there is any historical reason to do that so, if not, I would suggest to make it optional as well.

mkaanerkoc avatar Jun 20 '23 20:06 mkaanerkoc

hello, may I ask you a question? I want to get the klines of perpetual futures but I don't know how to code it. I can just get klines of spot, can you help me or give me an e.g? thanks.

lode-runner avatar Jul 25 '23 12:07 lode-runner

hello, may I ask you a question? I want to get the klines of perpetual futures but I don't know how to code it. I can just get klines of spot, can you help me or give me an e.g? thanks.

even though it is not a right place to ask it, check this method https://github.com/sammchardy/python-binance/blob/a354b258e295197ea375363ccbe3c2c49b099582/binance/client.py#L6023

mkaanerkoc avatar Jul 27 '23 21:07 mkaanerkoc