f0b92a9718
Finnhub's earnings calendar now supplies next_earnings_date through the fundamentals chain; persisted on fundamental_data (migration 006) and exposed in the fundamentals API. The recommendation panel warns when earnings fall within the ~30-day target horizon (a report can gap price through stop/target) and otherwise shows the next date. Informational only. Deploy: run alembic upgrade (new fundamental_data.next_earnings_date column). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
from datetime import date, datetime
|
|
|
|
from sqlalchemy import Date, DateTime, Float, ForeignKey, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class FundamentalData(Base):
|
|
__tablename__ = "fundamental_data"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True)
|
|
ticker_id: Mapped[int] = mapped_column(
|
|
ForeignKey("tickers.id", ondelete="CASCADE"), nullable=False
|
|
)
|
|
pe_ratio: Mapped[float | None] = mapped_column(Float, nullable=True)
|
|
revenue_growth: Mapped[float | None] = mapped_column(Float, nullable=True)
|
|
earnings_surprise: Mapped[float | None] = mapped_column(Float, nullable=True)
|
|
market_cap: Mapped[float | None] = mapped_column(Float, nullable=True)
|
|
next_earnings_date: Mapped[date | None] = mapped_column(Date, nullable=True)
|
|
fetched_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), nullable=False
|
|
)
|
|
unavailable_fields_json: Mapped[str] = mapped_column(
|
|
Text, nullable=False, default="{}"
|
|
)
|
|
|
|
ticker = relationship("Ticker", back_populates="fundamental_data")
|