private/get_margin
Changed onCalculates net initial and maintenance margin for a subaccount before and after an optional simulated state change (position and/or collateral deltas), and whether that change would pass the margin requirement. Values are net margin — mark-to-market value minus the requirement — so positive means healthy. Does not take open-order margin into account. Margins use the subaccount's manager's params. Set is_delayed_liquidation to use its delayed-liquidation override instead, as order checks do; the request is rejected for a subaccount without one.
Request
- Base URLhttps://api.derive.xyz/v3
- AuthAPI key in header X-DeriveWallet and API key in header X-DeriveTimestamp and API key in header X-DeriveSignature
Request body
true margins under the subaccount's delayed-liquidation override, as order checks do. Rejected for a subaccount without one.
Optional collateral deltas to simulate deposits / withdrawals / spot trades.
Optional position deltas to simulate perp / option trades.
Response
Success
Result of public/get_margin / private/get_margin: net margin (MtM minus requirement; positive = healthy) before and after the simulated changes, as USD decimal strings.
true when post-change initial margin passes, or the change is risk-reducing while maintenance margin stays healthy.
0 for the public simulated-portfolio variant.
Changes
- info
the endpoint scheme security
DeriveWallet AND DeriveTimestamp AND DeriveSignaturewas added to the API - info
added the media type
application/jsonfor the response with the status
- info