HomeDocumentationAPI Reference
Log In
API Reference

(Subaccount Id) Balances

Channel Name Schema

{subaccount_id}.balances

Subscribe to changes in user's positions for a given subaccount ID.

For perpetuals, additional balance updates are emitted under the name Q-{ccy}-PERP where Q stands for "quote".
This balance is a proxy for an on-chain state of lastMarkPrice.
Because of a synchronization lag with the on-chain state, the orderbook instead keeps track of a running total cost of perpetual trades,

For example:
Q-ETH-PERP balance of $6,600 and an ETH-PERP balance of 3 means the lastMarkPrice state is estimated to be $2,200.

Channel Parameters

subaccount_idintegerrequired
Subaccount ID

Notification Data

channelstringrequired
Subscribed channel name
dataarray of objectsrequired
data[].namestringrequired
Name of colletaral asset or instrument
data[].new_balancestringrequired
Balance after update
data[].previous_balancestringrequired
Balance before update
data[].update_typestringrequired
Type of transaction
enum tradeasset_depositasset_withdrawaltransfersubaccount_depositsubaccount_withdrawalliquidationliquidatoronchain_drift_fixperp_settlementoption_settlementinterest_accrualonchain_revertdouble_revert

Example

Subscriptions are only available via websockets.

{request_example_javascript}
{request_example_python}

Notification messages on this channel will look like this:

{response_example_json}