Closing the long position with Hedge-Mode


How can I close my current “ETHUSDT Long” position with api. Hedge mode is turned on. Can’t close in hedge mode

def close_order(positionSide, side, quantity, symbol):
    order = client.futures_create_order(symbol=symbol,
except Exception as e:
    print("an exception occurred - {}".format(e))
    return False
return True

Is there error message received? Maybe this one can be helpful.


  1. set positionSide to “LONG” to close a “LONG” position
  2. remove closePosition=True, it only works for stop orders
  3. remove “reduceOnly=True”, side=‘SELL’ and positionSide=‘LONG’ already say it

order = client.futures_create_order(symbol=symbol,

an exception occurred - APIError(code=-1106): Parameter 'reduceOnly' sent when not required.

order = client.futures_create_order(symbol=symbol, type=Client.ORDER_TYPE_MARKET, positionSide="SHORT", side="SELL", quantity=quantity, closePosition=True)
an exception occurred - APIError(code=-1128): Combination of optional parameters invalid.

my friend,
I did as you said. The current “LONG” position closes and opens the long position again.

‘SELL’ ‘LONG’ combination would only close positions.
Please confirm you didn’t place another order to ‘BUY’ ‘LONG’
You can also try again and this time print out the return value from client.futures_create_order

OK, now I fixed it.
“Long” = “Sell” thanks

I want to close Long trade (usdt future testnet) , buy I can’t do it.
I wrot this code:

params = {

    "symbol": "BTCUSDT",
    "dualSidePosition": "LONG",
    "timestamp": timestamp

response = send_signed_request(‘POST’, ‘/fapi/v1/positionSide/dual’, params)

error response:
{‘code’: -1102, ‘msg’: “Mandatory parameter ‘dualSidePosition’ was not sent, was empty/null, or malformed.”}

What is wrong ? Where is the problem?

Hello sir, I have a big problem here and hope you can help me

wanna close 20% of my open position " LONG " on “dotusdt” future
My total amount is 4.0

my request is :

symbol = DOTUSDT,
side = OrderSide.SELL,
positionSide = “Long”,
type = LIMIT,
Price = 22.00,
Quantity = 0.60

wanna do it with limit order
and I got this error : Exception: {“code”:-1111,“msg”:“Precision is over the maximum defined for this asset.”}

i’m using HEDGE MODE
so any trick how to do it !

Wrong endpoint, should be /fapi/v1/order

this endpoint is for adjust the position mode, only dualSidePosition is allowed, please check the document for details,