Skip to main content

Get Portfolio Margin Info

Query portfolio margin account balance and asset P&L range information. The data returned by this endpoint is consistent with what is displayed on the web page.

HTTP Request

GET/v5/asset/portfolio-margin

Request Parameters

ParameterRequiredTypeComments
baseCoinfalsestringBase coin, e.g. BTC, ETH. Returns all if not passed

Response Parameters

ParameterTypeComments
walletobjectWallet info
> equitystringEquity
> cashBalancestringCash balance
> marginBalancestringMargin balance
> availableBalancestringAvailable balance
> accountIMstringAccount initial margin
> accountMMstringAccount maintenance margin
> accountMMRatestringAccount maintenance margin rate
> accountIMRatestringAccount initial margin rate
assetPnlRangearrayAsset P&L range list
> baseCoinstringBase coin, e.g. BTC
> totalPnlRangesobjectAggregated P&L ranges by contract type
>> ALLobjectCombined P&L range across all contract types
>> PERPETUALobjectP&L range for perpetual positions
>> OPTIONobjectP&L range for option positions
>>> pnlRangesarrayP&L range data points
>>>> priceScalestringPrice change scale, e.g. -0.1 means -10%
>>>> pnlsarrayP&L values at this price scale
> perpPositionPnlRangesarrayP&L ranges per perpetual position
>> symbolNamestringSymbol name
>> positionstringPosition size
>> pnlRangesarrayP&L range data points (same structure as above)
>> sessionAvgPricestringSession average price
>> markPricestringMark price
>> orderSizestringOpen order size
>> contractTypeintegerContract type
>> settleCoinstringSettlement coin
>> symbolAliasstringSymbol alias
> optionExpiryDatePnlRangesarrayP&L ranges grouped by option expiry date
>> expiryDateRepresentationstringExpiry date, e.g. 25SEP26
>> pnlRangesarrayP&L range data points. Each pnls array contains values for multiple IV shock scenarios
>> optionPositionPnlRangesarrayP&L ranges per option position
>>> symbolNamestringOption symbol name
>>> positionstringPosition size
>>> pnlRangesarrayP&L range data points
>>> sessionAvgPricestringSession average price
>>> markPricestringMark price
>>> orderSizestringOpen order size
>>> contractTypeintegerContract type
>>> settleCoinstringSettlement coin
> contingencyobjectContingency margin info
>> optionContingencystringOption contingency
>> futureDeltaContingencystringFuture delta contingency
>> optionVegaContingencystringOption vega contingency
>> contingencyComponentsstringTotal contingency components
>> usdtUsdcContingencystringUSDT/USDC contingency
>> futureContingencystringFuture contingency
> assetobjectAsset margin info
>> coinstringCoin
>> assetIMstringAsset initial margin
>> assetMMstringAsset maintenance margin
> maxLossPriceMovestringMax loss price move scenario
> maxLossIvShockstringMax loss IV shock scenario
> totalClosePzFeestringTotal close position fee
> spotHedgeInfoobjectSpot hedge info
>> hedgeSpotSizestringHedge spot size
>> walletBalancestringSpot wallet balance
>> usdIndexPricestringUSD index price
>> pnlRangesarrayP&L range data points for spot hedge
> maxLossIvShockListarrayIV shock values corresponding to each price scale scenario

Request Example

GET /v5/asset/portfolio-margin?baseCoin=BTC HTTP/1.1
Host: api.bybit.com
X-BAPI-SIGN: XXXXXX
X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx
X-BAPI-TIMESTAMP: 1773230920000
X-BAPI-RECV-WINDOW: 5000

Response Example

