将最新的K线移入查询K线库 - Xiaotian0617/Center GitHub Wiki

交易计算K线的转移

CREATE CONTINUOUS QUERY cq_transfer_calc_kline_1m ON Kline1m RESAMPLE EVERY 5s FOR 2m BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline1m."1d".calc_kline FROM TopCoinDB.autogen.calc_kline GROUP BY exchange, symbol, unit, time(1m) END;

CREATE CONTINUOUS QUERY cq_transfer_calc_kline_3m ON Kline3m RESAMPLE EVERY 5s FOR 6m BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline3m."3d".calc_kline_3m FROM TopCoinDB.autogen.calc_kline_3m GROUP BY exchange, symbol, unit, time(3m) END;

CREATE CONTINUOUS QUERY cq_transfer_calc_kline_5m ON Kline5m RESAMPLE EVERY 5s FOR 10m BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline5m."5d".calc_kline_5m FROM TopCoinDB.autogen.calc_kline_5m GROUP BY exchange, symbol, unit, time(5m) END;

CREATE CONTINUOUS QUERY cq_transfer_calc_kline_10m ON Kline10m RESAMPLE EVERY 5s FOR 20m BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline10m."10d".calc_kline_10m FROM TopCoinDB.autogen.calc_kline_10m GROUP BY exchange, symbol, unit, time(10m) END;

CREATE CONTINUOUS QUERY cq_transfer_calc_kline_15m ON Kline15m RESAMPLE EVERY 5s FOR 30m BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline15m."15d".calc_kline_15m FROM TopCoinDB.autogen.calc_kline_15m GROUP BY exchange, symbol, unit, time(15m) END;

CREATE CONTINUOUS QUERY cq_transfer_calc_kline_30m ON Kline30m RESAMPLE EVERY 5s FOR 1h BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline30m."30d".calc_kline_30m FROM TopCoinDB.autogen.calc_kline_30m GROUP BY exchange, symbol, unit, time(30m) END;

CREATE CONTINUOUS QUERY cq_transfer_calc_kline_1h ON Kline1h RESAMPLE EVERY 5s FOR 2h BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline1h."60d".calc_kline_1h FROM TopCoinDB.autogen.calc_kline_1h GROUP BY exchange, symbol, unit, time(1h) END;

CREATE CONTINUOUS QUERY cq_transfer_calc_kline_2h ON Kline2h RESAMPLE EVERY 5s FOR 4h BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline2h."120d".calc_kline_2h FROM TopCoinDB.autogen.calc_kline_2h GROUP BY exchange, symbol, unit, time(2h) END;

CREATE CONTINUOUS QUERY cq_transfer_calc_kline_4h ON Kline4h RESAMPLE EVERY 5s FOR 8h BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline4h."240d".calc_kline_4h FROM TopCoinDB.autogen.calc_kline_4h GROUP BY exchange, symbol, unit, time(4h) END;

CREATE CONTINUOUS QUERY cq_transfer_calc_kline_6h ON Kline6h RESAMPLE EVERY 5s FOR 12h BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline6h."360d".calc_kline_6h FROM TopCoinDB.autogen.calc_kline_6h GROUP BY exchange, symbol, unit, time(6h) END;

CREATE CONTINUOUS QUERY cq_transfer_calc_kline_12h ON Kline12h RESAMPLE EVERY 5s FOR 1d BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline12h."720d".calc_kline_12h FROM TopCoinDB.autogen.calc_kline_12h GROUP BY exchange, symbol, unit, time(12h) END;

CREATE CONTINUOUS QUERY cq_transfer_calc_kline_1d ON Kline1d RESAMPLE EVERY 5s FOR 2d BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline1d."1dINF".calc_kline_1D FROM TopCoinDB.autogen.calc_kline_1D GROUP BY exchange, symbol, unit, time(1d) END;

CREATE CONTINUOUS QUERY cq_transfer_calc_kline_3d ON Kline3d RESAMPLE EVERY 5s FOR 6d BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline3d."3dINF".calc_kline_3D FROM TopCoinDB.autogen.calc_kline_3D GROUP BY exchange, symbol, unit, time(3d) END;

CREATE CONTINUOUS QUERY cq_transfer_calc_kline_1w ON Kline1w RESAMPLE EVERY 5s FOR 2w BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline1w."1wINF".calc_kline_1W FROM TopCoinDB.autogen.calc_kline_1W GROUP BY exchange, symbol, unit, time(1w) END;

