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 ~5 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",
"leverage_ratio": "0.5641",
"unrealised_pnl": "1430.50",
"initial_margin_requirement": "0.12000000",
"margin_call_threshold": "0.06000000",
"liquidation_threshold": "0.02000000",
"timestamp": "2025-06-15T07:30:00.123Z"
}
| Field | Description |
|---|---|
customer_code | Customer identifier |
currency | Collateral currency (e.g. USD) |
total_equity | Total account equity (balance + unrealised PnL) |
available_margin | Margin available for new positions |
used_margin | Margin currently used by open positions and orders |
margin_ratio | Deprecated — use leverage_ratio. Used margin as a fraction of the collateral balance (total_equity before unrealised PnL); does not move with mark price |
leverage_ratio | Venue-reported (collateral + unrealised PnL) / position notional as a decimal fraction (e.g. 5.1316 = 513%). Compare against margin_call_threshold / liquidation_threshold; higher is safer; "1" when flat |
unrealised_pnl | Total unrealised profit/loss across all positions |
initial_margin_requirement | Initial margin rate currently applied to the account, as a decimal fraction (e.g. 0.12 = 12%) |
margin_call_threshold | Margin rate at which the account enters margin call, as a decimal fraction (e.g. 0.06 = 6%) |
liquidation_threshold | Margin rate at which the account is liquidated, as a decimal fraction (e.g. 0.02 = 2%) |
timestamp | Server-side event time (maps to updated_at in REST) |
Notes:
- Updates are pushed at ~5 second intervals while the subscription is active.
- Fields match the REST
AccountSummaryItemschema (updated_at→timestamp,realised_pnlomitted). - If the venue keeps rejecting the lookup for a customer (for example an unknown customer code), the server backs off to roughly one attempt every 30 seconds for that customer until a poll succeeds. The subscription stays active; no message is pushed in the meantime.