public/get_margin
Changed onCalculates net initial and maintenance margin for a fully simulated portfolio under a chosen margin type (SM or PM2; market selects the currency a PM2 manager must cover), optionally with a further simulated state change layered on top. Values are net margin — mark-to-market value minus the requirement — so positive means healthy. Does not take open-order margin into account.
Request
- Base URLhttps://api.derive.xyz/v3
- Authnone declared
Request body
SM (standard margin) or PM2 (portfolio margin).
Currency the manager must cover; required for PM2.
Optional collateral deltas to simulate deposits / withdrawals / spot trades.
Collaterals of the simulated portfolio.
Optional position deltas to simulate perp / option trades.
Positions of the simulated portfolio.
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
added the media type
application/jsonfor the response with the status
- info