from datetime import date as date_type from sqlalchemy import Date, Float, String, UniqueConstraint from sqlalchemy.orm import Mapped, mapped_column from app.database import Base class BenchmarkPrice(Base): """Daily close for a benchmark index (e.g. SPY), used to compute trade alpha. A standalone price series, deliberately NOT a tracked ``Ticker`` — so the benchmark never enters the scanner, the momentum-percentile ranking, or the rankings table. One row per (symbol, date). """ __tablename__ = "benchmark_prices" __table_args__ = ( UniqueConstraint("symbol", "date", name="uq_benchmark_symbol_date"), ) id: Mapped[int] = mapped_column(primary_key=True) symbol: Mapped[str] = mapped_column(String(20), nullable=False, index=True) date: Mapped[date_type] = mapped_column(Date, nullable=False) close: Mapped[float] = mapped_column(Float, nullable=False)