{
"retCode": 0,
"retMsg": "Success",
"result": {
"wallet": {
"equity": "52197.86892104",
"cashBalance": "45391.74423708",
"marginBalance": "52145.70917115",
"availableBalance": "50893.36062347",
"accountIM": "1304.50829757",
"accountMM": "1069.93399838",
"accountMMRate": "0.0204",
"accountIMRate": "0.0249"
},
"assetPnlRange": [
{
"baseCoin": "BTC",
"totalPnlRanges": {
"ALL": {
"pnlRanges": [
{"priceScale": "-0.1", "pnls": ["-1004.74710000"]},
{"priceScale": "-0.08", "pnls": ["-807.88000000"]},
{"priceScale": "-0.06", "pnls": ["-610.19020000"]},
{"priceScale": "-0.04", "pnls": ["-411.59200000"]},
{"priceScale": "-0.02", "pnls": ["-212.00760000"]},
{"priceScale": "0.0", "pnls": ["-11.36910000"]},
{"priceScale": "0.02", "pnls": ["191.78950000"]},
{"priceScale": "0.04", "pnls": ["396.10080000"]},
{"priceScale": "0.06", "pnls": ["601.59360000"]},
{"priceScale": "0.08", "pnls": ["808.28220000"]},
{"priceScale": "0.1", "pnls": ["1016.16720000"]}
]
},
"PERPETUAL": {
"pnlRanges": [
{"priceScale": "-0.1", "pnls": ["-972.14482880"]},
{"priceScale": "-0.08", "pnls": ["-777.71586304"]},
{"priceScale": "-0.06", "pnls": ["-583.28689728"]},
{"priceScale": "-0.04", "pnls": ["-388.85793152"]},
{"priceScale": "-0.02", "pnls": ["-194.42896576"]},
{"priceScale": "0.0", "pnls": ["0.00000000"]},
{"priceScale": "0.02", "pnls": ["194.42896576"]},
{"priceScale": "0.04", "pnls": ["388.85793152"]},
{"priceScale": "0.06", "pnls": ["583.28689728"]},
{"priceScale": "0.08", "pnls": ["777.71586304"]},
{"priceScale": "0.1", "pnls": ["972.14482880"]}
]
},
"OPTION": {
"pnlRanges": [
{"priceScale": "-0.1", "pnls": ["-39.65273684"]},
{"priceScale": "-0.08", "pnls": ["-35.80450518"]},
{"priceScale": "-0.06", "pnls": ["-31.13352117"]},
{"priceScale": "-0.04", "pnls": ["-25.55420042"]},
{"priceScale": "-0.02", "pnls": ["-18.98866670"]},
{"priceScale": "0.0", "pnls": ["-11.36906857"]},
{"priceScale": "0.02", "pnls": ["-2.63944748"]},
{"priceScale": "0.04", "pnls": ["7.24291762"]},
{"priceScale": "0.06", "pnls": ["18.30672359"]},
{"priceScale": "0.08", "pnls": ["30.56641060"]},
{"priceScale": "0.1", "pnls": ["44.02244694"]}
]
}
},
"perpPositionPnlRanges": [
{
"symbolName": "BTCUSDT",
"position": "0.038",
"pnlRanges": [
{"priceScale": "-0.1", "pnls": ["-972.14482880"]},
{"priceScale": "-0.08", "pnls": ["-777.71586304"]},
{"priceScale": "-0.06", "pnls": ["-583.28689728"]},
{"priceScale": "-0.04", "pnls": ["-388.85793152"]},
{"priceScale": "-0.02", "pnls": ["-194.42896576"]},
{"priceScale": "0.0", "pnls": ["0.00000000"]},
{"priceScale": "0.02", "pnls": ["194.42896576"]},
{"priceScale": "0.04", "pnls": ["388.85793152"]},
{"priceScale": "0.06", "pnls": ["583.28689728"]},
{"priceScale": "0.08", "pnls": ["777.71586304"]},
{"priceScale": "0.1", "pnls": ["972.14482880"]}
],
"sessionAvgPrice": "75995.4295",
"markPrice": "255902.31000000",
"orderSize": "0.0",
"contractType": 2,
"settleCoin": "USDT",
"symbolAlias": "BTCUSDT"
}
],
"optionExpiryDatePnlRanges": [
{
"expiryDateRepresentation": "25SEP26",
"pnlRanges": [
{"priceScale": "-0.1", "pnls": ["-24.06747339", "-33.15841013", "-39.65273684"]},
{"priceScale": "-0.08", "pnls": ["-18.12509537", "-28.31048642", "-35.80450518"]},
{"priceScale": "-0.06", "pnls": ["-11.36193138", "-22.62748031", "-31.13352117"]},
{"priceScale": "-0.04", "pnls": ["-3.73852526", "-16.04846592", "-25.55420042"]},
{"priceScale": "-0.02", "pnls": ["4.77766694", "-8.52041879", "-18.98866670"]},
{"priceScale": "0.0", "pnls": ["14.21190294", "0.00067229", "-11.36906857"]},
{"priceScale": "0.02", "pnls": ["24.58198339", "9.54902598", "-2.63944748"]},
{"priceScale": "0.04", "pnls": ["35.89827143", "20.14862960", "7.24291762"]},
{"priceScale": "0.06", "pnls": ["48.16388381", "31.81313064", "18.30672359"]},
{"priceScale": "0.08", "pnls": ["61.37503018", "44.54603289", "30.56641060"]},
{"priceScale": "0.1", "pnls": ["75.52147477", "58.34116026", "44.02244694"]}
],
"optionPositionPnlRanges": [
{
"symbolName": "BTC-25SEP26-80000-C-USDT",
"position": "0.02",
"pnlRanges": [
{"priceScale": "-0.1", "pnls": ["-24.06747339", "-33.15841013", "-39.65273684"]},
{"priceScale": "-0.08", "pnls": ["-18.12509537", "-28.31048642", "-35.80450518"]},
{"priceScale": "-0.06", "pnls": ["-11.36193138", "-22.62748031", "-31.13352117"]},
{"priceScale": "-0.04", "pnls": ["-3.73852526", "-16.04846592", "-25.55420042"]},
{"priceScale": "-0.02", "pnls": ["4.77766694", "-8.52041879", "-18.98866670"]},
{"priceScale": "0.0", "pnls": ["14.21190294", "0.00067229", "-11.36906857"]},
{"priceScale": "0.02", "pnls": ["24.58198339", "9.54902598", "-2.63944748"]},
{"priceScale": "0.04", "pnls": ["35.89827143", "20.14862960", "7.24291762"]},
{"priceScale": "0.06", "pnls": ["48.16388381", "31.81313064", "18.30672359"]},
{"priceScale": "0.08", "pnls": ["61.37503018", "44.54603289", "30.56641060"]},
{"priceScale": "0.1", "pnls": ["75.52147477", "58.34116026", "44.02244694"]}
],
"sessionAvgPrice": "0",
"markPrice": "2608.56395729",
"orderSize": "0.0",
"contractType": 5,
"settleCoin": "USDT"
}
]
}
],
"contingency": {
"optionContingency": "0.00000000",
"futureDeltaContingency": "56.89174177",
"optionVegaContingency": "0.00000000",
"contingencyComponents": "57.69544638",
"usdtUsdcContingency": "0.00000000",
"futureContingency": "0.80370460"
},
"asset": {
"coin": "BTC",
"assetIM": "1274.8190514137673",
"assetMM": "1062.3492095114727"
},
"maxLossPriceMove": "-0.1",
"maxLossIvShock": "-0.2",
"totalClosePzFee": "-0.2",
"spotHedgeInfo": {
"hedgeSpotSize": "-0.00100006",
"walletBalance": "-0.00000007",
"usdIndexPrice": "0",
"pnlRanges": [
{"priceScale": "-0.1", "pnls": ["7.05047869"]},
{"priceScale": "-0.08", "pnls": ["5.64038295"]},
{"priceScale": "-0.06", "pnls": ["4.23028721"]},
{"priceScale": "-0.04", "pnls": ["2.82019147"]},
{"priceScale": "-0.02", "pnls": ["1.41009574"]},
{"priceScale": "0.0", "pnls": ["0"]},
{"priceScale": "0.02", "pnls": ["0"]},
{"priceScale": "0.04", "pnls": ["0"]},
{"priceScale": "0.06", "pnls": ["0"]},
{"priceScale": "0.08", "pnls": ["0"]},
{"priceScale": "0.1", "pnls": ["0"]}
]
},
"maxLossIvShockList": ["-0.2", "-0.2", "-0.2", "-0.2", "-0.2", "-0.2", "-0.2", "-0.2", "-0.2", "-0.2", "-0.2"]
}
]
},
"retExtInfo": {},
"time": 1774319290506
}