Guides
Guides

Reverse position

Switch an existing position from long to short or vice versa.

The currency is inherited from the position. The liquidation price (USDT) is recalculated for the reversed direction.

Request

curl -X POST "https://trade.mudrex.com/fapi/v1/futures/positions/{position_id}/reverse" \
  -H "Content-Type: application/json" \
  -H "X-Authentication: your-secret-key"

Parameters

ParameterTypeRequiredDescription
position_idstringYesThe unique identifier of the position (path parameter).

Response

Status: 202 Accepted

{
    "success": true,
    "data": {
        "leverage": "5",
        "amount": "10.00293",
        "quantity": "43.7",
        "price": "0.11445",
        "order_id": "019ecc5b-3649-7e00-9d67-a3c83a97518c",
        "status": "CREATED",
        "message": "OK"
    }
}

Response fields

FieldDescription
order_idUUID of the order created to reverse the position.
leverageLeverage used.
amountMargin used, in the position's currency (INR for INR positions).
quantityQuantity (base asset).
priceExecution price (USDT).
statusStatus (e.g. CREATED).
messageStatus message.

Errors

Common errors

Position not in sync with exchange

{
    "success": false,
    "errors": [
        {
            "code": null,
            "text": "position not in sync with exchange"
        }
    ]
}

Status: 400 Bad Request — the position state on the exchange differs from the local state, preventing the reversal.