Created
March 15, 2022 07:26
-
-
Save ereshzealous/7974beec2f9ab4fbb9565122e5f8f792 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: -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