Skip to content

Instantly share code, notes, and snippets.

@halink0803
Created October 26, 2018 05:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halink0803/b4e9f51a0d7bb6fa361d1e058b227e6a to your computer and use it in GitHub Desktop.
Save halink0803/b4e9f51a0d7bb6fa361d1e058b227e6a to your computer and use it in GitHub Desktop.
CREATE CONTINUOUS QUERY "wallet_fee" ON "trade_logs"
RESAMPLE EVERY 1h FOR 1d
BEGIN
SELECT SUM("amount") as "sum_amount"
INTO "hourly_wallet_fees"
FROM "wallet_fees"
GROUP BY "reserve_addr", "wallet_addr", time(1h)
END
CREATE CONTINUOUS QUERY "wallet_fee_1d" ON "trade_logs"
RESAMPLE EVERY 1d FOR 3d
BEGIN
SELECT SUM("amount") as "sum_amount"
INTO "daily_wallet_fees"
FROM "wallet_fees"
GROUP BY "reserve_addr", "wallet_addr", time(1d)
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment