Search code examples
pythonalgorithmic-tradingbinancecryptocurrencybinance-api-client

Binance Spot Test Network. Error when trying to reach Testnet account balances


I am trying to test a bot on the Spot Test Network but when I try to do acc = client.get_account() to access some account info that is needed it raises the following error APIError(code=-2015): Invalid API-key, IP, or permissions for action. I have tried finding a solution but can't find anything besides a step i dindn't do from the tutorial on the Binance Spot Test Network

the step says:

Follow the official Spot API Key documentation to replace the API endpoint URLs with the following values:

https://api.binance.com/api --> https://testnet.binance.vision/api

wss://stream.binance.com:9443/ws --> wss://testnet.binance.vision/ws

wss://stream.binance.com:9443/stream --> wss://testnet.binance.vision/stream

When I look in the documentation I cant find anything that would help with this problem. I am not sure this is the solution but it is the only thing I could find on it.


Solution

  • In case you are using the python-binance library, see the documentation here for switching to the Testnet:

    https://python-binance.readthedocs.io/en/latest/overview.html#using-the-spot-futures-or-vanilla-options-testnet