Skip to content

Instantly share code, notes, and snippets.

@ereshzealous
Created March 15, 2022 06:31
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 ereshzealous/2f3270f76db474abb0783a29e5842401 to your computer and use it in GitHub Desktop.
Save ereshzealous/2f3270f76db474abb0783a29e5842401 to your computer and use it in GitHub Desktop.
data = from(bucket: "local")
|> range(start: -1d) |> filter(fn: (r) => r["_measurement"] == "ticks") |> filter(fn: (r) => r["product"] == "AGUX/USD") |> window(every: 1d) 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