'Binance API in python APIError(code=-1121): Invalid symbol
I am trying to code a binance Buy function. However the code
from binance.enums import *
order = client.create_order(symbol='DOGEUSDT', side = 'BUY', type = 'MARKET', quantity = 475, timeInForce='GTC')
this code outputs > APIError(code=-1121): Invalid symbol.
Also, for the same symbol,
print(client.get_symbol_info(symbol="DOGEUSDT"))
ouptuts > None
The symbol DOGEUSDT exists is the orderbook. https://api.binance.com/api/v3/ticker/bookTicker I dont know why the same symbol I get from binance is invalid.
Solution 1:[1]
Are you using the testnet? I had the same error, however when I removed testnet=True from the client initialization the error was resolved.
Solution 2:[2]
two things can happen
- client.API_URL = https://testnet.binance.vision/api
in that case change it to
- Client(api_key, secret_key, testnet=True)
in that case change testnet=False or delete it
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Damian Games |
| Solution 2 | clara savelli |
