Skip to content

Commit

Permalink
fix binance 401
Browse files Browse the repository at this point in the history
  • Loading branch information
saleh-mir committed Oct 15, 2024
1 parent 0c5d47c commit e3a011e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions jesse/modes/import_candles_mode/drivers/Binance/BinanceMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -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/'

0 comments on commit e3a011e

Please sign in to comment.