diff --git a/jesse/modes/import_candles_mode/drivers/Binance/BinanceMain.py b/jesse/modes/import_candles_mode/drivers/Binance/BinanceMain.py index d44547c44..138f5da17 100644 --- a/jesse/modes/import_candles_mode/drivers/Binance/BinanceMain.py +++ b/jesse/modes/import_candles_mode/drivers/Binance/BinanceMain.py @@ -30,7 +30,7 @@ def get_starting_time(self, symbol: str) -> int: 'limit': 1500, } - response = requests.get(self.endpoint + '/v3/klines', params=payload) + response = requests.get(self.endpoint + self._prefix_address + 'klines', params=payload) self.validate_response(response) @@ -54,7 +54,7 @@ def fetch(self, symbol: str, start_timestamp: int, timeframe: str = '1m') -> Uni 'limit': self.count, } - response = requests.get(self.endpoint + '/v3/klines', params=payload) + response = requests.get(self.endpoint + self._prefix_address + 'klines', params=payload) self.validate_response(response) @@ -73,10 +73,16 @@ def fetch(self, symbol: str, start_timestamp: int, timeframe: str = '1m') -> Uni } for d in data] def get_available_symbols(self) -> list: - response = requests.get(self.endpoint + '/v3/exchangeInfo') + response = requests.get(self.endpoint + self._prefix_address + 'exchangeInfo') self.validate_response(response) data = response.json() return [jh.dashy_symbol(d['symbol']) for d in data['symbols']] + + @property + def _prefix_address(self): + if self.name.startswith('Binance Perpetual Futures'): + return '/v1/' + return '/v3/'