Skip to Content
CLIReports

Reports

Create, change and run reports: tables of figures sent on a schedule. See Reports.

Requires contract-dev login. A report is named by its id or, when exactly one report has it, its name. A report and an alert may share a name: each command looks it up on its own list.

report

List every report: its name, when it sends, its status (Active or Paused), when it last ran, and its id. report list reads the same.

contract-dev report [list] [--status Active|Paused]
FlagDescription
--status Active|PausedOnly the reports in this status.

Where each one sends is in report show.

report create

A report has only what it is given: --row, --table and --users. It needs a name and at least one of them.

contract-dev report create "<name>" [--row <line>]… [--table "<table>[ | …]"]… [--users <Group>]… [--columns <w>,<w>…] [--compare] [--at <hour>] [--day <weekday>] [--tz <zone>] [--every <interval>] [--only-when "<expr>"] [--scope <scope>] [--to <dest>]…
FlagDescription
--row <line>A line, in order; repeat for more, up to 12. See Lines.
--table "<table> | …"Rows of a table under the lines. See Tables.
--users <Group>A group of users’ week under the lines. Repeat, or comma-separate: Traders,LPs. See Groups of users.
--columns <w>,<w>…The windows every line prints, in order: 24h, 24h,7d,30d, 15m. Units m, h, d, w, y; 1 minute at the least. Required with --row.
--compareAdd the change against the window before, beside the first window.
--at <hour>The hour it sends, 0–23. Default 9.
--day <weekday>Weekly, on this day: monday…sunday, its first three letters or more (mon), or 1–7 from Monday. Without it the report is daily.
--tz <zone>The time zone --at reads, as an IANA name: Europe/London. Default: the machine’s.
--every <interval>Every interval instead, from 1m to 7d: 1m, 10m, 1h, 6h, 1d. On the UTC clock and aligned to it, so 10m runs at :00, :10, … Ignores --at and --tz. Not with --day.
--only-when "<expr>"Send only when this holds. See Send only when.
--scope <scope>What the lines add up over: workspace (default), group:<group>, or a watched contract’s name or address.
--to <dest>Destinations by id, label or kind, from channel; repeat or comma-separate. Optional.

A report sends at most 3 tables and groups of users together.

contract-dev report create "Daily" --row metric:"Swap volume" --row metric:"Swap fees" --row newWallets \ --table "Swaps | sort {Amount} | top 5 | days 1" --columns 24h --compare --to "#general" contract-dev report create "Morning" --row transactions --row metric:"Treasury ETH" --columns 24h,7d --at 9 --tz Europe/London contract-dev report create "Hourly swaps" --every 1h --row eventCount:Swap --columns 1h --to telegram contract-dev report create "Risk" --every 10m --row metric:"Breached markets" --columns 10m \ --only-when "{Breached markets} > 0" --to "#risk"

The command prints the report’s settings and queues its first table. That table shows on the report’s page within a minute and is not sent; the first message goes out at the first scheduled time, or on report run. Without a destination the report still runs, and its runs show on its page in the app.

Lines

--rowPrints asLine
transactionsTransactionsTransactions that reached the scope, each counted once.
revertedShareRevertedThe share of those that reverted. Its change is in percentage points.
newWalletsNew walletsWallets whose first transaction to the scope falls in the window.
activeWalletsActive walletsWallets that sent a transaction to the scope.
volumeInUsd · volumeOutUsdVolume in · Volume outTokens and the chain’s own coin moved into or out of the scope, in dollars at current prices. Not a protocol’s own trading volume.
alertsOpenedAlerts openedCondition alerts that opened.
eventCount:<Event>The event’s nameHow many times the event was emitted.
metric:"<name>"The metric’s nameAny metric, state or activity.
"metric:<name>=<clauses>"<name>A metric made for this report, in the clauses of metric create: "metric:Supply=on steth; call totalSupply()". It stays off the Metrics page and is deleted with the report when nothing else uses it.
"formula:<Label>=<expr>…"<Label>A value worked out from reads. See Formula lines.

Two endings change a line:

  • <line>@<scope> — The line covers its own scope instead of the report’s: transactions@group:pools, volumeInUsd@steth. It prints as Transactions · pools. Not on a metric line.
  • <line> | nocompare — The line prints without the change: "newWallets | nocompare".

--only-when names a line as the report prints it: {Transactions · pools}. --remove-row names it as report show lists it: "Transactions @ group:pools".

Formula lines

--row "formula:<Label>=<expr>; call <name>=<call>[; call …][; token <token>][; show usd]"

The expression is read on every contract in the scope, up to 64, and added up. Every column shows its value now; its change compares with its value at the start of the window.

ClauseDescription
call <name>=<call>A read the expression names, written as in Formulas.
token <token>The token the value counts in: self, an address, or a view such as asset().
show usdWith token, print dollars at the current price.

