Skip to main content

Add Or Reduce Margin

Manually add or reduce margin for isolated margin position

Unified account covers: USDT perpetual / USDC perpetual / USDC futures / Inverse contract
Classic account covers: USDT perpetual / Inverse contract

HTTP Request

POST /v5/position/add-margin

Request Parameters

ParameterRequiredTypeComments
categorytruestringProduct type
  • Unified account: linear, inverse
  • Classic account: linear, inverse
symboltruestringSymbol name
margintruestringAdd or reduce. To add, then 10; To reduce, then -10. Support up to 4 decimal
positionIdxfalseintegerUsed to identify positions in different position modes. For hedge mode position, this param is required
  • 0: one-way mode
  • 1: hedge-mode Buy side
  • 2: hedge-mode Sell side

Response Parameters

ParameterTypeComments
categorystringProduct type
symbolstringSymbol name
positionIdxintegerPosition idx, used to identify positions in different position modes
  • 0: One-Way Mode
  • 1: Buy side of both side mode
  • 2: Sell side of both side mode
riskIdintegerRisk limit ID
riskLimitValuestringRisk limit value
sizestringPosition size
avgPricestringAverage entry price
liqPricestringLiquidation price
bustPricestringBankruptcy price
markPricestringLast mark price
positionValuestringPosition value
leveragestringPosition leverage
autoAddMarginintegerWhether to add margin automatically. 0: false, 1: true
positionStatusStringPosition status. Normal, Liq, Adl
positionIMstringInitial margin
positionMMstringMaintenance margin
takeProfitstringTake profit price
stopLossstringStop loss price
trailingStopstringTrailing stop (The distance from market price)
unrealisedPnlstringUnrealised PnL
cumRealisedPnlstringCumulative realised pnl
createdTimestringTimestamp of the first time a position was created on this symbol (ms)
updatedTimestringPosition updated timestamp (ms)

Request Example

POST /v5/position/add-margin HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN: XXXXXX
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1684234363665
X-BAPI-RECV-WINDOW: 5000
Content-Type: application/json
Content-Length: 97

{
"category": "inverse",
"symbol": "ETHUSD",
"margin": "0.01",
"positionIdx": 0
}

Response Example

{
"retCode": 0,
"retMsg": "OK",
"result": {
"category": "inverse",
"symbol": "ETHUSD",
"positionIdx": 0,
"riskId": 11,
"riskLimitValue": "500",
"size": "200",
"positionValue": "0.11033265",
"avgPrice": "1812.70004844",
"liqPrice": "1550.80",
"bustPrice": "1544.20",
"markPrice": "1812.90",
"leverage": "12",
"autoAddMargin": 0,
"positionStatus": "Normal",
"positionIM": "0.01926611",
"positionMM": "0",
"unrealisedPnl": "0.00001217",
"cumRealisedPnl": "-0.04618929",
"stopLoss": "0.00",
"takeProfit": "0.00",
"trailingStop": "0.00",
"createdTime": "1672737740039",
"updatedTime": "1684234363788"
},
"retExtInfo": {},
"time": 1684234363789
}