userAccount channel pushes the complete account view for one account within one Market Deployer — collateral, positions, and margin. The payload is identical to the REST userAccount response. A first frame arrives immediately on subscribe.
Use it to keep equity, available margin, position size, and unrealized PnL current without polling.
When frames are pushed
Frames are pushed on two paths:
Both paths push the same full-snapshot frame; you do not need to tell them apart. The timed path exists because
unrealizedPnl, crossEquity, marginAvailable, positions[].mm and positions[].liqPx move with the mark price, and a mark-price move produces no account event.
Subscribing
string
required
user (required) — The account’s wallet address, not the numeric account ID. The server resolves it to an account; an unregistered address receives no frames.integer
required
marketDeployerId (required) — The Market Deployer to report on. The account view differs per Market Deployer, so subscribe once per Market Deployer you care about. This carries the same meaning as marketDeployerId in the REST query.subscription object and "method": "unsubscribe".
Push message format
data carries the full REST response body.
Field reference
string
Always
"UserAccount" for this channel.string
The channel this frame belongs to, keyed by the subscribed address only. It does not include the Market Deployer: when one address is subscribed under several Market Deployers, every frame carries the same
channel. Use data.marketDeployerId to tell them apart.object
The account view. Every margin, collateral, position, and account-level field is defined exactly as in the REST
userAccount response — see that page for the complete field reference.int64
Frame send time in Unix milliseconds, from the server clock.
Maintaining local state
1
Subscribe and take the first frame
The first frame arrives immediately and is a complete snapshot. Use it as your starting state.
2
Replace state on every frame
Each frame is a full snapshot, not a delta. Overwrite your local account state wholesale — there are no patches to apply.
3
Route by Market Deployer
If you subscribe to several Market Deployers for the same address, key your local state by
data.marketDeployerId, not by channel.4
Convert raw values for display
All numeric values are raw integer strings. Amount fields — the bulk of this frame — convert with the settlement coin’s
szDecimals. positions[].size converts with the contract’s qtyScale and positions[].liqPx with its priceScale. Read all three from configs, and use exact decimal arithmetic, not floats.positions[].unrealizedPnl is computed against the mark price and is recalculated on every frame, so it moves even when your position does not.