> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cesto.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Positions

> Read positions: account positions by wallet, and live SDK position holdings by product.

`cesto.positions` has two reads: `getPositions` for a user's **Cesto-account** positions,
and `getPosition` for the live, on-chain position in one basket — the position view for
[SDK-opened positions](/sdk/open-position).

## Get all positions

`cesto.positions.getPositions` returns a user's open and closing positions, resolved from
their **external Solana wallet address**, with no end-user login required.

```ts theme={null}
const { positions, pendingClosePositions } = await cesto.positions.getPositions({
  user: 'EXTERNAL_SOLANA_ADDRESS',
});
```

<ParamField path="user" type="string" required>
  External Solana wallet address to look up.
</ParamField>

<ResponseField name="positions" type="Position[]">
  Live open / partially-open positions.
</ResponseField>

<ResponseField name="pendingClosePositions" type="Position[]">
  Positions with a close currently in progress.
</ResponseField>

<Note>
  A wallet with no Cesto account returns an empty result
  (`{ positions: [], pendingClosePositions: [] }`) and is **not** an error. The `user`
  argument is required; an empty value throws before any request is made.

  This endpoint reads Cesto **account** positions (opened in the Cesto app). Positions
  opened via the SDK are self-custody and do **not** appear here — use `getPosition` below.
</Note>

## Position by product (SDK positions)

`cesto.positions.getPosition` returns the wallet's **live position in one basket**, read
from on-chain balances of the basket's constituent tokens — exactly what a
[close](/sdk/close-position) would sell. Works with a read-only key.

```ts theme={null}
const position = await cesto.positions.getPosition({
  user: 'SOLANA_ADDRESS',
  slug: 'defi-blue-chip',
});

position.hasPosition;   // true when the wallet holds any of the basket's tokens
position.totalValueUsd; // 101.2
position.holdings;      // [{ mint, symbol, name, amount /* base units */, decimals, priceUsd, valueUsd }]
position.lastExecution; // { executionId, type, status, startedAt, completedAt } | null
```

<ParamField path="user" type="string" required>
  Solana address to read.
</ParamField>

<ParamField path="slug" type="string" required>
  Basket to read, by slug (a product id also works).
</ParamField>

<ResponseField name="holdings" type="Holding[]">
  The wallet's live balances of the basket's constituent tokens, with USD prices and values.
</ResponseField>

<ResponseField name="totalValueUsd" type="number">
  Total USD value of the holdings.
</ResponseField>

<ResponseField name="hasPosition" type="boolean">
  True when the wallet holds any of the basket's tokens (i.e. a close would sell something).
</ResponseField>

<ResponseField name="lastExecution" type="object | null">
  The most recent SDK open/close execution for this wallet + product, **scoped to your API
  key** — one partner never sees another partner's activity for the same wallet.
</ResponseField>

## Opening and closing

To open or close a position (client-signed, write-scoped key), see
[Open a Position](/sdk/open-position) and [Close a Position](/sdk/close-position).
