> For the complete documentation index, see [llms.txt](https://docs.flash.trade/flash-trade/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flash.trade/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/concepts/basket-model.md).

# The Basket model

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.

## Identifying a position

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.

## Reading the basket

Two endpoints decode the basket for you and return UI-ready metrics keyed by market pubkey:

* One-shot: [`GET /owner/{owner}`](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference/account-and-positions.md)
* Live: [`GET /owner/{owner}/ws`](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference/websocket.md)

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](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/concepts/funds-lifecycle.md).

## Order slots

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).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flash.trade/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/concepts/basket-model.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
