Files
signal-platform/app/models/regime_snapshot.py
T

27 lines
1.1 KiB
Python

from datetime import date as date_type
from datetime import datetime
from sqlalchemy import Date, DateTime, Float, String, Text
from sqlalchemy.orm import Mapped, mapped_column
from app.database import Base
class RegimeSnapshot(Base):
"""Daily point-in-time snapshot of the AI/Tech Regime Monitor.
One row per calendar date (unique). ``breakdown_json`` holds the full
``breakdown_json`` is authoritative for v2 State, Warning, source dates,
coverage, and fixed-basket metadata. ``total_score``/``band`` retain the v2
State reading for schema compatibility. Nothing reads this to gate trades.
"""
__tablename__ = "regime_snapshots"
id: Mapped[int] = mapped_column(primary_key=True)
date: Mapped[date_type] = mapped_column(Date, nullable=False, unique=True, index=True)
total_score: Mapped[float] = mapped_column(Float, nullable=False)
band: Mapped[str] = mapped_column(String(20), nullable=False)
breakdown_json: Mapped[str] = mapped_column(Text, nullable=False)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False)