I have this query:
CREATE MATERIALIZED VIEW candles_agg
WITH (timescaledb.continuous) AS
SELECT
time_bucket('10 day', ts_bucket) AS day_bucket,
json_agg(array[EXTRACT(EPOCH FROM ts_bucket), "open", high, low, "close", volume::BIGINT]) AS json_array_of_arrays
FROM
exchange.candles_d1
WHERE
ticker = 'BTCUSDT'
AND ts_bucket >= time_bucket('10 day', exchange.candles_d1.ts_bucket)
AND ts_bucket < time_bucket('10 day', exchange.candles_d1.ts_bucket) + INTERVAL '10 day'
GROUP BY
day_bucket;
how can I make the ‘aggregate’ a json array where each entry is an array representing one of the rows in the time bucket?