The portfolio
A portfolio is an independent margin and collateral bucket. It holds:- A cash balance — your USDC collateral. See Collateral and cash.
- Positions — your open perpetuals exposure. See Positions, leverage, and funding.
- A margin type —
IsolatedorCross, fixed when the portfolio is created. - Leverage settings — configured per portfolio per market. One portfolio can run different leverage on
BTC-PERPandETH-PERP.
cash_balance, and liquidation is tracked per portfolio. That isolation is the point: create separate portfolios and subaccounts to split strategies, contain risk, and mix margin types — say, one Isolated portfolio for a directional trade and one Cross portfolio for a hedged book, all under the same account.
PortfolioId
Every portfolio is identified by a triple:account_id— your account, a 64-bit unsigned integer.subaccount_index— a 32-bit unsigned integer.portfolio_index— a 32-bit unsigned integer.
PortfolioId appears in request bodies and responses throughout the API. Its string display form is account_id:subaccount_index:portfolio_index.
Indices are dense: they start at 0 and run 0..n with no gaps. Subaccount index 0 is the default subaccount, and portfolio index 0 is the default portfolio (named Main). To enumerate everything you own, walk 0..subaccount_count for subaccounts and 0..portfolio_count within each.
Creating subaccounts and portfolios
Create a subaccount
POST /api/v1/accounts/{account_id}/subaccount/createCreating a subaccount also creates its default (Main) portfolio. The response returns both the new subaccount_index and its main_portfolio_index.GET /api/v1/subaccounts returns one summary per subaccount, including its portfolio_count and total_cash (summed over non-closed portfolios). GET /api/v1/portfolio/cash_balances returns one balance per portfolio.
Status lifecycle
A portfolio has one of three statuses:| Status | Meaning |
|---|---|
ACTIVE | Normal. The portfolio can trade and hold cash. New portfolios start here. |
IN_LIQUIDATION | The exchange is unwinding the portfolio. You cannot close or reopen it in this state. |
CLOSED | Retired. No cash, positions, or resting orders. |
ACTIVE or CLOSED.
Closing a portfolio
POST /api/v1/portfolio/close with { subaccount_index, portfolio_index }. Clear cash, positions, and orders first.
Reopening a portfolio
POST /api/v1/portfolio/reopen with { subaccount_index, portfolio_index }. Only a CLOSED portfolio can be reopened. It fails with 409 Conflict if the portfolio is already ACTIVE or is IN_LIQUIDATION. An unknown portfolio returns 404.
For the full status-code catalog, see Error codes.