Skip to main content

Candlestick

Candlesticks are generated from quote and trade data. The typical approach involves reading from NATS pub/sub, maintaining forming candles in memory, and persisting completed candles to QuestDB.

Candlestick Generation

This strategy for saving candlestick data is as follows:

  1. Subscribe to tick/quote feed based on channel from NATS
  2. In your code, you should store candlestick information to process trades or quotes
  3. On a new candlestick, write the previous candlestick to disk aka QuestDb

Notes

  1. The simplest method in using QuestDb for candlesticks is to only have a candlestick table per exchange that streams data into the table append only.
  2. If you need different timeframes, use Materialized Views for this as it's extremely fast and efficient but note you should only run this on PERIOD and not IMMEDIATE and each timeframe should cascade down from another in timeframe to reduce row query (i.e. 15 gets built from 5 minute and 5 minute gets built from 1 minute candlesticks)