> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify-poc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# candlestick()

> Transform pre-aggregated candlestick data into the correct form to use with `candlestick_agg` functions

<Icon icon="tag" iconType="duotone" /> Since [1.14.0][toolkit-1.14.0]

Transform pre-aggregated candlestick data into a candlestick aggregate object. This object contains the data in the
correct form to use with the accessors and rollups in this function group.

If you're starting with raw tick data rather than candlestick data, use [`candlestick_agg()`][candlestick-agg] instead.

## Arguments

The syntax is:

```sql theme={"dark"}
candlestick(
  ts TIMESTAMPTZ,
  open DOUBLE PRECISION,
  high DOUBLE PRECISION,
  low DOUBLE PRECISION,
  close DOUBLE PRECISION,
  volume DOUBLE PRECISION
) RETURNS Candlestick
```

| Name   | Type             | Default | Required | Description                                          |
| ------ | ---------------- | ------- | -------- | ---------------------------------------------------- |
| ts     | TIMESTAMPTZ      | -       | ✔        | Timestamp associated with stock price                |
| open   | DOUBLE PRECISION | -       | ✔        | Opening price of candlestick                         |
| high   | DOUBLE PRECISION | -       | ✔        | High price of candlestick                            |
| low    | DOUBLE PRECISION | -       | ✔        | Low price of candlestick                             |
| close  | DOUBLE PRECISION | -       | ✔        | Closing price of candlestick                         |
| volume | DOUBLE PRECISION | -       | ✔        | Total volume of trades during the candlestick period |

## Returns

| Column | Type        | Description                                                                                                                                                                                           |
| ------ | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| agg    | Candlestick | An object storing `(timestamp, value)` pairs for each of the opening, high, low, and closing prices, in addition to information used to calculate the total volume and Volume Weighted Average Price. |

[candlestick-agg]: /api-reference/timescaledb-toolkit/candlestick_agg/candlestick_agg

[toolkit-1.14.0]: https://github.com/timescale/timescaledb-toolkit/releases/tag/1.14.0
