Compress forex tick data

I have a lot of raw tick data in influx I need to compress down to OHCLV values per period.

For example I have a hundered ticks in “ticker”.“7d” and I need to run something like:

SELECT first(price) as “open”, low(price) as “low”, max(price) as “high”, last(price) as “close”, sum(quantity) as "volume"
INTO ticker."30s"
FROM ticker."tick"
GROUP BY time(30s)

I have 800 measurements I need to do this on and it should eventually be a continuous query.

Any advice?