What would be the best solution to store tick data and then be able to pull it out in groups. What I mean by groups. Say you have data like this…

xyz-symbol, mid, spread

So now you want to group the data by every 100 ticks. Or say you want to group the data by range of mid 10-20, 20-30, 30-40, 40-50, etc for x time period. Or you just wanted to get OHLC so you could generate 1 min OHLC or 4hr OHLC??

When I try and select data with the following:

select first(mid) as open, max(mid) as high, min(mid) as low, last(mid) as close, sum(mid) as mid, MOVING_AVERAGE(/mid/,5) as ma5, MOVING_AVERAGE(/mid/,99) as ma99 from tick where (time >= now() - 1h) and symbol=‘EURUSD’ group by symbol, time(1m)

I get the following error:

ERR: error parsing query: aggregate function required inside the call to moving_average

If I remove the moving average it works.

How would you create a structure to hold the data in influx where the data could be pulled out?? In PostgreSQL this if very straight forward with tables and group by in selects.

Since I am very new to influxdb like less than a week. I am having real hard time trying to understand how to do the simple things like create a table!!! inserting data into table…

Has anyone on here used influxdb for tick data in financial markets? If you have would you post the layout on how to create the storage in influxdb!