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,34 +3,12 @@
from __future__ import annotations
from abc import ABC, abstractmethod
from datetime import UTC, datetime
from pydantic import BaseModel, Field
from shared.schemas.trading import FundamentalsSnapshot # canonical definition
# ---------------------------------------------------------------------------
# FundamentalsSnapshot — canonical schema
#
# NOTE: This is the authoritative definition until it is moved into
# ``shared.schemas.trading``. Once the parallel schema task lands, delete
# this class and update all imports to point at the schemas module.
# ---------------------------------------------------------------------------
class FundamentalsSnapshot(BaseModel):
"""Point-in-time snapshot of a stock's fundamental financial metrics."""
ticker: str
eps: float | None = None
pe_ratio: float | None = None
peg_ratio: float | None = None
revenue_growth: float | None = None
profit_margin: float | None = None
debt_to_equity: float | None = None
market_cap: float | None = None
fetched_at: datetime = Field(default_factory=lambda: datetime.now(UTC))
model_config = {"from_attributes": True}
# Re-export so existing ``from shared.fundamentals.base import FundamentalsSnapshot``
# continues to work throughout the codebase.
__all__ = ["FundamentalsSnapshot", "FundamentalsProvider"]
# ---------------------------------------------------------------------------