Get Wallet Balance
Obtain wallet balance, query asset information of each currency, and account risk rate information. By default, currency information with assets or liabilities of 0 is not returned.
tip
- The trading of UTA inverse contracts is conducted through the CONTRACT wallet.
- To get Funding wallet balance, please go to this endpoint
HTTP Request
GET /v5/account/wallet-balance
Request Parameters
Parameter | Required | Type | Comments |
---|---|---|---|
accountType | true | string | Account type
|
coin | false | string | Coin name
|
Response Parameters
Parameter | Type | Comments |
---|---|---|
list | array | Object |
> accountType | string | Account type |
> accountLTV | string | This field has been depreciated |
> accountIMRate | string | Initial Margin Rate: Account Total Initial Margin Base Coin / Account Margin Balance Base Coin. In non-unified mode & unified (inverse) & unified (isolated_margin), the field will be returned as an empty string. |
> accountMMRate | string | Maintenance Margin Rate: Account Total Maintenance Margin Base Coin / Account Margin Balance Base Coin. In non-unified mode & unified (inverse) & unified (isolated_margin), the field will be returned as an empty string. |
> totalEquity | string | Total Equity is calculated by adding the fiat currency valuation of the equity of each coin in your account. In non-unified mode & unified (inverse), the field will be returned as an empty string. |
> totalWalletBalance | string | Wallet Balance of account converted to usd:∑ Asset Wallet Balance By USD value of each asset。In non-unified mode & unified (inverse) & unified (isolated_margin), the field will be returned as an empty string. |
> totalMarginBalance | string | Margin Balance of account converted to usd:totalWalletBalance + totalPerpUPL. In non-unified mode & unified (inverse) & unified (isolated_margin), the field will be returned as an empty string. |
> totalAvailableBalance | string | Available Balance of account converted to usd:Regular mode:totalMarginBalance - totalInitialMargin. In non-unified mode & unified (inverse) & unified (isolated_margin), the field will be returned as an empty string. |
> totalPerpUPL | string | Unrealised P&L of Perpetuals and USDC Futures of account converted to usd:∑ Each Perp and USDC Futures upl by base coin. In non-unified mode & unified (inverse), the field will be returned as an empty string. |
> totalInitialMargin | string | Initial Margin of account converted to usd:∑ Asset Total Initial Margin Base Coin. In non-unified mode & unified (inverse) & unified (isolated_margin), the field will be returned as an empty string. |
> totalMaintenanceMargin | string | Maintenance Margin of account converted to usd: ∑ Asset Total Maintenance Margin Base Coin. In non-unified mode & unified (inverse) & unified (isolated_margin), the field will be returned as an empty string. |
> coin | array | Object |
>> coin | string | Coin name, such as BTC, ETH, USDT, USDC |
>> equity | string | Equity of current coin |
>> usdValue | string | USD value of current coin |
>> walletBalance | string | Wallet balance of current coin |
>> free | string | Available balance for Spot wallet. This is a unique field for Classic SPOT |
>> locked | string | Locked balance due to the Spot open order |
>> spotHedgingQty | string | The spot asset qty that is used to hedge in the portfolio margin, truncate to 8 decimals and "0" by default This is a unique field for Unified account |
>> borrowAmount | string | Borrow amount of current coin |
>> availableToBorrow | string | Depreciated field, always return "" due to feature of main-sub UID sharing borrow quota. Please refer to availableToBorrow in the Get Collateral Info |
>> availableToWithdraw | string | Available amount to withdraw of current coin |
>> accruedInterest | string | Accrued interest |
>> totalOrderIM | string | Pre-occupied margin for order. For portfolio margin mode, it returns "" |
>> totalPositionIM | string | Sum of initial margin of all positions + Pre-occupied liquidation fee. For portfolio margin mode, it returns "" |
>> totalPositionMM | string | Sum of maintenance margin for all positions. For portfolio margin mode, it returns "" |
>> unrealisedPnl | string | Unrealised P&L |
>> cumRealisedPnl | string | Cumulative Realised P&L |
>> bonus | string | Bonus. This is a unique field for UNIFIED account |
>> marginCollateral | boolean | Whether it can be used as a margin collateral currency (platform), true : YES, false : NO |
>> collateralSwitch | boolean | Whether the collateral is turned on by user (user), true : ON, false : OFF |
Request Example
- HTTP
- Python
GET /v5/account/wallet-balance?accountType=UNIFIED&coin=BTC HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN: XXXXX
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1672125440406
X-BAPI-RECV-WINDOW: 5000
from pybit.unified_trading import HTTP
session = HTTP(
testnet=True,
api_key="XXXXX",
api_secret="XXXXX",
)
print(session.get_wallet_balance(
accountType="UNIFIED",
coin="BTC",
))
Response Example
{
"retCode": 0,
"retMsg": "OK",
"result": {
"list": [
{
"totalEquity": "3.31216591",
"accountIMRate": "0",
"totalMarginBalance": "3.00326056",
"totalInitialMargin": "0",
"accountType": "UNIFIED",
"totalAvailableBalance": "3.00326056",
"accountMMRate": "0",
"totalPerpUPL": "0",
"totalWalletBalance": "3.00326056",
"accountLTV": "0",
"totalMaintenanceMargin": "0",
"coin": [
{
"availableToBorrow": "3",
"bonus": "0",
"accruedInterest": "0",
"availableToWithdraw": "0",
"totalOrderIM": "0",
"equity": "0",
"totalPositionMM": "0",
"usdValue": "0",
"spotHedgingQty": "0.01592413",
"unrealisedPnl": "0",
"collateralSwitch": true,
"borrowAmount": "0.0",
"totalPositionIM": "0",
"walletBalance": "0",
"cumRealisedPnl": "0",
"locked": "0",
"marginCollateral": true,
"coin": "BTC"
}
]
}
]
},
"retExtInfo": {},
"time": 1690872862481
}