User Account
Get Balances
Get Started
Products
Trading Formulas
Rest API
WebSocket API
- WebSocket Connection
- Order Creation
- Order Book
- User Account
- Error Reference
User Account
Get Balances
This is the WebSocket counterpart of the REST endpoint Get Account Balances
{
"message": "balances",
"content": {
"market": "ETH-USD" // optional
}
}
{
"resultType": "balances",
"data": {
"statusCode": 200,
"balances": {
"totalBalance": "99996952.15429778",
"availableBalance": "99521353.92161779",
"deposit": "100000000",
"withdraw": "879.12",
"withdrawFees": "8.88",
"fees": "608.02030021",
"pnl": "-1292.78457349",
"funding": "-259.04082851",
"volume": "608020.300274",
"margin": "7261788.9945241110003337",
"maintenanceMargin": "475598.23267999",
"leverage": "1",
"promoCredit": "0",
"marketBalancesMap": {
"BTC-USD": {
"position": "467782.520726",
"positionQuantity": "7",
"liquidationPrice": "126380.268279734335477455",
"openBuy": "60000",
"openBuyQty": "1",
"openSell": "0",
"openSellQty": "0",
"pnl": "-1292.78457349",
"positionPnl": "-1292.7845734999864",
"funding": "113.21723468000002",
"positionFunding": "113.21723468000002",
"volume": "600695.07832",
"fees": "600.69507826",
"liquidationFees": "0",
"margin": "6498468.2474181248786156",
"maintenanceMargin": "527842.520726"
},
"ETH-USD": {
"position": "28894.648055999998",
"positionQuantity": "8",
"liquidationPrice": "28902.648056",
"openBuy": "0",
"openBuyQty": "0",
"openSell": "8000",
"openSellQty": "3",
"pnl": "406.23975999",
"positionPnl": "406.2397599999995",
"funding": "-486.82005787000037",
"positionFunding": "-486.82005787000037",
"volume": "43545.091964",
"fees": "43.54509196",
"liquidationFees": "0",
"margin": "762320.7471059860003337",
"maintenanceMargin": "28902.648056"
}
}
}
}
}
URL
Unlike other streams, this stream is market agnostic.
Headers
See Authorization section on how to retrieve authorization token. Once token is received, set Sec-WebSocket-Protocol
headers in the WebSocket handshake request or on connect()
.
Example value (authorization token) :
authorization#eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdGFnaW5nLmZ1bmdpYmxlLnh5eiIsInN1YiI6ImQxM2I1MzBmLWFmNzMtNDBmOS04ZjhlLWVkNzk1OTU3YTU3ZiIsImF1ZCI6WyJzdGFnaW5nLWFwcC5mdW5naWJsZS54eXoiXSwiZXhwIjoxNzAzMzA1NzQwLCJpYXQiOjE3MDMzMDM5NDB9.vsHe4G_yEkRfz8XNoTKcX83udA-LUysWD4q80wfCC8k
{
"message": "balances",
"content": {
"market": "ETH-USD" // optional
}
}
{
"resultType": "balances",
"data": {
"statusCode": 200,
"balances": {
"totalBalance": "99996952.15429778",
"availableBalance": "99521353.92161779",
"deposit": "100000000",
"withdraw": "879.12",
"withdrawFees": "8.88",
"fees": "608.02030021",
"pnl": "-1292.78457349",
"funding": "-259.04082851",
"volume": "608020.300274",
"margin": "7261788.9945241110003337",
"maintenanceMargin": "475598.23267999",
"leverage": "1",
"promoCredit": "0",
"marketBalancesMap": {
"BTC-USD": {
"position": "467782.520726",
"positionQuantity": "7",
"liquidationPrice": "126380.268279734335477455",
"openBuy": "60000",
"openBuyQty": "1",
"openSell": "0",
"openSellQty": "0",
"pnl": "-1292.78457349",
"positionPnl": "-1292.7845734999864",
"funding": "113.21723468000002",
"positionFunding": "113.21723468000002",
"volume": "600695.07832",
"fees": "600.69507826",
"liquidationFees": "0",
"margin": "6498468.2474181248786156",
"maintenanceMargin": "527842.520726"
},
"ETH-USD": {
"position": "28894.648055999998",
"positionQuantity": "8",
"liquidationPrice": "28902.648056",
"openBuy": "0",
"openBuyQty": "0",
"openSell": "8000",
"openSellQty": "3",
"pnl": "406.23975999",
"positionPnl": "406.2397599999995",
"funding": "-486.82005787000037",
"positionFunding": "-486.82005787000037",
"volume": "43545.091964",
"fees": "43.54509196",
"liquidationFees": "0",
"margin": "762320.7471059860003337",
"maintenanceMargin": "28902.648056"
}
}
}
}
}
{
"message": "balances",
"content": {
"market": "ETH-USD" // optional
}
}
{
"resultType": "balances",
"data": {
"statusCode": 200,
"balances": {
"totalBalance": "99996952.15429778",
"availableBalance": "99521353.92161779",
"deposit": "100000000",
"withdraw": "879.12",
"withdrawFees": "8.88",
"fees": "608.02030021",
"pnl": "-1292.78457349",
"funding": "-259.04082851",
"volume": "608020.300274",
"margin": "7261788.9945241110003337",
"maintenanceMargin": "475598.23267999",
"leverage": "1",
"promoCredit": "0",
"marketBalancesMap": {
"BTC-USD": {
"position": "467782.520726",
"positionQuantity": "7",
"liquidationPrice": "126380.268279734335477455",
"openBuy": "60000",
"openBuyQty": "1",
"openSell": "0",
"openSellQty": "0",
"pnl": "-1292.78457349",
"positionPnl": "-1292.7845734999864",
"funding": "113.21723468000002",
"positionFunding": "113.21723468000002",
"volume": "600695.07832",
"fees": "600.69507826",
"liquidationFees": "0",
"margin": "6498468.2474181248786156",
"maintenanceMargin": "527842.520726"
},
"ETH-USD": {
"position": "28894.648055999998",
"positionQuantity": "8",
"liquidationPrice": "28902.648056",
"openBuy": "0",
"openBuyQty": "0",
"openSell": "8000",
"openSellQty": "3",
"pnl": "406.23975999",
"positionPnl": "406.2397599999995",
"funding": "-486.82005787000037",
"positionFunding": "-486.82005787000037",
"volume": "43545.091964",
"fees": "43.54509196",
"liquidationFees": "0",
"margin": "762320.7471059860003337",
"maintenanceMargin": "28902.648056"
}
}
}
}
}