@@ -911,7 +911,7 @@ def _get_earliest_valid_timestamp(self, symbol, interval, klines_type: Historica
911911 )
912912 return kline [0 ][0 ]
913913
914- def get_historical_klines (self , symbol , interval , start_str = None , end_str = None , limit = 500 ,
914+ def get_historical_klines (self , symbol , interval , start_str = None , end_str = None , limit = 1000 ,
915915 klines_type : HistoricalKlinesType = HistoricalKlinesType .SPOT ):
916916 """Get Historical Klines from Binance
917917
@@ -923,17 +923,19 @@ def get_historical_klines(self, symbol, interval, start_str=None, end_str=None,
923923 :type start_str: str|int
924924 :param end_str: optional - end date string in UTC format or timestamp in milliseconds (default will fetch everything up to now)
925925 :type end_str: str|int
926- :param limit: Default 500 ; max 1000.
926+ :param limit: Default 1000 ; max 1000.
927927 :type limit: int
928928 :param klines_type: Historical klines type: SPOT or FUTURES
929929 :type klines_type: HistoricalKlinesType
930930
931931 :return: list of OHLCV values (Open time, Open, High, Low, Close, Volume, Close time, Quote asset volume, Number of trades, Taker buy base asset volume, Taker buy quote asset volume, Ignore)
932932
933933 """
934- return self ._historical_klines (symbol , interval , start_str = start_str , end_str = end_str , limit = limit , klines_type = klines_type )
934+ return self ._historical_klines (
935+ symbol , interval , start_str = start_str , end_str = end_str , limit = limit , klines_type = klines_type
936+ )
935937
936- def _historical_klines (self , symbol , interval , start_str = None , end_str = None , limit = 500 ,
938+ def _historical_klines (self , symbol , interval , start_str = None , end_str = None , limit = 1000 ,
937939 klines_type : HistoricalKlinesType = HistoricalKlinesType .SPOT ):
938940 """Get Historical Klines from Binance (spot or futures)
939941
@@ -949,7 +951,7 @@ def _historical_klines(self, symbol, interval, start_str=None, end_str=None, lim
949951 :type start_str: str|int
950952 :param end_str: optional - end date string in UTC format or timestamp in milliseconds (default will fetch everything up to now)
951953 :type end_str: None|str|int
952- :param limit: Default 500 ; max 1000.
954+ :param limit: Default 1000 ; max 1000.
953955 :type limit: int
954956 :param klines_type: Historical klines type: SPOT or FUTURES
955957 :type klines_type: HistoricalKlinesType
@@ -1012,7 +1014,7 @@ def _historical_klines(self, symbol, interval, start_str=None, end_str=None, lim
10121014
10131015 return output_data
10141016
1015- def get_historical_klines_generator (self , symbol , interval , start_str = None , end_str = None ,
1017+ def get_historical_klines_generator (self , symbol , interval , start_str = None , end_str = None , limit = 1000 ,
10161018 klines_type : HistoricalKlinesType = HistoricalKlinesType .SPOT ):
10171019 """Get Historical Klines generator from Binance
10181020
@@ -1024,16 +1026,18 @@ def get_historical_klines_generator(self, symbol, interval, start_str=None, end_
10241026 :type start_str: str|int
10251027 :param end_str: optional - end date string in UTC format or timestamp in milliseconds (default will fetch everything up to now)
10261028 :type end_str: str|int
1029+ :param limit: amount of candles to return per request (default 1000)
1030+ :type limit: int
10271031 :param klines_type: Historical klines type: SPOT or FUTURES
10281032 :type klines_type: HistoricalKlinesType
10291033
10301034 :return: generator of OHLCV values
10311035
10321036 """
10331037
1034- return self ._historical_klines_generator (symbol , interval , start_str , end_str = end_str , klines_type = klines_type )
1038+ return self ._historical_klines_generator (symbol , interval , start_str , end_str , limit , klines_type = klines_type )
10351039
1036- def _historical_klines_generator (self , symbol , interval , start_str = None , end_str = None ,
1040+ def _historical_klines_generator (self , symbol , interval , start_str = None , end_str = None , limit = 1000 ,
10371041 klines_type : HistoricalKlinesType = HistoricalKlinesType .SPOT ):
10381042 """Get Historical Klines generator from Binance (spot or futures)
10391043
@@ -1055,8 +1059,6 @@ def _historical_klines_generator(self, symbol, interval, start_str=None, end_str
10551059 :return: generator of OHLCV values
10561060
10571061 """
1058- # setup the max limit
1059- limit = 1000
10601062
10611063 # convert interval to useful value in seconds
10621064 timeframe = interval_to_milliseconds (interval )
@@ -7494,12 +7496,12 @@ async def _get_earliest_valid_timestamp(self, symbol, interval,
74947496 return kline [0 ][0 ]
74957497 _get_earliest_valid_timestamp .__doc__ = Client ._get_earliest_valid_timestamp .__doc__
74967498
7497- async def get_historical_klines (self , symbol , interval , start_str = None , end_str = None , limit = 500 ,
7499+ async def get_historical_klines (self , symbol , interval , start_str = None , end_str = None , limit = 1000 ,
74987500 klines_type : HistoricalKlinesType = HistoricalKlinesType .SPOT ):
74997501 return await self ._historical_klines (symbol , interval , start_str , end_str = end_str , limit = limit , klines_type = klines_type )
75007502 get_historical_klines .__doc__ = Client .get_historical_klines .__doc__
75017503
7502- async def _historical_klines (self , symbol , interval , start_str = None , end_str = None , limit = 500 ,
7504+ async def _historical_klines (self , symbol , interval , start_str = None , end_str = None , limit = 1000 ,
75037505 klines_type : HistoricalKlinesType = HistoricalKlinesType .SPOT ):
75047506
75057507 # init our list
@@ -7557,17 +7559,16 @@ async def _historical_klines(self, symbol, interval, start_str=None, end_str=Non
75577559 return output_data
75587560 _historical_klines .__doc__ = Client ._historical_klines .__doc__
75597561
7560- async def get_historical_klines_generator (self , symbol , interval , start_str = None , end_str = None ,
7562+ async def get_historical_klines_generator (self , symbol , interval , start_str = None , end_str = None , limit = 1000 ,
75617563 klines_type : HistoricalKlinesType = HistoricalKlinesType .SPOT ):
7562- return self ._historical_klines_generator (symbol , interval , start_str , end_str = end_str , klines_type = klines_type )
7564+ return self ._historical_klines_generator (
7565+ symbol , interval , start_str , end_str = end_str , limit = limit , klines_type = klines_type
7566+ )
75637567 get_historical_klines_generator .__doc__ = Client .get_historical_klines_generator .__doc__
75647568
7565- async def _historical_klines_generator (self , symbol , interval , start_str = None , end_str = None ,
7569+ async def _historical_klines_generator (self , symbol , interval , start_str = None , end_str = None , limit = 1000 ,
75667570 klines_type : HistoricalKlinesType = HistoricalKlinesType .SPOT ):
75677571
7568- # setup the max limit
7569- limit = 1000
7570-
75717572 # convert interval to useful value in seconds
75727573 timeframe = interval_to_milliseconds (interval )
75737574
0 commit comments