feat: auto-bootstrap macro + eco events on startup

Both bootstrap_macro_events() and bootstrap_eco_events() are now called
in the FastAPI startup event. Idempotent — skips already-existing events.
Logs how many events were inserted on first run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OpenSquared
2026-06-25 00:13:22 +02:00
parent 3470205d54
commit 9ed59c5ca2

View File

@@ -78,6 +78,16 @@ def startup():
from services.geo_analyzer import GEO_PATTERNS
from services.database import seed_builtin_patterns
seed_builtin_patterns(GEO_PATTERNS)
# Bootstrap historical market events (macro/geopolitical + economic calendar)
try:
from services.macro_events_bootstrap import bootstrap_macro_events
from services.eco_calendar_bootstrap import bootstrap_eco_events
r1 = bootstrap_macro_events()
r2 = bootstrap_eco_events()
if r1.get("inserted", 0) or r2.get("inserted", 0):
_log.info(f"[Startup] Events bootstrapped — macro: +{r1.get('inserted',0)}, eco: +{r2.get('inserted',0)}")
except Exception as _e:
_log.warning(f"[Startup] Event bootstrap failed: {_e}")
# Start auto-cycle scheduler if enabled
from services.auto_cycle import start_scheduler
start_scheduler()