The Basket model
One account per wallet holds every position and order.
Last updated
Was this helpful?
One account per wallet holds every position and order.
Each wallet has a single Basket PDA that holds all of its positions and orders — one position per market. There are no standalone Position or Order accounts.
Because everything lives in one account, you identify a position by a friendly tuple rather than a raw key:
(owner, marketSymbol, side)Long and short are separate markets, so a wallet can hold one long and one short per symbol, and (marketSymbol, side) is always unambiguous. The backend resolves the underlying market pubkey, owning pool, and custody roles for you.
That's why request bodies take marketSymbol + side (e.g. "SOL" + "LONG") instead of position pubkeys.
Two endpoints decode the basket for you and return UI-ready metrics keyed by market pubkey:
One-shot: GET /owner/{owner}
Live: GET /owner/{owner}/ws
Both return positionMetrics / orderMetrics (formatted PnL, leverage, liquidation price) and the raw basket bytes (base64). Use the metrics directly; decode the raw bytes with the client SDK only if you need native PositionMeta[] / OrderMeta[].
The basket must be delegated before you can trade against it — see Funds lifecycle.
Per market + side, a basket holds up to 5 limit orders + 5 take-profit + 5 stop-loss. Trigger/limit endpoints address a slot by orderId (0–4).
Last updated
Was this helpful?
Was this helpful?