DROP CONTINUOUS QUERY "cq_transfer_calc_kline_1m" ON "Kline1m";

DROP CONTINUOUS QUERY "cq_transfer_calc_kline_3m" ON "Kline3m";

DROP CONTINUOUS QUERY "cq_transfer_calc_kline_5m" ON "Kline5m";

DROP CONTINUOUS QUERY "cq_transfer_calc_kline_10m" ON "Kline10m"

DROP CONTINUOUS QUERY "cq_transfer_calc_kline_15m" ON "Kline15m";

DROP CONTINUOUS QUERY "cq_transfer_calc_kline_30m" ON "Kline30m";

DROP CONTINUOUS QUERY "cq_transfer_calc_kline_1h" ON "Kline1h";

DROP CONTINUOUS QUERY "cq_transfer_calc_kline_2h" ON "Kline2h";

DROP CONTINUOUS QUERY "cq_transfer_calc_kline_4h" ON "Kline4h";

DROP CONTINUOUS QUERY "cq_transfer_calc_kline_6h" ON "Kline6h";

DROP CONTINUOUS QUERY "cq_transfer_calc_kline_12h" ON "Kline12h";

DROP CONTINUOUS QUERY "cq_transfer_calc_kline_1d" ON "Kline1d";
DROP CONTINUOUS QUERY "cq_transfer_calc_kline_3d" ON "Kline3d";
DROP CONTINUOUS QUERY "cq_transfer_calc_kline_1w" ON "Kline1w";

交易所API的K线的转移


CREATE CONTINUOUS QUERY cq_transfer_kline_1m ON Kline1m RESAMPLE EVERY 5s FOR 2m BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline1m."1d".kline FROM TopCoinDB.autogen.kline GROUP BY exchange, symbol, unit, time(1m) END;

CREATE CONTINUOUS QUERY cq_transfer_kline_3m ON Kline3m RESAMPLE EVERY 5s FOR 6m BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline3m."3d".kline_3m FROM TopCoinDB.autogen.kline_3m GROUP BY exchange, symbol, unit, time(3m) END;

CREATE CONTINUOUS QUERY cq_transfer_kline_5m ON Kline5m RESAMPLE EVERY 5s FOR 10m BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline5m."5d".kline_5m FROM TopCoinDB.autogen.kline_5m GROUP BY exchange, symbol, unit, time(5m) END;

CREATE CONTINUOUS QUERY cq_transfer_kline_10m ON Kline10m RESAMPLE EVERY 5s FOR 20m BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline10m."10d".kline_10m FROM TopCoinDB.autogen.kline_10m GROUP BY exchange, symbol, unit, time(10m) END;


CREATE CONTINUOUS QUERY cq_transfer_kline_15m ON Kline15m RESAMPLE EVERY 5s FOR 30m BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline15m."15d".kline_15m FROM TopCoinDB.autogen.kline_15m GROUP BY exchange, symbol, unit, time(15m) END;

CREATE CONTINUOUS QUERY cq_transfer_kline_30m ON Kline30m RESAMPLE EVERY 5s FOR 1h BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline30m."30d".kline_30m FROM TopCoinDB.autogen.kline_30m GROUP BY exchange, symbol, unit, time(30m) END;

CREATE CONTINUOUS QUERY cq_transfer_kline_1h ON Kline1h RESAMPLE EVERY 5s FOR 2h BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline1h."60d".kline_1h FROM TopCoinDB.autogen.kline_1h GROUP BY exchange, symbol, unit, time(1h) END;

CREATE CONTINUOUS QUERY cq_transfer_kline_2h ON Kline2h RESAMPLE EVERY 5s FOR 4h BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline2h."120d".kline_2h FROM TopCoinDB.autogen.kline_2h GROUP BY exchange, symbol, unit, time(2h) END;

CREATE CONTINUOUS QUERY cq_transfer_kline_4h ON Kline4h RESAMPLE EVERY 5s FOR 8h BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline4h."240d".kline_4h FROM TopCoinDB.autogen.kline_4h GROUP BY exchange, symbol, unit, time(4h) END;

CREATE CONTINUOUS QUERY cq_transfer_kline_6h ON Kline6h RESAMPLE EVERY 5s FOR 12h BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline6h."360d".kline_6h FROM TopCoinDB.autogen.kline_6h GROUP BY exchange, symbol, unit, time(6h) END;

CREATE CONTINUOUS QUERY cq_transfer_kline_12h ON Kline12h RESAMPLE EVERY 5s FOR 1d BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline12h."720d".kline_12h FROM TopCoinDB.autogen.kline_12h GROUP BY exchange, symbol, unit, time(12h) END;

CREATE CONTINUOUS QUERY cq_transfer_kline_1d ON Kline1d RESAMPLE EVERY 5s FOR 2d BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline1d."1dINF".kline_1D FROM TopCoinDB.autogen.kline_1D GROUP BY exchange, symbol, unit, time(1d) END;

CREATE CONTINUOUS QUERY cq_transfer_kline_3d ON Kline3d RESAMPLE EVERY 5s FOR 6d BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline3d."3dINF".kline_3D FROM TopCoinDB.autogen.kline_3D GROUP BY exchange, symbol, unit, time(3d) END;

CREATE CONTINUOUS QUERY cq_transfer_kline_1w ON Kline1w RESAMPLE EVERY 5s FOR 2w BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline1w."1wINF".kline_1W FROM TopCoinDB.autogen.kline_1W GROUP BY exchange, symbol, unit, time(1w) END;

DROP CONTINUOUS QUERY "cq_transfer_kline_1m" ON "Kline1m";

DROP CONTINUOUS QUERY "cq_transfer_kline_3m" ON "Kline3m";

DROP CONTINUOUS QUERY "cq_transfer_kline_5m" ON "Kline5m";

DROP CONTINUOUS QUERY "cq_transfer_kline_10m" ON "Kline10m"

DROP CONTINUOUS QUERY "cq_transfer_kline_15m" ON "Kline15m";

DROP CONTINUOUS QUERY "cq_transfer_kline_30m" ON "Kline30m";

DROP CONTINUOUS QUERY "cq_transfer_kline_1h" ON "Kline1h";

DROP CONTINUOUS QUERY "cq_transfer_kline_2h" ON "Kline2h";

DROP CONTINUOUS QUERY "cq_transfer_kline_4h" ON "Kline4h";

DROP CONTINUOUS QUERY "cq_transfer_kline_6h" ON "Kline6h";

DROP CONTINUOUS QUERY "cq_transfer_kline_12h" ON "Kline12h";

DROP CONTINUOUS QUERY "cq_transfer_kline_1d" ON "Kline1d";

DROP CONTINUOUS QUERY "cq_transfer_kline_3d" ON "Kline3d";

DROP CONTINUOUS QUERY "cq_transfer_kline_1w" ON "Kline1w";

无量K线转移


CREATE CONTINUOUS QUERY cq_transfer_no_vol_kline_1m ON Kline1m RESAMPLE EVERY 15s FOR 2m BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline1m."1d".no_vol_kline FROM TopCoinDB.autogen.no_vol_kline GROUP BY exchange, symbol, unit, time(1m) END;

CREATE CONTINUOUS QUERY cq_transfer_no_vol_kline_3m ON Kline3m RESAMPLE EVERY 15s FOR 6m BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline3m."3d".no_vol_kline_3m FROM TopCoinDB.autogen.no_vol_kline_3m GROUP BY exchange, symbol, unit, time(3m) END;

CREATE CONTINUOUS QUERY cq_transfer_no_vol_kline_5m ON Kline5m RESAMPLE EVERY 15s FOR 10m BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline5m."5d".no_vol_kline_5m FROM TopCoinDB.autogen.no_vol_kline_5m GROUP BY exchange, symbol, unit, time(5m) END;

CREATE CONTINUOUS QUERY cq_transfer_no_vol_kline_10m ON Kline10m RESAMPLE EVERY 15s FOR 20m BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline10m."10d".no_vol_kline_10m FROM TopCoinDB.autogen.no_vol_kline_10m GROUP BY exchange, symbol, unit, time(10m) END;


CREATE CONTINUOUS QUERY cq_transfer_no_vol_kline_15m ON Kline15m RESAMPLE EVERY 15s FOR 30m BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline15m."15d".no_vol_kline_15m FROM TopCoinDB.autogen.no_vol_kline_15m GROUP BY exchange, symbol, unit, time(15m) END;

