Skip to content

Instantly share code, notes, and snippets.

@ereshzealous
Created March 15, 2022 07:35
Show Gist options
  • Save ereshzealous/a306cc5e3833f03464315953d76627d3 to your computer and use it in GitHub Desktop.
Save ereshzealous/a306cc5e3833f03464315953d76627d3 to your computer and use it in GitHub Desktop.
from(bucket: "local")
|> range(start: -1y)
|> filter(fn: (r) => r["_measurement"] == "ticks")
|> filter(fn: (r) => r["_field"] == "price")
|> filter(fn: (r) => r["product"] == "AGUX/USD")
|> aggregateWindow(every: 1y, fn: max, createEmpty: false)
|> yield(name: "max")
from(bucket: "local")
|> range(start: -1y)
|> filter(fn: (r) => r["_measurement"] == "ticks")
|> filter(fn: (r) => r["_field"] == "price")
|> filter(fn: (r) => r["product"] == "AGUX/USD")
|> aggregateWindow(every: 1y, fn: min, createEmpty: false)
|> yield(name: "min")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment