Reputation: 1
I have tick bid/ask data, with columns
symbol
timestamp
ask_amount
ask_price
bid_price
bid_amount
what kind of query in clickhouse can tick data for equal candles with a length of 1 minute? How can I make candle data from ticks in clickhouse?
I try, but I don't know how to make equal candles
Upvotes: 0
Views: 198
Reputation: 810
Not knowing what aggregations you want in the "candle", here are a few arbitrary ones:
SELECT
symbol,
toStartOfMinute(timestamp) AS minute,
max(ask_amount),
max(ask_price),
max(bid_price),
min(bid_price),
avg(bid_amount)
FROM bids
GROUP BY (minute, symbol)
ORDER BY minute ASC
Upvotes: 1