initial commit — cassandra v0.1

Containerised macro-strategy dashboard: 4-panel web UI (indicators,
portfolio, flash news, AI strategic log), MariaDB store, hourly
ingestion jobs, OpenRouter-backed AI analysis.

Ports the four prototype scripts in the parent dir (market_pulse,
flash_news, trading212, strategic_log) into async services backed by a
persistent DB and served via FastAPI + Jinja2 + HTMX. APScheduler runs
as a separate compose service for crash-safety and easier restarts.

Portfolio composition + position names come live from Trading 212;
news per-ticker headlines reuse those names. Tone (NOVICE/INTERMEDIATE/
PRO) and analysis style (DRY/SPECULATIVE) are env-configurable and
stored on each log row so historical entries show what produced them.

Default model is deepseek/deepseek-v4-flash (overridable via env).
Light/dark theme toggle, sans-serif for prose surfaces, monospace for
data. Bearer-token auth, OpenRouter monthly cost cap, RSS feeds auto-
disabled on consecutive failures.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Giorgio Gilestro 2026-05-15 21:56:10 +01:00
commit a10409c02b
61 changed files with 4890 additions and 0 deletions

38
README.md Normal file
View file

@ -0,0 +1,38 @@
# Cassandra
Containerised macro-strategy dashboard — hourly market data, RSS news, Trading 212 portfolio, and an AI-generated strategic log. Read-only by design.
## Quick start
```bash
cp .env.example .env # fill in API keys; set CASSANDRA_TOKEN if exposing
docker compose up --build # db + app + scheduler + daily backup sidecar
open http://localhost:8000/
```
## Architecture
- **app** (FastAPI + Jinja2 + HTMX) — web dashboard on port 8000
- **scheduler** (APScheduler) — hourly ingestion jobs (market, news, portfolio, AI log)
- **db** (MariaDB 11) — quotes, headlines, portfolio snapshots, strategic logs, job runs
- **backup** (sidecar) — daily mariadb-dump to `./backup/`
See `/home/gg/.claude/plans/ok-i-think-this-tidy-lake.md` for the design plan.
## Config
| File | Purpose |
|---|---|
| `config/default.toml` | Universal data tables: indicator groups, RSS feeds, keyword presets |
| `config/portfolio.toml` | User-specific portfolios (overrides `default.toml`) |
| `.env` | Secrets and runtime knobs — mounted read-only into containers |
## Endpoints
- `GET /` — dashboard
- `GET /portfolio/{name}` — portfolio detail
- `GET /news` — news feed
- `GET /log` — strategic-log archive
- `GET /api/health` — job status (last success / failure per job)
All authenticated routes require `Authorization: Bearer $CASSANDRA_TOKEN` if the env is set; if unset, the app is open (LAN-only mode).