feat: VaR/PnL schedulers + snapshots DB + page sur bouton
Backend: - Tables var_snapshots + pnl_snapshots dans SQLite (contexte macro + prix tickers) - var_service.py : save_var_snapshot, save_pnl_snapshot + fonctions get_* - var_scheduler.py : threads APScheduler pour VaR (défaut 6h) et PnL (défaut 1h) - router var.py : /run-now (POST compute+save), /latest, /snapshots, /pnl/run-now, /pnl/latest, /scheduler/status, /scheduler/config - main.py : démarrage des deux schedulers au startup Frontend: - VaRAnalysis.tsx : plus d'auto-fetch ; charge le dernier snapshot DB au mount ; bouton "Calculer" → POST /run-now ; erreur backend = message clair ; historique de snapshots sélectionnables - Config.tsx : section "Schedulers VaR & PnL" dans l'onglet cycle avec toggle enable/disable, intervalle, et boutons "Snapshot maintenant" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -75,12 +75,19 @@ def startup():
|
||||
# Start auto-cycle scheduler if enabled
|
||||
from services.auto_cycle import start_scheduler
|
||||
start_scheduler()
|
||||
# Start VaR + PnL snapshot schedulers
|
||||
from services.var_scheduler import start_var_scheduler, start_pnl_scheduler
|
||||
start_var_scheduler()
|
||||
start_pnl_scheduler()
|
||||
|
||||
|
||||
@app.on_event("shutdown")
|
||||
def shutdown():
|
||||
from services.auto_cycle import stop_scheduler
|
||||
stop_scheduler()
|
||||
from services.var_scheduler import stop_var_scheduler, stop_pnl_scheduler
|
||||
stop_var_scheduler()
|
||||
stop_pnl_scheduler()
|
||||
|
||||
|
||||
app.include_router(market_data.router)
|
||||
|
||||
Reference in New Issue
Block a user