sammchardy / python-binance

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

Making start_str argument optional for futures historical klines #1333

Open mkaanerkoc opened 1 year ago

mkaanerkoc commented 1 year ago

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.

lode-runner commented 11 months ago

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.

mkaanerkoc commented 11 months ago

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