refactor: reconcile FundamentalsSnapshot to use canonical schema from trading.py

This commit is contained in:
Viktor Barzin 2026-02-23 21:45:18 +00:00
parent aa47e896dd
commit 6f512cf91f
No known key found for this signature in database
GPG key ID: 0EB088298288D958
6 changed files with 40 additions and 55 deletions

View file

@ -3,6 +3,7 @@
from __future__ import annotations
import logging
from datetime import datetime, timezone
import httpx
@ -48,13 +49,14 @@ class FMPProvider(FundamentalsProvider):
return FundamentalsSnapshot(
ticker=ticker,
eps=_safe_float(item.get("netIncomePerShareTTM")),
eps_ttm=_safe_float(item.get("netIncomePerShareTTM")),
pe_ratio=_safe_float(item.get("peRatioTTM")),
peg_ratio=_safe_float(item.get("pegRatioTTM")),
revenue_growth=_safe_float(item.get("revenueGrowth")),
revenue_growth_yoy=_safe_float(item.get("revenueGrowth")),
profit_margin=_safe_float(item.get("netProfitMarginTTM")),
debt_to_equity=_safe_float(item.get("debtToEquityTTM")),
market_cap=_safe_float(item.get("marketCapTTM")),
fetched_at=datetime.now(timezone.utc),
)
except Exception:
logger.exception("FMP fetch failed for %s", ticker)