Files
momentum-system/grafana/README.md
momentum devandClaude Opus 4.8 020eec7f96 WS5 Grafana dashboards + RSS news-catalyst discovery
- grafana/: docker-compose + provisioned Postgres datasource + 'Momentum — Live'
  dashboard (evaluation board with status colours, ready signals, risk events,
  bars + equity timeseries) reading the event store via JSONB extraction.
  Run: cd grafana && docker compose up -d -> http://localhost:3000.
- RSS news-catalyst discovery wired: extract_tickers also matches $CASHTAGS;
  run_discovery pulls tickers from recent news into the universe when NEWS_FEEDS
  is set (no-op / safe otherwise).
- docs: .env.example NEWS_FEEDS; GO_LIVE monitoring adds 'momentum watch' + Grafana.

67/67 tests green. Live board (momentum watch) verified rendering the evaluation
board with real determinations.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 09:00:22 -04:00

41 lines
1.7 KiB
Markdown

# Grafana — live remote monitoring
A polished, remote, auto-refreshing view of the momentum system over the
Postgres event store. Complements `momentum_cli.py watch` (terminal) and pgAdmin.
## Run
```bash
cd grafana
docker compose up -d
# open http://localhost:3000 (anonymous admin, no login)
```
The **Momentum** Postgres datasource and the **Momentum — Live** dashboard are
auto-provisioned. The dashboard refreshes every 5s.
## Panels
- **Account equity / Ready signals / Symbols evaluated** — top-line stats.
- **Evaluation board** — every symbol it's looking at with status
(ready/late/blocked, colour-coded), score, gap%, RVOL, and the reason —
the same determinations as `momentum watch`, sorted by score.
- **Ready signals** and **Risk events** (circuit breaker / back-outs).
- **Minute bars ingested** and **Account equity** over time.
## Datasource note
`provisioning/datasources/momentum.yaml` points at `192.168.1.5:5432`
(your Postgres on the LAN). From inside the Grafana container `127.0.0.1` is the
container itself — use the LAN IP, or `host.docker.internal:5432` on Docker
Desktop/WSL. Credentials are the dev `admin` / `password`; change for anything
beyond local use.
## How it reads the data
Everything is plain SQL over the `events` table, extracting fields from the JSON
payload, e.g.:
```sql
SELECT payload_json::jsonb->>'symbol' AS symbol,
payload_json::jsonb->'criteria_results'->>'status' AS status,
(payload_json::jsonb->>'success_score_pct')::float AS score
FROM events WHERE event_type='criteria_evaluated';
```
So you can build your own panels/alerts (e.g. alert when a `risk_rule_triggered`
row with `rule_type='daily_loss'` appears).