feat: Config tab "Options — Paramètres" with IV gate controls + exit params

- New tab replaces "Journal & Sortie" — consolidates all options-specific settings
- IV Gate section: toggle on/off + 3 sliders (IVR High/Extreme/Skew threshold)
  with live color-coded summary and interdependency guards (high < extreme)
- Exit params section: target, stop-loss, reversal mode + threshold (moved from removed journal tab)
- Backend: GET/PUT /api/config/options-gate endpoint reads/writes 4 config DB keys
- useApi.ts: useOptionsGate + useSaveOptionsGate hooks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OpenSquared
2026-06-20 10:23:31 +02:00
parent c7ccf237d7
commit 39da3b8945
3 changed files with 282 additions and 77 deletions

View File

@@ -2,7 +2,7 @@ from fastapi import APIRouter
from pydantic import BaseModel
from typing import Dict, Any, Optional
import os
from services.database import get_all_config, set_config, get_sources, update_sources, get_analysis_config, save_analysis_config
from services.database import get_all_config, set_config, get_config, get_sources, update_sources, get_analysis_config, save_analysis_config
router = APIRouter(prefix="/api/config", tags=["config"])
@@ -89,3 +89,33 @@ def save_analysis_config_endpoint(req: AnalysisConfigRequest):
current["template"] = req.template
save_analysis_config(current)
return {"status": "ok", "config": current}
class OptionsGateRequest(BaseModel):
iv_gate_enabled: Optional[bool] = None
iv_gate_ivr_high: Optional[float] = None
iv_gate_ivr_extreme: Optional[float] = None
iv_gate_skew_threshold: Optional[float] = None
@router.get("/options-gate")
def get_options_gate():
return {
"iv_gate_enabled": (get_config("iv_gate_enabled") or "true").lower() == "true",
"iv_gate_ivr_high": float(get_config("iv_gate_ivr_high") or 60),
"iv_gate_ivr_extreme": float(get_config("iv_gate_ivr_extreme") or 80),
"iv_gate_skew_threshold": float(get_config("iv_gate_skew_threshold") or 8),
}
@router.put("/options-gate")
def save_options_gate(req: OptionsGateRequest):
if req.iv_gate_enabled is not None:
set_config("iv_gate_enabled", "true" if req.iv_gate_enabled else "false")
if req.iv_gate_ivr_high is not None:
set_config("iv_gate_ivr_high", str(req.iv_gate_ivr_high))
if req.iv_gate_ivr_extreme is not None:
set_config("iv_gate_ivr_extreme", str(req.iv_gate_ivr_extreme))
if req.iv_gate_skew_threshold is not None:
set_config("iv_gate_skew_threshold", str(req.iv_gate_skew_threshold))
return {"status": "ok"}