runrate-bot

Weekly gross revenue run-rate ping, posted to Slack #test every Friday. Independent of consensus/arr-bot.

The metric

Gross revenue run rate = trailing 28 complete days of gross payment volume Ɨ 13.

  • Gross volume = all successful Stripe charges (paid + captured), by charge date, FX-converted to USD — matches the dashboard's "Gross volume".
  • Pre-fee, pre-refund, no tax component (Consensus collects no tax via Stripe).
  • Window ends yesterday, so today's partial day is never counted.
  • WoW = vs the same 28-day window shifted back one week. Both windows come from one Sigma query over 35 days of charges — no stored state.
  • Validated against paid-invoice totals and Stripe's own gross_volume metric (all three agree within 0.01%).

Required env vars

šŸ‘‰ Add STRIPE_SECRET_KEY here: https://www.val.town/x/consensus/runrate-bot/environment-variables?key=STRIPE_SECRET_KEY

(Same restricted key as arr-bot: needs Sigma + Sigma API permissions and an active Sigma subscription.)

SLACK_TOKEN comes from Val Town's Slack integration — connect it on this val's dashboard (same flow as arr-bot).

Files

  • main.ts — interval handler: one Sigma query → run rate + WoW → Slack
  • sigma.ts — Sigma Query Run API client (copy of arr-bot's, kept local so this val is self-contained)

Schedule

Fridays 6pm PT — cron 0 1 * * 6 (01:00 UTC Saturday). Val Town cron is UTC-only with no DST adjustment, so this is 6pm during PDT (summer) and 5pm during PST (winter), same convention as arr-bot's daily digest.