Created
March 15, 2022 07:21
-
-
Save ereshzealous/82ed83c5b8a88ebbc39d3b750350997d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = from(bucket: "local") | |
|> range(start: -30d) | |
|> filter(fn: (r) => r["_measurement"] == "ticks") | |
|> filter(fn: (r) => r["_field"] == "price") | |
|> filter(fn: (r) => r["product"] == "AGUX/USD") | |
|> window(every: 1w) min = data | |
|> min() | |
|> set(key: "type", value: "min" ) max = data | |
|> max() | |
|> set(key: "type", value: "max" ) first = data | |
|> first() | |
|> set(key: "type", value: "first" ) last = data | |
|> last() | |
|> set(key: "type", value: "last" ) union(tables: [min, max, first, last]) | |
|> group(columns:["type"], mode: "by") | |
|> yield() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment