refactor: reconcile FundamentalsSnapshot to use canonical schema from trading.py
This commit is contained in:
parent
aa47e896dd
commit
6f512cf91f
6 changed files with 40 additions and 55 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue