Futures Order

How to place limit or market order on Binance Futures with python. I can at Spot but at Futures not

Suggest you read this - https://binance-docs.github.io/apidocs/futures/en/#change-log; After you’re familiar with the API usage, you can find some 3rd-party SDK for futures trading. You need to use it at your own discretion as it’s 3rd-party.

I’ve read the documentation, but the code I use to place orders at Futures only gives an error:
client.futures_create_order (symbol = ‘BNBUSDT’, side = ‘BUY’, type = ‘LIMIT’, timeInForce = ‘GTC’, quantity = 0.22, price = 394.233)


Traceback (most recent call last):
File “c:\Users\Airla\Documents\Robô cripto\teste de robo.py”, line 19, in
client.futures_create_order(symbol=‘BNBUSDT’, side=‘BUY’, type=‘LIMIT’, timeInForce=‘GTC’, quantity=0.22, price=394.233)
File “C:\Users\Airla\AppData\Local\Programs\Python\Python39\lib\site-packages\binance\client.py”, line 4966, in futures_create_order
return self._request_futures_api(‘post’, ‘order’, True, data=params)
File “C:\Users\Airla\AppData\Local\Programs\Python\Python39\lib\site-packages\binance\client.py”, line 222, in _request_futures_api
return self._request(method, uri, signed, True, **kwargs)
File “C:\Users\Airla\AppData\Local\Programs\Python\Python39\lib\site-packages\binance\client.py”, line 197, in _request
return self._handle_response()
File “C:\Users\Airla\AppData\Local\Programs\Python\Python39\lib\site-packages\binance\client.py”, line 230, in _handle_response
raise BinanceAPIException(self.response)
binance.exceptions.BinanceAPIException: APIError(code=-4061): Order’s position side does not match user’s setting.

When creating an order in futures (https://binance-docs.github.io/apidocs/futures/en/#new-order-trade), there’s a parameter named “positionSide” that by default is set to be BOTH (One-way mode).

The source code of “client.futures_create_order” might be changing the “positionSide” or not, at any case, the “positionSide” that is sent is not matching what is set in your account for this symbol’s mode, so you need to change it. More details: Enable Hedge Mode on Futures API