feat: vertical 3-column timeline + MA regime bootstrap engine

- TimelineVertical: replace horizontal frise with Y=time vertical layout,
  3 columns (Long/Medium/Short), auto-scroll to selected date, sub-columns
  for overlapping events, today/selected-date horizontal lines
- ma_analyzer.py: detect MA50/MA200 crossovers + MA100 slope changes +
  MA20 direction swings on EUR/USD, Brent, Gold, S&P500, US10Y (5y history)
  with 5-bar confirmation, dedup, GPT-4o-mini enrichment, idempotent DB save
- POST /api/timeline/bootstrap-ma endpoint to trigger analysis
- Bootstrap MA button in Timeline page with loading state + result count

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OpenSquared
2026-06-24 21:01:01 +02:00
parent aeb5233deb
commit edfa90c9b7
4 changed files with 922 additions and 4 deletions

View File

@@ -209,3 +209,15 @@ def bootstrap_events() -> Dict[str, Any]:
from services.timeline_service import bootstrap_events as _bootstrap
count = _bootstrap()
return {"seeded": count, "status": "ok" if count > 0 else "already_seeded"}
@router.post("/bootstrap-ma")
async def bootstrap_ma() -> Dict[str, Any]:
"""Detect MA ruptures on 5 key underlyings and generate historical market events via GPT."""
from services.ma_analyzer import bootstrap_ma_events
try:
result = await bootstrap_ma_events()
return {**result, "status": "ok"}
except Exception as e:
logger.error(f"[Timeline] bootstrap-ma failed: {e}")
raise HTTPException(500, str(e))