feat: replace Trading Economics with FMP for upcoming calendar forecasts
TE costs $199/month and its Economic Calendar is not in the free tier. FMP (Financial Modeling Prep) offers a free API key (250 req/day) with full economic calendar coverage including consensus estimates (forecasts). - Add backend/services/fmp_calendar.py: fetches upcoming events from GET /api/v3/economic_calendar (one request, all countries, date range) - Replace /api/eco/te-key + te-sync endpoints with fmp-key + fmp-sync - Update daily background sync in main.py to use fmp_calendar - Replace TEPanel with FMPPanel in CalendarPage.tsx (link to FMP docs) - Remove broken Cloudflare-blocked FF HTML scrape button from ImportPanel Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -109,15 +109,15 @@ def startup():
|
||||
print(f"[Daily] FF live sync error: {e}", flush=True)
|
||||
|
||||
try:
|
||||
# Trading Economics — upcoming forecasts (only if key is set)
|
||||
# FMP — upcoming forecasts (only if key is set)
|
||||
from services.database import get_config
|
||||
te_key = get_config("te_api_key") or ""
|
||||
if te_key:
|
||||
from services.te_calendar import fetch_upcoming
|
||||
fmp_key = get_config("fmp_api_key") or ""
|
||||
if fmp_key:
|
||||
from services.fmp_calendar import fetch_upcoming
|
||||
r = fetch_upcoming(weeks_ahead=6)
|
||||
print(f"[Daily] TE sync: {r.get('total_upserted', 0)} upserted", flush=True)
|
||||
print(f"[Daily] FMP sync: {r.get('total_upserted', 0)} upserted", flush=True)
|
||||
except Exception as e:
|
||||
print(f"[Daily] TE sync error: {e}", flush=True)
|
||||
print(f"[Daily] FMP sync error: {e}", flush=True)
|
||||
|
||||
_time.sleep(86400) # repeat every 24h
|
||||
|
||||
|
||||
Reference in New Issue
Block a user