Skip to navigation

Account balances

A pool's latest readout

URL — No public environment serves this socket yet.

Topic accountBalance

Request parameters

ParameterTypeRequiredDescription
opstringYessubscribe
reqIdstringYesEchoed byte-exact on the answer. Printable ASCII, escape-free; anything else answers MALFORMED.
paramsobjectYes
> topicsarray of stringsYesaccountBalance

Response parameters

ParameterTypeRequiredDescription
opstringYesOne of subscribe, unsubscribe.
reqIdstringYesEchoed byte-exact on the answer. Printable ASCII, escape-free; anything else answers MALFORMED.
successbooleanYestrue

Push data parameters

Every amount is required money: a zero balance is a measurement, so “0.00000000” is a value and never a null. available is what the venue would let move; held is margin, pending withdrawals and freezes.

What the image holds. The latest reading for every (accountId, assetId) pair this member has seen for the organization — one row per pair, not a history. Rows appear as connectors report them, so an image is what has been reported, never a list of assets the venue supports.

How a row leaves. It does not. A pool that empties is reported as zero, which is a measurement and stays in your map; it never vanishes, and its absence would mean “never reported”, which is a different thing. A row for an account whose own status has moved on is still served — read the account’s state from the account channel, not from a balance’s presence.

ParameterTypeRequiredDescription
eventstringYesaccountBalance
msgTypestringYesaccountBalance
topicstringYesaccountBalance
seqstringYesThe stream position, as a decimal string — an int64 a JSON number would truncate.
seqTsstringYesThe stream timestamp, epoch-ns as a decimal string.
isSnapshotbooleanYesOne of true, false.
snapshotIdstringNoPresent on a snapshot part only, and the same on every part of one image; the next image of any topic carries a different one. Opaque — compare it for equality and nothing else. It is not a sequence, a version or a timestamp, and its shape may change; a client that ordered by it would be relying on how a member happens to mint it. Use it to keep two images apart. A repeat subscribe re-pushes the image — that is the resync, and there is no separate op — so a client can start image N+1 while N is still arriving, and without a name on each part it cannot tell which last: true closes which, nor stop a straggling part of N landing in the map N+1 just cleared. Discard any part whose snapshotId is not the one you are currently applying.
partintegerNoPresent on a snapshot part only; 1-based.
lastbooleanNoPresent on a snapshot part only. The image is complete when true — including for an empty channel, which is still one part.
dataarray of objectsYesOne pool’s latest readout, keyed by (accountId, assetId) — the pair is the upsert key, neither half alone.
> accountIdintegerYes
> accountstring, nullableYes
> credentialIdintegerYes
> assetIdintegerYes
> assetstring, nullableYes
> totalstringYesRequired money at the scale this reading itself states, trailing zeros kept — not the asset’s canonical scale, which can differ and is never consulted here. Two assets in one frame routinely carry different digit counts, and so can two readings of the same asset. Parse the decimal; do not predict its length. A zero balance is a MEASUREMENT, so “0.00000000” is a value and never a null.
> availablestringYesWhat the venue would let move.
> heldstringYesMargin, pending withdrawals and freezes.
> venueTsNsstring, nullableYes
> venueRevisionstring, nullableYes
> observedAtNsstringYes