# Candles

> Intear API candles.get and candles.subscribe: price candles of NEAR tokens in USD or NEAR, from 1 second to 1 week, fetched or live.

This page is part of the Intear API docs. The Intear API is at `https://api.intea.rs` and `wss://api.intea.rs/ws`, with no API key. https://docs.intear.tech/api/llms-full.txt has all of its pages in one file, and https://docs.intear.tech/llms.txt lists every page of the Intear docs.

See [Charts](https://docs.intear.tech/api/guides/charts.md) for resolutions and how candles are built.

## `candles.get`

HTTP: `/candles`.

| Param | Description |
| --- | --- |
| `tokens` | **Required.** 1 to 200 tokens |
| `resolution` | **Required.** `1S`, `1`, `5`, `15`, `60`, `240`, `D` or `W`, see [Resolutions](https://docs.intear.tech/api/guides/charts.md#resolutions) |
| `quote` | `usd` (default), `near`, or both as a list |
| `series` | Which of `open`, `high`, `low`, `close` and `volume`. All of them by default |
| `count_back` | How many candles of each token, at most 5,000, or 1,000 for `1S`. Default 300 |
| `to_millis` | The latest candle start to include. Now by default |

Result:

```json
{
  "height": 219969900,
  "timestamp_millis": 1792003880982,
  "tokens": {
    "wrap.near": {
      "time": [1791997200000, 1792000800000],
      "usd": { "close": [4.8274, 4.8295] },
      "near": { "close": [1.0, 1.0] }
    }
  },
  "missing": []
}
```

- Each token's candles are columns, oldest first. `time` is when each candle opens, in milliseconds.
- Prices are per whole token, and `volume` is in the same currency.
- In `near`, values are `null` from before wrap.near had a price.
- `missing`: tokens that don't exist.

## `candles.subscribe`

Takes the params of `candles.get` except `to_millis`, with `count_back` defaulting to `0`. The result is shaped like `candles.get`'s.

Each push is `{ "sub", "height", "timestamp_millis", "tokens" }` with the candles that changed in that block: the latest one, and a new one once it opens. It can also carry the candle before the latest one. A candle replaces the one with the same `time`.

See [Charts](https://docs.intear.tech/api/guides/charts.md#easy-to-embed-tradingview-chart) for a live TradingView chart to embed.
