Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Solver PnL report

Template: solver-pnl-report ยท category: intents ยท risk: monitor_only

A cron report over your solver's OWN journal. Each schedule tick it queries rflow's Postgres journal for the named fill workflow and posts a one-line summary: intents seen, how many filled, how many skipped/raced, how many failed, and the native value the fills moved (the journaled send value โ€” not gas cost; gas lives in the spend ledger). Point it at the same database your solver writes to. Monitor-only: no networks, no signer โ€” it reads rflow.* and notifies.

When to use it

  • a nightly / hourly digest of solver activity without a separate dashboard
  • turn skipped/raced orders into a visible number instead of silent no-ops
  • track fills and native value moved from the journal, no extra instrumentation (for gas cost, use rflow spend / the spend ledger)

Generate it

rflow new --template solver-pnl-report
 
# or add the workflow to an existing project
rflow add workflow solver-pnl-report

Non-interactive (CI/agents):

rflow new --template solver-pnl-report --yes --output ./pnl \
  --answer fill_workflow=fill-intent --answer report_window="24 hours"

Inputs

keytypedefault
project_namestringsolver-pnl-report
fill_workflowstringfill-intent
report_croncron0 * * * *
report_windowstring (pg interval)1 hour
native_symbolstringETH
channelstringops

Required env vars

DATABASE_URL (the same database your solver writes to), TG_BOT_TOKEN, TG_CHAT_ID โ€” all listed in the generated .env.example.

Safety notes

Monitor-only: no networks: and no signer:, so neither embedded engine boots. The query runs read-only inside a Postgres READ ONLY transaction. It reads only the always-present journal (rflow.workflow_runs, rflow.step_runs) โ€” it does NOT depend on any native-spend-tracking tables. The workflow ends in on_failure: dead_letter.

Run it locally

docker compose up -d     # postgres on localhost:5448
# fill .env, point DATABASE_URL at your solver's database
rflow validate
rflow start

Common modifications

  • add token-inventory PnL by joining your indexed settlement Filled rows
  • swap the channel for slack/discord/pagerduty: rflow add notification
  • widen report_window for a daily digest