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

# Examples

> Runnable TypeScript examples covering the whole SDK surface.

The [**cesto-sdk-examples**](https://github.com/cesto-co/cesto-sdk-examples) repository is a
small TypeScript app with one runnable script per SDK feature (via [tsx](https://tsx.is),
no build step) — clone it, add your API key, and run any example:

```bash theme={null}
git clone https://github.com/cesto-co/cesto-sdk-examples
cd cesto-sdk-examples
pnpm install
cp .env.example .env   # add your CESTO_API_KEY (and wallet vars for the write examples)

pnpm products
```

Requires **Node.js 20.6+**.

## What's included

| Example                                 | Run                     | Docs                                                                  |
| --------------------------------------- | ----------------------- | --------------------------------------------------------------------- |
| List products (+ backtests)             | `pnpm products`         | [Products](/sdk/products)                                             |
| Product detail + chart                  | `pnpm product`          | [Products](/sdk/products)                                             |
| Positions by wallet                     | `pnpm positions`        | [Positions](/sdk/positions)                                           |
| Live position in one basket             | `pnpm position`         | [Positions](/sdk/positions)                                           |
| Open a position (one call)              | `pnpm open --yes`       | [Open a Position](/sdk/open-position)                                 |
| Close a position (one call)             | `pnpm close --yes`      | [Close a Position](/sdk/close-position)                               |
| Explicit prepare → sign → submit → poll | `pnpm split-flow --yes` | [Open a Position](/sdk/open-position#split-flow-browser-wallet-signs) |
| Typed errors, overrides, cancellation   | `pnpm errors`           | [Errors & Retries](/sdk/errors)                                       |

<Warning>
  The open / close / split-flow examples execute **real swaps on Solana mainnet** from the
  wallet you configure, and that wallet pays its own gas. They refuse to run without an
  explicit `--yes` flag — use a dedicated test wallet with small amounts, and a
  **write-scoped** API key (see [Authentication](/sdk/authentication)).
</Warning>
