Skip to navigation

Exposures

An account's exposure in one asset

URL — No public environment serves this socket yet.

Topic exposure

Request parameters

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

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

Served from 4.2.0. One row per (accountId, assetId): the account’s actual exposure to the asset — its holding plus every derivative position’s leg in it — its inventory, and the holding’s cost basis and realized PnL in USD (null for a cash asset). Needs risk:read, or any risk capability; orders:read alone is refused FORBIDDEN_CAPABILITY. A member whose deployment has not switched the risk channels on answers the subscribe TOPIC_NOT_ACTIVE.

How a row moves. On a business event touching its asset — a fill, bust, correction, attribution, balance or adjustment — and when the asset’s rateQuality or unvalued changes (a first rate, a feed going stale or recovering; cause VALUATION). Never on a price move within a tier: read value off riskRecord. A row never leaves.

ParameterTypeRequiredDescription
eventstringYesexposure
msgTypestringYesexposure
topicstringYesexposure
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 account’s exposure in one asset, keyed by (accountId, assetId) — the pair is the upsert key. The same row GET /risk/exposures serves on the HTTP lane, with the names beside the ids. It moves on a business event touching the asset, and when the asset’s rateQuality or unvalued changes (cause VALUATION, causeRef 0) — never on a price move within a rate tier.
> accountIdintegerYes
> accountstring, nullableYes
> assetIdintegerYes
> assetstring, nullableYes
> pricedAtNsstringYesWhen the change the row states happened, epoch-ns.
> causestringYesWhat moved a risk row. MANUAL_ADJUSTMENT is a hand-made correction of the account’s books applied (since 4.5.0), causeRef its id. Append-only: read an unknown value as UNKNOWN. One of UNKNOWN, FILL, BUST, CORRECTION, ATTRIBUTION, MANUAL_ADJUSTMENT, ORDER_EVENT, VALUATION, BALANCE, FUNDING, LIMIT, SNAPSHOT, POSITION_TRANSFER, FORCE_FLATTEN, BOOK_DELETED.
> causeRefstringYesThe execution, adjustment or balance behind the cause; “0” when none.
> actualExposurestringYesThe account’s filled exposure to the asset in its own units, signed: the holding plus every derivative position’s leg in it, at the scale it was stated — never finer than the asset’s unit scale (eight places for an asset without one).
> inventoryQtystringYesWhat the account holds of the asset: the venue’s last restated balance plus the account’s own fills since, at the same scale rule as actualExposure.
> costBasisUsdstring, nullableYesWhat the holding cost in USD; null for a cash asset (USD, USD stablecoins).
> realizedPnlUsdstring, nullableYesCumulative realized PnL in USD on the holding, against its average cost; null for a cash asset.
> rateQualitystringYesA USD rate’s tier: PRIMARY (current), LKG_FRESH and LKG_STALE (a last-known rate up to 60 s and 10 min old), MISSING. Append-only: read an unknown value as UNKNOWN. One of UNKNOWN, PRIMARY, LKG_FRESH, LKG_STALE, MISSING.
> unvaluedbooleanYesTrue when the asset has no USD rate and nothing open depends on it: it is left out of NLV and of every leverage figure.