---
title: candlestick_agg() | Tiger Data Docs
description: Aggregate tick data into an intermediate form for further calculation
---

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

This is the first step for performing financial calculations on raw tick data. Use `candlestick_agg` to create an intermediate aggregate from your tick data. This intermediate form can then be used by one or more accessors in this group to compute final results.

Optionally, multiple such intermediate aggregate objects can be combined using [`rollup()`](/docs/reference/toolkit/candlestick_agg/rollup/index.md) before an accessor is applied.

If you’re starting with pre-aggregated candlestick data rather than raw tick data, use the companion [`candlestick()`](/docs/reference/toolkit/candlestick_agg/candlestick/index.md) function instead. This function transforms the existing aggregated data into the correct form for use with the candlestick accessors.

## Arguments

The syntax is:

```
candlestick_agg(
  ts TIMESTAMPTZ,
  price DOUBLE PRECISION,
  volume DOUBLE PRECISION
) RETURNS Candlestick
```

| Name     | Type             | Default | Required | Description                           |
| -------- | ---------------- | ------- | -------- | ------------------------------------- |
| `ts`     | TIMESTAMPTZ      | -       | ✔        | Timestamp associated with stock price |
| `price`  | DOUBLE PRECISION | -       | ✔        | Stock quote/price at the given time   |
| `volume` | DOUBLE PRECISION | -       | ✔        | Volume of the trade                   |

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