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

# getCandles

> Fetch OHLC candle data for an Ostium pair.

```ts theme={null}
const candles = await client.getCandles({
  pairId: 0,
  from: Date.now() - 30 * 24 * 60 * 60 * 1000,
  resolution: '1D',
  sets: 3,
});
```

`sets` controls how many candle pages the SDK requests. It defaults to `1`; when greater than `1`, the SDK uses the previous page's last candle timestamp as the next request cursor and returns one flattened array.

Supported resolutions:

* `"1"`
* `"5"`
* `"15"`
* `"60"`
* `"240"`
* `"1D"`

## Parameters

```ts theme={null}
interface GetCandlesParams {
  pairId: string | number;
  from: number;
  to?: number;
  resolution: '1' | '5' | '15' | '60' | '240' | '1D';
  sets?: number;
}
```

## Response schema

```ts theme={null}
type Response = Array<{
  pairFrom: string;
  pairTo: string;
  time: number;
  open: number;
  high: number;
  low: number;
  close: number;
}>;
```
