查詢賬戶所有幣種余額
支持查詢母帳戶的各個帳戶類型的幣種餘額,以及母帳戶下各子帳戶的各個帳戶類型的幣種餘額。
HTTP 請求
GET /v5/asset/transfer/query-account-coins-balance
請求參數
參數 | 是否必須 | 類型 | 說明 |
---|---|---|---|
memberId | false | string | 用戶ID. 當使用母帳號api key查詢子帳戶的幣種餘額時,該字段必傳 |
accountType | true | string | 賬戶類型 |
coin | false | string | 幣種類型 |
withBonus | false | integer | 是否查詢體驗金. 0 (默認):不查詢; 1 :查詢 |
返回參數
參數 | 類型 | 說明 |
---|---|---|
accountType | string | 賬戶類型 |
memberId | string | 用戶ID |
balance | Object | |
> coin | string | 幣種類型 |
> walletBalance | string | 錢包余額 |
> transferBalance | string | 可划余額 |
> bonus | string | 体验金 |
請求示例
- HTTP
- Python
- Node.js
GET /v5/asset/transfer/query-account-coins-balance?accountType=FUND&coin=USDC HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN: XXXXX
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1675866354698
X-BAPI-RECV-WINDOW: 5000
from pybit.unified_trading import HTTP
session = HTTP(
testnet=True,
api_key="XXXXX",
api_secret="XXXXX",
)
print(session.get_coins_balance(
accountType="FUND",
coin="USDC",
))
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'apikey',
secret: 'apisecret',
});
client
.getAllCoinsBalance({ accountType: 'FUND', coin: 'USDC' })
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
響應示例
{
"retCode": 0,
"retMsg": "success",
"result": {
"memberId": "533285",
"accountType": "FUND",
"balance": [
{
"coin": "USDT",
"transferBalance": "1010",
"walletBalance": "1010",
"bonus": ""
},
{
"coin": "USDC",
"transferBalance": "0",
"walletBalance": "0",
"bonus": ""
}
]
},
"retExtInfo": {},
"time": 1675865290069
}