mirror of
https://github.com/Alkatrazz24/Funk-lab.git
synced 2026-07-08 06:24:42 +02:00
feat(finlab): alertes de prix par email (watcher sidecar, boucle 5 min) (#71)
Permet de configurer des alertes « préviens-moi par mail quand NVDA atteint 200$ » depuis la Console IA. Un sidecar surveille les cours en continu. - finlab/watcher.py : boucle toutes les 5 min, lit price_alerts.yaml (workspace), évalue les seuils above/below, envoie un email au franchissement. Anti-spam (1 mail/seuil, état .watcher-state.json, ré-armé en ré-éditant). Modes --once / --test - Email via le relais postfix du lab (storage-01:25, SMTP_HOST) qui réécrit l'expéditeur en Gmail — AUCUN secret (pods k8s dans mynetworks) - price_alerts.yaml : config seedée dans le workspace (email_to + rules), éditée par la Console IA sur demande - deployment : conteneur sidecar `watcher` (boucle 5 min, ressources minimes) - Dockerfile : seed price_alerts.yaml ; persona console + admin/ia/finlab.md documentés Logique testée en local (SMTP mocké) : franchissement → envoi, anti-spam au 2e run, seuil non atteint → rien. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
b032820f23
commit
3c55ee968d
6 changed files with 207 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ trader concentré tech/semis, philosophie R:R/concentration/discipline).
|
|||
| initContainer `seed` | Peuple le workspace (`cp -rn`), robuste au piège NFS (fsGroup non honoré → recrée le dossier s'il est root/non-inscriptible). Tourne avant les conteneurs |
|
||||
| container `dashboard` | `uvicorn dashboard.server:app` :8800 — UI + API JSON finlab |
|
||||
| container `console` | `ttyd -b /console` :7681 → `claude` dans le workspace |
|
||||
| container `watcher` | `python -m finlab.watcher` — alertes de prix par email, boucle **5 min** |
|
||||
| Cerveau (console) | **Abonnement Claude Code** (login OAuth persisté dans `~/.claude` sur le PVC) — pas de clé API |
|
||||
| Code vs data | Code (`finlab` + `dashboard`) dans l'image `/opt/app` (maj avec l'image) ; configs éditables via **`FINLAB_HOME=/home/finlab/workspace`** (PVC) |
|
||||
| PVC `finlab-data` | 5Gi NFS → `/home/finlab` : login + workspace (configs + `.cache`) |
|
||||
|
|
@ -57,6 +58,16 @@ Checklist détaillée : `k8s/apps/finlab/README.md`.
|
|||
1. Secrets manuels dans `ai` : `ghcr-pull` (pull GHCR) + `finlab-auth` (htpasswd basicAuth).
|
||||
2. Ouvrir `finance.lab.local` → `claude` → `/login` (abonnement, persisté sur le PVC).
|
||||
|
||||
## Alertes de prix par email
|
||||
|
||||
Sidecar **`watcher`** (`finlab/watcher.py`) : boucle **toutes les 5 min**, lit
|
||||
**`price_alerts.yaml`** (workspace), et envoie un email quand un seuil (`above`/`below`) est
|
||||
franchi. Envoi via le **relais postfix du lab** (`storage-01:25`, `SMTP_HOST`) qui réécrit
|
||||
l'expéditeur en Gmail — **aucun secret** (les pods k8s sont dans `mynetworks`, cf.
|
||||
`admin/infra/email.md`). Anti-spam : un seuil ne notifie qu'**une** fois (état `.watcher-state.json`),
|
||||
ré-armé en ré-éditant la règle. La **Console IA édite `price_alerts.yaml`** sur demande
|
||||
(« mets un mail quand NVDA atteint 200$ »). Test : `python -m finlab.watcher --test <email>` / `--once`.
|
||||
|
||||
## Accès programmatique
|
||||
|
||||
- **MCP dans le repo lab** : `.mcp.json` racine pointe `tools/finlab/.venv` → outils finlab dans
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue