API Reference

Margin Watch

Method Name

public/margin_watch

Calculates MtM and maintenance margin for a given subaccount.

Parameters

subaccount_id integer required
Subaccount ID to get margin for.
force_onchain boolean
Force the fetching of on-chain balances, default False.

Response

id string or integer required
result object required
result.currency string required
Currency of subaccount
result.initial_margin string required
Total initial margin requirement of all positions and collaterals.
result.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.
result.margin_type string required
Margin type of subaccount (PM (Portfolio Margin) or SM (Standard Margin))
enum PM SM
result.subaccount_id integer required
Subaccount_id
result.subaccount_value string required
Total mark-to-market value of all positions and collaterals
result.valuation_timestamp integer required
Timestamp (in seconds since epoch) of when margin and MtM were computed.
result.collaterals array of objects required
All collaterals that count towards margin of subaccount
result.collaterals[].amount string required
Asset amount of given collateral
result.collaterals[].asset_name string required
Asset name
result.collaterals[].asset_type string required
Type of asset collateral (currently always erc20)
enum erc20 option perp
result.collaterals[].initial_margin string required
USD value of collateral that contributes to initial margin
result.collaterals[].maintenance_margin string required
USD value of collateral that contributes to maintenance margin
result.collaterals[].mark_price string required
Current mark price of the asset
result.collaterals[].mark_value string required
USD value of the collateral (amount * mark price)
result.positions array of objects required
All active positions of subaccount
result.positions[].amount string required
Position amount held by subaccount
result.positions[].delta string required
Asset delta (w.r.t. forward price for options, 1.0 for perps)
result.positions[].gamma string required
Asset gamma (zero for non-options)
result.positions[].index_price string required
Current index (oracle) price for position's currency
result.positions[].initial_margin string required
USD initial margin requirement for this position
result.positions[].instrument_name string required
Instrument name (same as the base Asset name)
result.positions[].instrument_type string required
erc20, option, or perp
enum erc20 option perp
result.positions[].liquidation_price string or null required
Index price at which position will be liquidated
result.positions[].maintenance_margin string required
USD maintenance margin requirement for this position
result.positions[].mark_price string required
Current mark price for position's instrument
result.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
result.positions[].theta string required
Asset theta (zero for non-options)
result.positions[].vega string required
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}