ago(<call>, window) in the expression reads the call at the start of each column’s own window: rate - ago(rate, window) is the day’s change in the 24h column and the week’s in the 7d column.

contract-dev report create "Vault" --scope vault --columns 24h,7d \ --row "formula:Headroom=held - debt; call held=totalAssets(); call debt=totalDebt(); token asset(); show usd"

Tables

--table "<table> | sort <col> [asc] | top <n> | where <expr> | days <n> | columns a,b | among active|done|all | label <name>"

The table by name or id, then its clauses, each after a |. Each run asks the table again.

ClauseDescription
sort <col>Rank by a column or expression, largest first; asc for smallest first.
top <n>The rows sent, 1 to 25. Default 10.
where <expr>Only the rows where this holds, on top of the table’s own filter.
days <n>How far back an activity table reaches, 1 to 365: days 1 for a daily report, days 7 for a weekly one. Default: the table’s own.
columns a,bThe columns sent, by key or label, up to 5. Default: the table’s first 5.
among active|done|allWhich rows of a state table: active (default), finished in the last 30 days, or all.
label <name>The name the table is sent under.

"<name>=<clauses>" makes a table for this report alone, in the clauses of table create separated by ;, before any |: "Deposits=on vault; each Deposit | top 5 | days 1". It stays off the Tables page and is deleted with the report when no other report sends it.

contract-dev report create "Big swaps" --table "Swaps | sort {Amount} | top 5 | days 1" --to "#trades"

Groups of users

--users <Group>[,<Group>…]

Sends a group of users’ week under the lines: its new users, and which of its largest accounts are gone, at risk, or new and already large. It covers the last 7 days, so it belongs on a weekly report. Each group counts among the report’s 3 tables. See Groups of users.

contract-dev report create "Weekly users" --users Traders,LPs --day monday --to "#growth"

Send only when

--only-when "<expr>"

A condition over the lines, each named in braces by what it prints and read in the first window: "{Breached markets} > 0", "{Transactions} >= 100 and {Reverted} < 0.05". When it does not hold, the run is kept on the report’s page as skipped and nothing is sent. When it cannot be judged, such as a name the report has no line for, the report is sent with a note.

report show <name>

A report’s settings, its latest run as sent, and its latest 50 runs, newest first, each with its trigger, its status and each destination’s delivery.

contract-dev report show "Morning"
StatusMeaning
sentEvery destination got it.
partialSome destinations got it; the others failed.
failedIt could not be built or sent. The line says why.
skippedIts --only-when did not hold.
in appIt has no destination: the run is on the report’s page.
indexingA metric or table it reads is still reading its history. It runs once that is done, and fails if it is still waiting a day later.
pending · renderedBeing built, or being sent.

A run’s trigger is schedule, manual (report run, or Run now in the app) or first (the table queued on create).

report update <name>

Change a report with the flags it was made with. It keeps its runs.

contract-dev report update <name> [--row <line>… | --add-row <line>… --remove-row <line>…] [--table … | --users … | --no-tables] [--columns …] [--compare | --snapshot] [--only-when "<expr>" | --always] [--at …] [--day …] [--tz …] [--every …] [--scope …] [--to <dest>…] [--name "<name>"]
FlagDescription
--row <line>Replace every line. Not with --add-row or --remove-row.
--add-row <line>Add a line at the end. Repeatable.
--remove-row <line>Remove a line by its name as report show lists it ("New wallets"), or every line of a kind by its word (newWallets). Repeatable.
--table · --usersReplace the tables and groups of users, which are one list.
--no-tablesRemove every table and group of users.
--compare · --snapshotAdd or remove the change.
--alwaysRemove --only-when.
--day <weekday>Make it weekly, on this day.
--every <interval>Make it run on this interval.
--to <dest>…Replace the destinations.
--name "<name>"Rename it.

--columns, --only-when, --at, --tz and --scope replace what they set, as on create.

contract-dev report update "Morning" --add-row volumeInUsd --remove-row transactions contract-dev report update "Daily" --columns 24h,7d,30d contract-dev report update "Risk" --always

report run <name>

Run a report now, off its schedule, and print its table. report send reads the same. Its destinations get it within a minute; without one, the run is on the report’s page in the app. When its --only-when does not hold, nothing is sent and the run is kept as skipped.

contract-dev report run "Morning"

Rename, pause, resume, delete

contract-dev report rename <name> "<new name>" contract-dev report pause <name> # send nothing until resumed contract-dev report resume <name> # from its next scheduled time contract-dev report delete <name>… # one or several, with their runs

A resumed report does not send the runs it missed while paused. delete resolves every name before deleting anything, so a typo deletes nothing. A name several reports share is never guessed at: use the id.

Last updated on