Skip to main content

Margin updates

Real-time account margin and equity updates. Requires authentication.

Subscribe

{"op": "subscribe", "args": ["margin:c1d2e3f4-a5b6-7890-cdef-123456789abc"]}

Topic format: margin:{customer_code}, e.g. margin:c1d2e3f4-a5b6-7890-cdef-123456789abc.

Update Message

The server polls the account summary every ~10 seconds for each subscribed customer and pushes a full snapshot. The data matches the REST GET /customers/{code}/account-summary endpoint.

{
"channel": "margin",
"type": "update",
"customer_code": "c1d2e3f4-a5b6-7890-cdef-123456789abc",
"currency": "USD",
"total_equity": "125430.50",
"available_margin": "98750.25",
"used_margin": "26680.25",
"margin_ratio": "0.2127",
"unrealised_pnl": "1430.50",
"timestamp": "2025-06-15T07:30:00.123Z"
}
FieldDescription
customer_codeCustomer identifier
currencyCollateral currency (e.g. USD)
total_equityTotal account equity (balance + unrealised PnL)
available_marginMargin available for new positions
used_marginMargin currently used by open positions and orders
margin_ratioUsed margin as a fraction of total equity (e.g., 0.21 = 21%)
unrealised_pnlTotal unrealised profit/loss across all positions
timestampServer-side event time (maps to updated_at in REST)

Notes:

  • Updates are pushed at ~10 second intervals while the subscription is active.
  • Fields match the REST AccountSummaryItem schema (updated_attimestamp, realised_pnl omitted).