account.margin is a private account-scoped channel. Authentication: realtime ticket, sent in an auth frame before subscribing. Payload schema: RealtimeAccountMarginPayload. Source status: live. Authenticate the socket with a realtime ticket and wait for auth_ok before you send the subscribe envelope below; a subscribe sent earlier is refused as unauthorized. The socket authentication flow covers minting, rotation and expiry. Account-wide initialMarginAtoms equals positionInitialMarginAtoms plus orderReserveAtoms, in settlement-asset atoms at the same engine sequences. Order reserve includes reserved execution fees and fragmentation rounding. Withdrawal holds, accrued fees and bad debt are separate; available capacity also excludes positive unrealized PnL and positive funding and is clamped at zero. Missing legacy fields mean unavailable, never zero. Example amounts: initialMarginAtoms: "32200000", positionInitialMarginAtoms: "20000000", orderReserveAtoms: "12200000". Cash changes publish an absolute cashBalanceAtoms here even when the account has no open positions. journalSequence can be zero before the account’s first trade and can stay unchanged across cash changes. Apply frames in stream envelope sequence order.

Subscribe envelope

Send this exact JSON shape. requestId is required and there is no action field. The series field is not sent for this channel.

Accepted frame

The subscription is active only after a matching realtime-subscription-accepted/v1 frame arrives.

Data frame

The envelope is realtime-stream/v1; its payload validates against RealtimeAccountMarginPayload.

Worked example

  1. Send the subscribe envelope with request id subscribe-account-margin.
  2. Wait for the accepted frame with the same request id; receiving any other frame does not prove this subscription.
  3. Process the data frame at sequence 1 and validate its payload as RealtimeAccountMarginPayload.