Subaccounts

private/get_all_portfolios

Changed on

Returns the complete portfolio (same shape as get_subaccount) for every subaccount owned by the given wallet, including valuations, margin figures, open orders, positions, and collaterals. If an individual subaccount's portfolio cannot be built, it is returned as a placeholder entry with failed_to_fetch set to true rather than failing the whole request.

post/private/get_all_portfolios

Request

  • Base URL
    https://api.derive.xyz/v3
  • Auth
    API key in header X-DeriveWallet and API key in header X-DeriveTimestamp and API key in header X-DeriveSignature

Request body

GetAllPortfoliosRequest required
wallet, string required

20-byte Ethereum address as a 0x-prefixed lowercase hex string.

Response

Success

Subaccount[] required
collaterals, Collateral[] required
collaterals_initial_margin, string required
collaterals_maintenance_margin, string required
collaterals_value, string required
currency, string[] required
failed_to_fetch, boolean required

true if this subaccount's portfolio could not be loaded; such subaccounts are returned as placeholders by get_all_portfolios.

initial_margin, string required
is_under_liquidation, boolean required
label, string required
maintenance_margin, string required
manager_id, integer required
margin_type, string required
mm_credits, string required

MM credit from universe loss-socialization events: the socialized USDC debit lands on cash in full, and debit × (1 − write_down) is added back to maintenance margin while the 6-hour write-down runs. Events this subaccount has not yet realized contribute their expected credit, with the current subaccount value standing in for the MtM at realization. Zero while under auction — the credit is cleared when liquidation starts.

open_orders, Order[] required
open_orders_margin, string required

Uses the manager's params, as initial_margin does, even for a subaccount with a delayed-liquidation override. Order checks use the override, so the two can differ. This is rare: an override usually loosens maintenance margin only, and this is an initial-margin figure.

positions, Position[] required
positions_initial_margin, string required
positions_maintenance_margin, string required
positions_value, string required
projected_margin_change, string required

Change in maintenance_margin a minute past the account's next option expiry, once the options expiring by then settle into cash at today's forward. maintenance_margin + projected_margin_change < 0 signals liquidation right after that expiry. Excludes open orders; "0" for an account without an unexpired option.

risk_universe_id, integer required
subaccount_id, integer required
subaccount_value, string required
vault_deposit_holds, VaultDepositHold[] required

Changes

    • info

      the endpoint scheme security DeriveWallet AND DeriveTimestamp AND DeriveSignature was added to the API

    • info

      added the media type application/json for the response with the status

    • warning

      added the new max_crossed_orders enum value to the items/open_orders/items/cancel_reason response property for the response status