I want to generate candlestick data from trade data for every 1 minutes.
Then how can I handle intervals with no data?
And open
is the same of close
. Can I do this with CQ?
name: trades
------------------------
time price
2017-08-28T08:15:00Z 16.75
2017-08-28T08:15:06Z 17.75
2017-08-28T08:15:08Z 14.80
2017-08-28T08:17:10Z 16.20
CREATE CONTINUOUS QUERY "cq_basic" ON "db"
BEGIN
SELECT first("price") as open, last("price") as close, max("price") as high, min("price") as low INTO "candlesticks" FROM "trades" GROUP BY time(1m)
END
name: candlesticks
------------------------
time open close high low
2017-08-28T08:15:00Z 16.75 16.20 17.75 14.80
2017-08-28T08:17:00Z 14.80 16.20 16.20 14.80
There is no ‘2017-08-28T08:16:00Z’ data.
Is there anyway to handle interval with no data?
fill()
is not a good solution for it.