Created
March 15, 2022 07:36
-
-
Save ereshzealous/a36b5633be558109f09996fe452889cb 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: "daily-aggregate") | |
|> range(start: -1y) | |
|> filter(fn: (r) => r["_measurement"] == "ticks") | |
|> filter(fn: (r) => r["product"] == "AGUX/USD") | |
|> window(every: 1y) | |
max = data | |
|> filter(fn: (r) => r["_field"] == "max") | |
|> max() | |
|> set(key: "type", value: "max" ) | |
min = data | |
|> filter(fn: (r) => r["_field"] == "min") | |
|> min() | |
|> set(key: "type", value: "min" ) | |
union(tables: [min, max]) | |
|> group(columns:["type"], mode: "by") | |
|> yield() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment