feat: calendar

This commit is contained in:
OpenSquared
2026-07-02 11:27:45 +02:00
parent 8098104f5b
commit 5081514898
6 changed files with 286 additions and 118 deletions

View File

@@ -106,7 +106,19 @@ def startup():
from services.institutional_scheduler import start_institutional_scheduler
start_institutional_scheduler()
# Calendar sync loop — FXStreet primary, FF fallback; interval from calendar_refresh_h config (default 6h)
# One-time migration: remove FXStreet-sourced rows (decimal format) — FF sync below will refill from FF
try:
from services.database import get_conn as _get_conn
_mc = _get_conn()
_deleted = _mc.execute("DELETE FROM ff_calendar WHERE source='fxstreet'").rowcount
_mc.commit()
_mc.close()
if _deleted:
print(f"[Startup] Purged {_deleted} FXStreet rows — will refill from FF on next calendar sync", flush=True)
except Exception as _e:
print(f"[Startup] FXStreet purge skipped: {_e}", flush=True)
# Calendar sync loop — FF only (live JSON + HTML scraper); interval from calendar_refresh_h config (default 6h)
import threading, time as _time
def _calendar_sync_loop():
_time.sleep(60) # let server fully boot