Guides
Guides

Partial Close

Close a portion of an open position without exiting entirely.

quantity is in the base asset and must be less than the total position quantity. The currency is inherited from the position.

Request

# MARKET
curl -X POST "https://trade.mudrex.com/fapi/v1/futures/positions/{position_id}/close/partial" \
  -H "Content-Type: application/json" \
  -H "X-Authentication: your-secret-key" \
  -d '{
    "order_type": "MARKET",
    "quantity": "0.1",
    "client_order_id": "my-partial-123"
  }'
# LIMIT
curl -X POST "https://trade.mudrex.com/fapi/v1/futures/positions/{position_id}/close/partial" \
  -H "Content-Type: application/json" \
  -H "X-Authentication: your-secret-key" \
  -d '{
    "order_type": "LIMIT",
    "quantity": "0.01",
    "limit_price": "102.75"
  }'

Parameters

ParameterTypeRequiredDescription
position_idstringYesThe unique identifier of the position (path parameter).
order_typestringYesOrder type: LIMIT or MARKET.
quantitystringYesQuantity to close (base asset; less than the total position quantity).
limit_pricestringConditionalRequired if order_type is LIMIT. USDT price.
client_order_idstringNoOptional client id for the partial-close order.

Response

Status: 200 OK

{
    "success": true,
    "data": {
        "order_id": "01a0f1ca-e9ac-7ed4-8dd0-86098e4c445e",
        "position_id": "01a0f1ca-8e83-7c9f-b3e6-d51b34cba2e3",
        "quantity": "4"
    }
}

Response fields

FieldDescription
order_idUUID of the partial close order.
position_idPosition UUID (same as the path parameter).
quantityQuantity to close (base asset).

The response is returned before the order fills and does not include PnL. The realised PnL is on the PARTIAL row in Position history with the same order_id.

Errors

❕Common errors

Position is not open

{
    "success": false,
    "errors": [
        {
            "code": 400,
            "text": "position is not open"
        }
    ]
}

Status: 400 Bad Request


Did this page help you?