Doubts when placing an order with Python

Hello friends, I’m new to the forum, and I come to ask for your wisdom hehe. Thanks in advance.

I want to place an order in futures using Python. Currently, I tried creating some functions to get the price, adjust the leverage, and retrieve token information in futures. However, when trying to place an order, it returns an error.

binance.exceptions.BinanceAPIException: APIError(code=-1121): Invalid symbol.

My question is, when querying the token information from my function:

get_symbol_data('BTCUSDT')
{
  "symbol": "BTCUSDT",
  "pair": "BTCUSDT",
  "contractType": "PERPETUAL",
  "deliveryDate": 4133404802000,
  "onboardDate": 1569398400000,
  "status": "TRADING",
  "maintMarginPercent": "2.5000",
  "requiredMarginPercent": "5.0000",
  "baseAsset": "BTC",
  "quoteAsset": "USDT",
  "marginAsset": "USDT",
  "pricePrecision": 2,
  "quantityPrecision": 3,
  "baseAssetPrecision": 8,
  "quotePrecision": 8,
  "underlyingType": "COIN",
  "underlyingSubType": [],
  "settlePlan": 0,
  "triggerProtect": "0.0500",
  "liquidationFee": "0.020000",
  "marketTakeBound": "0.30",
  "maxMoveOrderLimit": 100,
  "filters": [
    {
      "tickSize": "0.10",
      "maxPrice": "926045.20",
      "filterType": "PRICE_FILTER",
      "minPrice": "298.70"
    },
    {
      "stepSize": "0.001",
      "maxQty": "1000.000",
      "minQty": "0.001",
      "filterType": "LOT_SIZE"
    },
    {
      "stepSize": "0.001",
      "filterType": "MARKET_LOT_SIZE",
      "minQty": "0.001",
      "maxQty": "1000.000"
    },
    {
      "filterType": "MAX_NUM_ORDERS",
      "limit": 200
    },
    {
      "limit": 10,
      "filterType": "MAX_NUM_ALGO_ORDERS"
    },
    {
      "filterType": "MIN_NOTIONAL",
      "notional": "5"
    },
    {
      "filterType": "PERCENT_PRICE",
      "multiplierDecimal": "4",
      "multiplierUp": "1.1000",
      "multiplierDown": "0.5454"
    }
  ],
  "orderTypes": [
    "LIMIT",
    "MARKET",
    "STOP",
    "STOP_MARKET",
    "TAKE_PROFIT",
    "TAKE_PROFIT_MARKET",
    "TRAILING_STOP_MARKET"
  ],
  "timeInForce": [
    "GTC",
    "IOC",
    "FOK",
    "GTX"
  ]
}

That is supposed to be the symbol for Binance Futures USD-M Futures.

Why am I getting this error when trying to place an order?

order = client.futures_coin_create_order(
    symbol=symbol,
    side=Client.SIDE_BUY,
    type=Client.ORDER_TYPE_MARKET,
    quantity=quantity)

return: binance.exceptions.BinanceAPIException: APIError(code=-1121): Invalid symbol. 

It doesn’t make sense to me, or am I doing something wrong? This is my configuration:

api_key = os.environ['BINANCE_API_KEY']
api_secret = os.environ['BINANCE_API_SECRET']
client = Client(api_key, api_secret, testnet=False)

symbol = 'BTCUSDT'

Debug or print the final request URL in query string to double check what’s actually send to the server, mainly in the symbol parameter. Sometimes, code can do some formatting that you’re unaware and change the final request.

thanks!!

I enabled the debug and I was able to find the problem, thanks for your help, the problem was in the method I used to create the order, the correct one is: order = client.futures_create_order(