CREATE CONTINUOUS QUERY cq_transfer_no_vol_kline_30m ON Kline30m RESAMPLE EVERY 15s FOR 1h BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline30m."30d".no_vol_kline_30m FROM TopCoinDB.autogen.no_vol_kline_30m GROUP BY exchange, symbol, unit, time(30m) END;

CREATE CONTINUOUS QUERY cq_transfer_no_vol_kline_1h ON Kline1h RESAMPLE EVERY 15s FOR 2h BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline1h."60d".no_vol_kline_1h FROM TopCoinDB.autogen.no_vol_kline_1h GROUP BY exchange, symbol, unit, time(1h) END;

CREATE CONTINUOUS QUERY cq_transfer_no_vol_kline_2h ON Kline2h RESAMPLE EVERY 15s FOR 4h BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline2h."120d".no_vol_kline_2h FROM TopCoinDB.autogen.no_vol_kline_2h GROUP BY exchange, symbol, unit, time(2h) END;

CREATE CONTINUOUS QUERY cq_transfer_no_vol_kline_4h ON Kline4h RESAMPLE EVERY 15s FOR 8h BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline4h."240d".no_vol_kline_4h FROM TopCoinDB.autogen.no_vol_kline_4h GROUP BY exchange, symbol, unit, time(4h) END;

CREATE CONTINUOUS QUERY cq_transfer_no_vol_kline_6h ON Kline6h RESAMPLE EVERY 15s FOR 12h BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline6h."360d".no_vol_kline_6h FROM TopCoinDB.autogen.no_vol_kline_6h GROUP BY exchange, symbol, unit, time(6h) END;

CREATE CONTINUOUS QUERY cq_transfer_no_vol_kline_12h ON Kline12h RESAMPLE EVERY 15s FOR 1d BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline12h."720d".no_vol_kline_12h FROM TopCoinDB.autogen.no_vol_kline_12h GROUP BY exchange, symbol, unit, time(12h) END;

CREATE CONTINUOUS QUERY cq_transfer_no_vol_kline_1d ON Kline1d RESAMPLE EVERY 15s FOR 2d BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline1d."1dINF".no_vol_kline_1D FROM TopCoinDB.autogen.no_vol_kline_1D GROUP BY exchange, symbol, unit, time(1d) END;

CREATE CONTINUOUS QUERY cq_transfer_no_vol_kline_1d ON Kline1d RESAMPLE EVERY 15s FOR 2d BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline3d."1dINF".no_vol_kline_3D FROM TopCoinDB.autogen.no_vol_kline_3D GROUP BY exchange, symbol, unit, time(1d) END;

CREATE CONTINUOUS QUERY cq_transfer_no_vol_kline_1w ON Kline1w RESAMPLE EVERY 15s FOR 2w BEGIN SELECT close, high, low, last(onlyKey) as onlyKey,open, volume INTO Kline1w."1wINF".no_vol_kline_1W FROM TopCoinDB.autogen.no_vol_kline_1W GROUP BY exchange, symbol, unit, time(1w) END;


DROP CONTINUOUS QUERY "cq_transfer_no_vol_kline_1m" ON "Kline1m";

DROP CONTINUOUS QUERY "cq_transfer_no_vol_kline_3m" ON "Kline3m";

DROP CONTINUOUS QUERY "cq_transfer_no_vol_kline_5m" ON "Kline5m";

DROP CONTINUOUS QUERY "cq_transfer_no_vol_kline_15m" ON "Kline15m";

DROP CONTINUOUS QUERY "cq_transfer_no_vol_kline_30m" ON "Kline30m";

DROP CONTINUOUS QUERY "cq_transfer_no_vol_kline_1h" ON "Kline1h";

DROP CONTINUOUS QUERY "cq_transfer_no_vol_kline_2h" ON "Kline2h";

DROP CONTINUOUS QUERY "cq_transfer_no_vol_kline_4h" ON "Kline4h";

DROP CONTINUOUS QUERY "cq_transfer_no_vol_kline_6h" ON "Kline6h";

DROP CONTINUOUS QUERY "cq_transfer_no_vol_kline_12h" ON "Kline12h";

DROP CONTINUOUS QUERY "cq_transfer_no_vol_kline_1d" ON "Kline1d";

DROP CONTINUOUS QUERY "cq_transfer_no_vol_kline_3d" ON "Kline3d";

DROP CONTINUOUS QUERY "cq_transfer_no_vol_kline_1w" ON "Kline1w";