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,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"]
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue