API Reference

Get Subaccount

Method Name

private/get_subaccount

Get open orders, active positions, and collaterals of a subaccount
Required minimum session key permission level is read_only

Parameters

subaccount_id integer required
Subaccount_id

Response

id string or integer required
result object required
result.collaterals_initial_margin string required
Total initial margin credit contributed by collaterals
result.collaterals_maintenance_margin string required
Total maintenance margin credit contributed by collaterals
result.collaterals_value string required
Total mark-to-market value of all collaterals
result.currency string required
Currency of subaccount
result.initial_margin string required
Total initial margin requirement of all positions and collaterals.Trades will be rejected if this value falls below zero after the trade.
result.is_under_liquidation boolean required
Whether the subaccount is undergoing a liquidation auction
result.label string required
User defined label
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.open_orders_margin string required
Total margin requirement of all open orders.Orders will be rejected if this value plus initial margin are below zero after the order.
result.positions_initial_margin string required
Total initial margin requirement of all positions
result.positions_maintenance_margin string required
Total maintenance margin requirement of all positions
result.positions_value string required
Total mark-to-market value of all positions
result.subaccount_id integer required
Subaccount_id
result.subaccount_value string required
Total mark-to-market value of all positions and collaterals
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[].average_price string required
Average price of the collateral, 0 for USDC.
result.collaterals[].average_price_excl_fees string required
Average price of whole position excluding fees
result.collaterals[].creation_timestamp integer required
Timestamp of when the position was opened (in ms since Unix epoch)
result.collaterals[].cumulative_interest string required
Cumulative interest earned on supplying collateral or paid for borrowing
result.collaterals[].currency string required
Underlying currency of asset (ETH, BTC, etc)
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.collaterals[].open_orders_margin string required
USD margin requirement for all open orders for this asset / instrument
result.collaterals[].pending_interest string required
Portion of interest that has not yet been settled on-chain. This number is added to the portfolio value for margin calculations purposes.
result.collaterals[].realized_pnl string required
Realized trading profit or loss of the collateral, 0 for USDC.
result.collaterals[].realized_pnl_excl_fees string required
Realized trading profit or loss of the position excluding fees
result.collaterals[].total_fees string required
Total fees paid for opening and changing the position
result.collaterals[].unrealized_pnl string required
Unrealized trading profit or loss of the collateral, 0 for USDC.
result.collaterals[].unrealized_pnl_excl_fees string required
Unrealized trading profit or loss of the position excluding fees
result.open_orders array of objects required
All open orders of subaccount
result.open_orders[].amount string required
Order amount in units of the base
result.open_orders[].average_price string required
Average fill price
result.open_orders[].cancel_reason string required
If cancelled, reason behind order cancellation
enum user_request mmp_trigger insufficient_margin signed_max_fee_too_low cancel_on_disconnect ioc_or_market_partial_fill session_key_deregistered subaccount_withdrawn compliance trigger_failed
result.open_orders[].creation_timestamp integer required
Creation timestamp (in ms since Unix epoch)
result.open_orders[].direction string required
Order direction
enum buy sell
result.open_orders[].filled_amount string required
Total filled amount for the order
result.open_orders[].instrument_name string required
Instrument name
result.open_orders[].is_transfer boolean required
Whether the order was generated through private/transfer_position
result.open_orders[].label string required
Optional user-defined label for the order
result.open_orders[].last_update_timestamp integer required
Last update timestamp (in ms since Unix epoch)
result.open_orders[].limit_price string required
Limit price in quote currency
result.open_orders[].max_fee string required
Max fee in units of the quote currency
result.open_orders[].mmp boolean required
Whether the order is tagged for market maker protections
result.open_orders[].nonce integer required
Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)
result.open_orders[].order_fee string required
Total order fee paid so far
result.open_orders[].order_id string required
Order ID
result.open_orders[].order_status string required
Order status
enum open filled cancelled expired untriggered
result.open_orders[].order_type string required
Order type
enum limit market
result.open_orders[].quote_id string or null required
Quote ID if the trade was executed via RFQ
result.open_orders[].signature string required
Ethereum signature of the order
result.open_orders[].signature_expiry_sec integer required
Signature expiry timestamp
result.open_orders[].signer string required
Owner wallet address or registered session key that signed order
result.open_orders[].subaccount_id integer required
Subaccount ID
result.open_orders[].time_in_force string required
Time in force
enum gtc post_only fok ioc
result.open_orders[].replaced_order_id string or null
If replaced, ID of the order that was replaced
result.open_orders[].trigger_price string or null
(Required for trigger orders) Index or Market price to trigger order at
result.open_orders[].trigger_price_type string or null
(Required for trigger orders) Trigger with Index or Mark Price
enum mark index
result.open_orders[].trigger_reject_message string or null
(Required for trigger orders) Error message if error occured during trigger
result.open_orders[].trigger_type string or null
(Required for trigger orders) Stop-loss or Take-profit.
enum stoploss takeprofit
result.positions array of objects required
All active positions of subaccount
result.positions[].amount string required
Position amount held by subaccount
result.positions[].average_price string required
Average price of whole position
result.positions[].average_price_excl_fees string required
Average price of whole position excluding fees
result.positions[].creation_timestamp integer required
Timestamp of when the position was opened (in ms since Unix epoch)
result.positions[].cumulative_funding string required
Cumulative funding for the position (only for perpetuals).
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[].leverage string or null required
Only for perps. Leverage of the position, defined as abs(notional) / collateral net of options margin
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[].net_settlements string required
Net amount of USD from position settlements that has been paid to the user's subaccount. This number is subtracted from the portfolio value for margin calculations purposes.
Positive values mean the user has recieved USD from settlements, or is awaiting settlement of USD losses. Negative values mean the user has paid USD for settlements, or is awaiting settlement of USD gains.
result.positions[].open_orders_margin string required
USD margin requirement for all open orders for this asset / instrument
result.positions[].pending_funding string required
A portion of funding payments that has not yet been settled into cash balance (only for perpetuals). This number is added to the portfolio value for margin calculations purposes.
result.positions[].realized_pnl string required
Realized trading profit or loss of the position.
result.positions[].realized_pnl_excl_fees string required
Realized trading profit or loss of the position excluding fees
result.positions[].theta string required
Asset theta (zero for non-options)
result.positions[].total_fees string required
Total fees paid for opening and changing the position
result.positions[].unrealized_pnl string required
Unrealized trading profit or loss of the position.
result.positions[].unrealized_pnl_excl_fees string required
Unrealized trading profit or loss of the position excluding fees
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}