feat: add scoped alpha sync and local self-correlation

This commit is contained in:
yuxuanhui
2026-09-08 10:40:49 +08:00
parent 404a4d8a04
commit d2ccd94721
28 changed files with 1656 additions and 69 deletions
@@ -0,0 +1,25 @@
"""Persist local self-correlation independently of platform snapshots."""
from alembic import op
import sqlalchemy as sa
revision = "0003"
down_revision = "0002"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"self_correlations",
sa.Column("alpha_id", sa.String(100), sa.ForeignKey("alphas.id"), primary_key=True),
sa.Column("region", sa.String(50), nullable=True),
sa.Column("result", sa.JSON(), nullable=False),
sa.Column("stale", sa.Boolean(), nullable=False),
sa.Column("calculated_at", sa.DateTime(timezone=True), nullable=False),
)
op.create_index("ix_self_correlations_region", "self_correlations", ["region"])
def downgrade():
op.drop_table("self_correlations")