feat: eco calendar bootstrap + driver types + timeline cursor

Backend:
- eco_calendar_bootstrap.py: 75 historical events 2020-2026 (FOMC, NFP,
  CPI, GDP, ISM, BOJ, ECB, BOE) with expected_value/actual_value/
  surprise_pct/unit/absorption_pct fields
- database.py: 5 new columns on market_events (expected_value,
  actual_value, surprise_pct, unit, sub_type) + updated save_market_event
- timeline.py: POST /api/timeline/bootstrap-eco endpoint
- instrument_service.py: _get_relevant_events now returns eco fields
- instruments.json: type field on all 90 drivers across 20 instruments
  (event_calendar | report | geopolitical | fundamental | sentiment | technical)

Frontend (InstrumentDashboard):
- EventTimelineStrip: vertical cursor line tracking crosshair selectedDate
- EventsCard: active-event highlight at hovered date + expected/actual/
  surprise_pct display + absorption progress bar
- DriversPanel: type selector dropdown per driver
- DriverTypeBadge: colored micro-badge on driver labels in strip

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OpenSquared
2026-06-25 00:07:41 +02:00
parent aec9ced74f
commit 3470205d54
6 changed files with 878 additions and 160 deletions

View File

@@ -226,6 +226,22 @@ def bootstrap_events() -> Dict[str, Any]:
return {"seeded": count, "status": "ok" if count > 0 else "already_seeded"}
@router.post("/bootstrap-eco")
def bootstrap_eco(force: bool = False) -> Dict[str, Any]:
"""
Seed the market_events table with economic calendar events (2020-2026).
Includes FOMC, NFP, CPI, GDP, ISM, BOJ, ECB, BOE with expected/actual/surprise fields.
Pass ?force=true to delete existing eco events and re-insert.
"""
try:
from services.eco_calendar_bootstrap import bootstrap_eco_events
result = bootstrap_eco_events(force=force)
return result
except Exception as e:
logger.error(f"[Timeline] bootstrap_eco failed: {e}")
raise HTTPException(500, str(e))
@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."""