25 lines
869 B
Python
25 lines
869 B
Python
"""Abstract base class for fundamental data providers."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
from shared.schemas.trading import FundamentalsSnapshot # canonical definition
|
|
|
|
# Re-export so existing ``from shared.fundamentals.base import FundamentalsSnapshot``
|
|
# continues to work throughout the codebase.
|
|
__all__ = ["FundamentalsSnapshot", "FundamentalsProvider"]
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Abstract provider
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
class FundamentalsProvider(ABC):
|
|
"""Abstract base class for fundamental data providers."""
|
|
|
|
@abstractmethod
|
|
async def fetch(self, ticker: str) -> FundamentalsSnapshot | None:
|
|
"""Fetch fundamental data for *ticker*. Returns None on failure/rate limit."""
|
|
...
|