Getting an Error of "BinanceAPIException: APIError(code=-1121): Invalid symbol" on a specific symbol only.

Hello, I’m running a python script for a list of symbols and I have encountered a problem on a specific asset (DEFIUSDT).

The code below shows an error of:
BinanceAPIException: APIError(code=-1121): Invalid symbol.

symbol = 'DEFIUSDT'
avg_price = client.get_avg_price(symbol=symbol)

I also tried retrieving the symbol info, but it only returns a NoneType object.

info = client.get_symbol_info(symbol=symbol)

However, I can retrieve historical klines with the given symbol (DEFIUSDT).

Is it an API problem or there is something wrong in my code/system. I have tried on different symbols and it works just fine.

Which exchange API are you using? SPOT, USD-M Futures or COIN-M Futures?

I’m using Futures API.
I have edited the category as it was stated as SPOT API before.
My apologies.

EDIT:

I think I see the problem now, and please correct me if I’m wrong.

There is no symbol of ‘DEFIUSDT’ in the SPOT API and since the following:
client.get_avg_price
client.get_symbol_info
only checks SPOT symbols.

I guess I need to find a workaround to get the avg price of Futures Specific symbols.

That’s correct.

1 Like