Add/Reduce Margin
Add or reduce margin for an existing position to adjust liquidation price.
Add or reduce isolated margin on an open position. margin is in the position's currency, taken from the position. The response returns trade_currency.
Request
# Add margin
curl -X POST "https://trade.mudrex.com/fapi/v1/futures/positions/{position_id}/add-margin" \
-H "Content-Type: application/json" \
-H "X-Authentication: your-secret-key" \
-d '{"margin": 50}'# Reduce margin
curl -X POST "https://trade.mudrex.com/fapi/v1/futures/positions/{position_id}/add-margin" \
-H "Content-Type: application/json" \
-H "X-Authentication: your-secret-key" \
-d '{"margin": -20}'Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
position_id | string | Yes | The unique identifier of the position (path parameter). |
margin | float | Yes | Amount to add (positive) or reduce (negative), in the position currency. |
Response
Status: 200 OK
Add (margin: 50, INR position):
{
"success": true,
"data": {
"message": "OK",
"initial_margin": "166.57",
"liquidation_price": "0.12114",
"trade_currency": "INR"
}
}Reduce (margin: -20, INR position):
{
"success": true,
"data": {
"message": "OK",
"initial_margin": "146.57",
"liquidation_price": "0.1179",
"trade_currency": "INR"
}
}Response fields
| Field | Description |
|---|---|
message | Status message. |
initial_margin | Updated initial margin of the position, in trade_currency. |
liquidation_price | Updated liquidation price of the position (USDT). |
trade_currency | Currency of the position: USDT or INR. |
Errors
Common errors
Position not found
{
"success": false,
"errors": [
{ "code": 404, "text": "Position not found" }
]
}Status: 404 Not Found
| HTTP | Error text | Meaning |
|---|---|---|
| 400 | margin is required | margin is 0. |
| 400 | margin less than required margin | Reduction takes the margin below the initial margin required at the position's leverage. |
| 400 | margin cannot be greater than max margin | margin exceeds the margin that can be added. |
Reduction below required margin
{
"success": false,
"errors": [
{ "code": 400, "text": "margin less than required margin" }
]
}Status: 400 Bad Request
Notes
- Margin cannot be reduced below the initial margin required at the position's leverage. A position with no added margin rejects any negative
margin. liquidation_priceis rounded to the asset's price step. Preview a change without applying it with Liquidation price andext_margin.
Updated about 1 month ago
Did this page help you?
