HomeDocumentationAPI Reference
Log In
API Reference

Margin Watch

Channel Name Schema

margin.watch

Subscribe to state of margin and MtM of all users.

Channel Parameters

Notification Data

channel  string required
Subscribed channel name

data  array of objects required

data[]. currency  string required
Currency of subaccount

data[]. initial_margin  string required
Total initial margin requirement of all positions and collaterals.

data[]. maintenance_margin  string required
Total maintenance margin requirement of all positions and collaterals.If this value falls below zero, the subaccount will be flagged for liquidation.

data[]. margin_type  string required
Margin type of subaccount (PM (Portfolio Margin), PM2 (Portfolio Margin 2), or SM (Standard Margin))
enum PM SM PM2

data[]. subaccount_id  integer required
Subaccount_id

data[]. subaccount_value  string required
Total mark-to-market value of all positions and collaterals

data[]. valuation_timestamp  integer required
Timestamp (in seconds since epoch) of when margin and MtM were computed.

data[]. collaterals  array of objects required
All collaterals that count towards margin of subaccount

data[].collaterals[]. amount  string required
Asset amount of given collateral

data[].collaterals[]. asset_name  string required
Asset name

data[].collaterals[]. asset_type  string required
Type of asset collateral (currently always erc20)
enum erc20 option perp

data[].collaterals[]. initial_margin  string required
USD value of collateral that contributes to initial margin

data[].collaterals[]. maintenance_margin  string required
USD value of collateral that contributes to maintenance margin

data[].collaterals[]. mark_price  string required
Current mark price of the asset

data[].collaterals[]. mark_value  string required
USD value of the collateral (amount * mark price)

data[]. positions  array of objects required
All active positions of subaccount

data[].positions[]. amount  string required
Position amount held by subaccount

data[].positions[]. delta  string required
Asset delta (w.r.t. forward price for options, 1.0 for perps)

data[].positions[]. gamma  string required
Asset gamma (zero for non-options)

data[].positions[]. index_price  string required
Current index (oracle) price for position's currency

data[].positions[]. initial_margin  string required
USD initial margin requirement for this position

data[].positions[]. instrument_name  string required
Instrument name (same as the base Asset name)

data[].positions[]. instrument_type  string required
erc20, option, or perp
enum erc20 option perp

data[].positions[]. liquidation_price  string or null required
Index price at which position will be liquidated

data[].positions[]. maintenance_margin  string required
USD maintenance margin requirement for this position

data[].positions[]. mark_price  string required
Current mark price for position's instrument

data[].positions[]. mark_value  string required
USD value of the position; this represents how much USD can be recieved by fully closing the position at the current oracle price

data[].positions[]. theta  string required
Asset theta (zero for non-options)

data[].positions[]. vega  string required
Asset vega (zero for non-options)

Example

Subscriptions are only available via websockets.

{request_example_javascript}
{request_example_python}

Notification messages on this channel will look like this:

{response_example_json}