Liquidations

public/margin_watch

Changed on

Calculates the mark-to-market value and initial/maintenance margin for a given subaccount, with per-position and per-collateral breakdowns, computed from live feed data at request time. Margins use the subaccount's manager's params. Set is_delayed_liquidation to get them under the subaccount's delayed-liquidation override instead; the request is rejected for a subaccount without one. has_delayed_liquidation reports whether the subaccount has one. A maintenance margin below zero means the subaccount is flagged for liquidation.

post/public/margin_watch

Request

  • Base URL
    https://api.derive.xyz/v3
  • Auth
    none declared

Request body

MarginWatchRequest required
is_delayed_liquidation, boolean

true returns margins under the subaccount's delayed-liquidation override. Rejected for a subaccount without one.

subaccount_id, integer required

Response

Success

PublicMarginWatchResponse required

Result of public/margin_watch: the margin state a liquidation watcher needs, under the subaccount's manager's params, or its delayed-liquidation override when the request asks for it.

collaterals, Collateral[] required
currency, string[] required
has_delayed_liquidation, boolean required

true when the subaccount has a delayed-liquidation override.

initial_margin, string required
is_delayed_liquidation, boolean required

true when the margins above use the delayed-liquidation override.

maintenance_margin, string required

Below zero the subaccount is flagged for liquidation.

margin_type, string required
positions, Position[] required
regular_margin_flagged_sec, integer nullable

Unix seconds at which a subaccount with a delayed-liquidation override was first seen below its manager's maintenance margin. Its grace period before liquidation counts from here. Null otherwise.

risk_universe_id, integer required
subaccount_id, integer required
subaccount_value, string required
valuation_timestamp, integer required

Unix seconds at which margin and MtM were computed.

Changes