Method Name
public/margin_watch
public/margin_watchCalculates MtM and maintenance margin for a given subaccount.
Parameters
| subaccount_idintegerrequired Subaccount ID to get margin for. |
| force_onchainboolean Force the fetching of on-chain balances, default False. |
| is_delayed_liquidationboolean If True, maintenance margin requirement is lowered for a brief period.Requires subaccount to have delayed liquidation enabled. |
Response
| idstring or integerrequired |
| resultobjectrequired |
| result.currencystringrequired Currency of subaccount |
| result.initial_marginstringrequired Total initial margin requirement of all positions and collaterals. |
| result.maintenance_marginstringrequired Total maintenance margin requirement of all positions and collaterals.If this value falls below zero, the subaccount will be flagged for liquidation. |
| result.margin_typestringrequired Margin type of subaccount ( PM (Portfolio Margin), PM2 (Portfolio Margin 2), or SM (Standard Margin))enum PMSMPM2 |
| result.subaccount_idintegerrequired Subaccount_id |
| result.subaccount_valuestringrequired Total mark-to-market value of all positions and collaterals |
| result.valuation_timestampintegerrequired Timestamp (in seconds since epoch) of when margin and MtM were computed. |
| result.collateralsarray of objectsrequired All collaterals that count towards margin of subaccount |
| result.collaterals[].amountstringrequired Asset amount of given collateral |
| result.collaterals[].asset_namestringrequired Asset name |
| result.collaterals[].asset_typestringrequired Type of asset collateral (currently always erc20)enum erc20optionperp |
| result.collaterals[].deltastringrequired Delta of the collateral relative to delta_currency |
| result.collaterals[].delta_currencystringrequired Currency that this collateral's delta is correlated to |
| result.collaterals[].initial_marginstringrequired USD value of collateral that contributes to initial margin |
| result.collaterals[].maintenance_marginstringrequired USD value of collateral that contributes to maintenance margin |
| result.collaterals[].mark_pricestringrequired Current mark price of the asset |
| result.collaterals[].mark_valuestringrequired USD value of the collateral (amount * mark price) |
| result.positionsarray of objectsrequired All active positions of subaccount |
| result.positions[].amountstringrequired Position amount held by subaccount |
| result.positions[].deltastringrequired Asset delta (w.r.t. forward price for options, 1.0 for perps) |
| result.positions[].gammastringrequired Asset gamma (zero for non-options) |
| result.positions[].index_pricestringrequired Current index (oracle) price for position's currency |
| result.positions[].initial_marginstringrequired USD initial margin requirement for this position |
| result.positions[].instrument_namestringrequired Instrument name (same as the base Asset name) |
result.positions[].instrument_typestringrequirederc20, option, or perpenum erc20optionperp |
| result.positions[].liquidation_pricestring or nullrequired Index price at which position will be liquidated |
| result.positions[].maintenance_marginstringrequired USD maintenance margin requirement for this position |
| result.positions[].mark_pricestringrequired Current mark price for position's instrument |
| result.positions[].mark_valuestringrequired USD value of the position; this represents how much USD can be recieved by fully closing the position at the current oracle price |
| result.positions[].thetastringrequired Asset theta (zero for non-options) |
| result.positions[].vegastringrequired Asset vega (zero for non-options) |
Example
{request_example_shell}{request_example_javascript}{request_example_python}The above command returns JSON structured like this:
{response_example_json}