Err0rBlade
Err0rBlade

Reputation: 43

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.

Upvotes: 3

Views: 3199

Answers (2)

clara savelli
clara savelli

Reputation: 32

two things can happen

  1. client.API_URL = https://testnet.binance.vision/api

in that case change it to

https://api.binance.com/api

  1. Client(api_key, secret_key, testnet=True)

in that case change testnet=False or delete it

Upvotes: 1

Damian Games
Damian Games

Reputation: 56

Are you using the testnet? I had the same error, however when I removed testnet=True from the client initialization the error was resolved.

Upvotes: 3

Related Questions