Skip to content

Instantly share code, notes, and snippets.

# Download the talisman installer script
curl https://thoughtworks.github.io/talisman/install.sh > ~/install-talisman.sh
chmod +x ~/install-talisman.sh
# Install to a single project
cd <project-folder>
# as a pre-push hook
@ereshzealous
ereshzealous / Talisman.md
Last active September 7, 2023 04:38
Talisman on single repo
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()
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)
from(bucket: "local")
|> range(start: -37d, stop: now())
|> filter(fn: (r) => r["_measurement"] == "ticks")
|> filter(fn: (r) => r["_field"] == "price")
|> filter(fn: (r) => r["product"] == "AGUX/USD")
|> window(period: 1h)
|> first()
|> yield(name: "first")
from(bucket: "local")
|> range(start: -30d, stop: now())
|> filter(fn: (r) => r["_measurement"] == "ticks")
|> filter(fn: (r) => r["_field"] == "price")
|> filter(fn: (r) => r["product"] == "AGUX/USD")
|> window(period: 1h)
|> first()
|> yield(name: "first")
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
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
option task = {name: "daily_aggregate", every: 1d}
max = from(bucket: "local")
|> range(start: -1y)
|> filter(fn: (r) =>
(r["_measurement"] == "ticks"))
|> filter(fn: (r) =>
(r["_field"] == "price"))
|> aggregateWindow(every: 1d, fn: max, createEmpty: false)
data = from(bucket: "daily-aggregate")
|> 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()