根据原始分笔数据生成机构单,买入金额,买入笔数,卖出金额,卖出笔数 - Xiaotian0617/Center GitHub Wiki
#每5分钟计算一次整点5分钟的下面数据。(一直保存)
#机构单,买入金额,买入笔数,卖出金额,卖出笔数
#超大单,买入金额,买入笔数,卖出金额,卖出笔数
#大单,买入金额,买入笔数,卖出金额,卖出笔数
#中单,买入金额,买入笔数,卖出金额,卖出笔数
#小单,买入金额,买入笔数,卖出金额,卖出笔数
#流入流出净流入。
CREATE CONTINUOUS QUERY cq_calc_trade_5m ON tradestatistic RESAMPLE EVERY 10s FOR 10m
BEGIN
SELECT sum("amount") AS "amount", count("amount") INTO "tradestatistic"."forever"."aggregatedtrade_5m" FROM "tradestatistic"."onehours"."aggregatedtrade" group by *,time(5m)
END;
#统计每天的流入流出数据
CREATE CONTINUOUS QUERY cq_calc_trade_1d ON tradestatistic RESAMPLE EVERY 10s FOR 2d
BEGIN
SELECT sum("amount") AS "amount", count("amount") INTO "tradestatistic"."forever"."aggregatedtrade_1d" FROM "tradestatistic"."forever"."aggregatedtrade_5m" group by *,time(1d)
END;