View Source Timescale.Hyperfunctions.Toolkit (Timescale v0.1.1)
Some hyperfunctions are included in the default TimescaleDB product. For additional hyperfunctions, you need to install the TimescaleDB Toolkit PostgreSQL extension.
All of the hyperfunctions in this module require the Toolkit to be installed, or else you will encounter an error.
For installation instructions, see the Timescale Docs
Install the Postgres extension with Timescale.Migration.create_timescaledb_toolkit_extension/0
Link to this section Summary
Functions
This function transforms 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.
Perform analysis of financial asset data. These specialized hyperfunctions make it easier to write financial analysis queries that involve candlestick data.
Get the closing price from a candlestick
aggregate.
Get the timestamp corresponding to the close time from a candlestick
aggregate.
Get the high price from a candlestick
aggregate.
Get the timestamp corresponding to the high time from a candlestick
aggregate.
Get the low price from a candlestick
aggregate.
Get the timestamp corresponding to the low time from a candlestick
aggregate.
Get the opening price from a candlestick
aggregate.
Get the timestamp corresponding to the open time from a candlestick
aggregate.
Combine multiple intermediate candlestick aggregates, produced by candlestick_agg
or candlestick
, into
a single intermediate candlestick aggregate.
Get the total volume from a candlestick
aggregate.
Get the Volume Weighted Average Price from a candlestick
aggregate.
Link to this section Functions
This function transforms 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
instead.
Perform analysis of financial asset data. These specialized hyperfunctions make it easier to write financial analysis queries that involve candlestick data.
They help you answer questions such as:
- What are the opening and closing prices of these stocks?
- When did the highest price occur for this stock?
This function group uses the two-step aggregation pattern. In addition to the usual aggregate function,
candlestick_agg, it also includes the pseudo-aggregate function candlestick
. candlestick_agg produces a
candlestick aggregate from raw tick data, which can then be used with the accessor and rollup functions
in this group. candlestick takes pre-aggregated data and transforms it into the same format that
candlestick_agg produces. This allows you to use the accessors and rollups with existing candlestick data.
Get the closing price from a candlestick
aggregate.
Get the timestamp corresponding to the close time from a candlestick
aggregate.
Get the high price from a candlestick
aggregate.
Get the timestamp corresponding to the high time from a candlestick
aggregate.
Get the low price from a candlestick
aggregate.
Get the timestamp corresponding to the low time from a candlestick
aggregate.
Get the opening price from a candlestick
aggregate.
Get the timestamp corresponding to the open time from a candlestick
aggregate.
Combine multiple intermediate candlestick aggregates, produced by candlestick_agg
or candlestick
, into
a single intermediate candlestick aggregate.
For example, you can use rollup to combine candlestick aggregates from 15-minute buckets into daily buckets.
Get the total volume from a candlestick
aggregate.
Get the Volume Weighted Average Price from a candlestick
aggregate.
For Candlesticks constructed from data that is already aggregated, the Volume Weighted Average Price is calculated using the typical price for each period (where the typical price refers to the arithmetic mean of the high, low, and closing prices).