# Generated by Django 5.2.10 on 2026-02-04 05:12

from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="AlphaCandidateModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "candidate_id",
                    models.CharField(
                        db_index=True, help_text="候选唯一标识符", max_length=64, unique=True
                    ),
                ),
                (
                    "trigger_id",
                    models.CharField(db_index=True, help_text="触发器 ID", max_length=64),
                ),
                (
                    "asset_code",
                    models.CharField(db_index=True, help_text="资产代码", max_length=32),
                ),
                ("asset_class", models.CharField(help_text="资产类别", max_length=64)),
                (
                    "direction",
                    models.CharField(
                        choices=[("LONG", "做多"), ("SHORT", "做空"), ("NEUTRAL", "中性")],
                        default="LONG",
                        help_text="方向",
                        max_length=16,
                    ),
                ),
                (
                    "strength",
                    models.CharField(
                        choices=[
                            ("VERY_WEAK", "非常弱"),
                            ("WEAK", "弱"),
                            ("MODERATE", "中等"),
                            ("STRONG", "强"),
                            ("VERY_STRONG", "非常强"),
                        ],
                        default="MODERATE",
                        help_text="信号强度",
                        max_length=16,
                    ),
                ),
                ("confidence", models.FloatField(default=0.5, help_text="置信度 (0-1)")),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("WATCH", "观察"),
                            ("CANDIDATE", "候选"),
                            ("ACTIONABLE", "可操作"),
                            ("EXECUTED", "已执行"),
                            ("CANCELLED", "已取消"),
                        ],
                        db_index=True,
                        default="WATCH",
                        help_text="状态",
                        max_length=16,
                    ),
                ),
                ("thesis", models.TextField(blank=True, help_text="投资论点")),
                ("entry_zone", models.JSONField(blank=True, default=dict, help_text="入场区域")),
                ("exit_zone", models.JSONField(blank=True, default=dict, help_text="出场区域")),
                ("time_horizon", models.IntegerField(default=90, help_text="时间窗口（天）")),
                (
                    "expected_return",
                    models.FloatField(blank=True, help_text="预期收益率", null=True),
                ),
                (
                    "risk_level",
                    models.CharField(
                        choices=[
                            ("LOW", "低"),
                            ("MEDIUM", "中"),
                            ("HIGH", "高"),
                            ("VERY_HIGH", "非常高"),
                        ],
                        default="MEDIUM",
                        help_text="风险等级",
                        max_length=16,
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, db_index=True, help_text="创建时间"),
                ),
                ("updated_at", models.DateTimeField(auto_now=True, help_text="更新时间")),
                (
                    "status_changed_at",
                    models.DateTimeField(blank=True, help_text="状态变更时间", null=True),
                ),
                (
                    "promoted_to_signal_at",
                    models.DateTimeField(blank=True, help_text="提升为信号的时间", null=True),
                ),
                ("custom_data", models.JSONField(blank=True, default=dict, help_text="自定义数据")),
            ],
            options={
                "verbose_name": "Alpha 候选",
                "verbose_name_plural": "Alpha 候选",
                "db_table": "alpha_candidate",
                "ordering": ["-created_at"],
                "indexes": [
                    models.Index(
                        fields=["asset_code", "status"], name="alpha_candi_asset_c_48c2a9_idx"
                    ),
                    models.Index(
                        fields=["status", "-created_at"], name="alpha_candi_status_12d667_idx"
                    ),
                    models.Index(fields=["trigger_id"], name="alpha_candi_trigger_4eaecf_idx"),
                ],
            },
        ),
        migrations.CreateModel(
            name="AlphaTriggerModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "trigger_id",
                    models.CharField(
                        db_index=True, help_text="触发器唯一标识符", max_length=64, unique=True
                    ),
                ),
                (
                    "trigger_type",
                    models.CharField(
                        choices=[
                            ("MOMENTUM_SIGNAL", "动量信号"),
                            ("MEAN_REVERSION", "均值回归"),
                            ("BREAKOUT", "突破"),
                            ("REGIME_TRANSITION", "Regime 转换"),
                            ("POLICY_CHANGE", "Policy 变化"),
                            ("CUSTOM", "自定义"),
                        ],
                        db_index=True,
                        default="MOMENTUM_SIGNAL",
                        help_text="触发器类型",
                        max_length=32,
                    ),
                ),
                (
                    "asset_code",
                    models.CharField(db_index=True, help_text="资产代码", max_length=32),
                ),
                ("asset_class", models.CharField(help_text="资产类别", max_length=64)),
                (
                    "direction",
                    models.CharField(
                        choices=[("LONG", "做多"), ("SHORT", "做空"), ("NEUTRAL", "中性")],
                        default="LONG",
                        help_text="方向",
                        max_length=16,
                    ),
                ),
                ("trigger_condition", models.JSONField(default=dict, help_text="触发条件")),
                (
                    "invalidation_conditions",
                    models.JSONField(default=list, help_text="证伪条件列表"),
                ),
                (
                    "strength",
                    models.CharField(
                        choices=[
                            ("VERY_WEAK", "非常弱"),
                            ("WEAK", "弱"),
                            ("MODERATE", "中等"),
                            ("STRONG", "强"),
                            ("VERY_STRONG", "非常强"),
                        ],
                        default="MODERATE",
                        help_text="信号强度",
                        max_length=16,
                    ),
                ),
                ("confidence", models.FloatField(default=0.5, help_text="置信度 (0-1)")),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("ACTIVE", "活跃"),
                            ("TRIGGERED", "已触发"),
                            ("INVALIDATED", "已证伪"),
                            ("EXPIRED", "已过期"),
                            ("CANCELLED", "已取消"),
                        ],
                        db_index=True,
                        default="ACTIVE",
                        help_text="状态",
                        max_length=16,
                    ),
                ),
                ("thesis", models.TextField(blank=True, help_text="投资论点")),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, db_index=True, help_text="创建时间"),
                ),
                ("triggered_at", models.DateTimeField(blank=True, help_text="触发时间", null=True)),
                (
                    "invalidated_at",
                    models.DateTimeField(blank=True, help_text="证伪时间", null=True),
                ),
                (
                    "expires_at",
                    models.DateTimeField(
                        blank=True, db_index=True, help_text="过期时间", null=True
                    ),
                ),
                (
                    "source_signal_id",
                    models.CharField(blank=True, help_text="源信号 ID", max_length=64),
                ),
                (
                    "related_regime",
                    models.CharField(blank=True, help_text="相关 Regime", max_length=32),
                ),
                (
                    "related_policy_level",
                    models.IntegerField(blank=True, help_text="相关 Policy 档位", null=True),
                ),
                ("custom_data", models.JSONField(blank=True, default=dict, help_text="自定义数据")),
            ],
            options={
                "verbose_name": "Alpha 触发器",
                "verbose_name_plural": "Alpha 触发器",
                "db_table": "alpha_trigger",
                "ordering": ["-created_at"],
                "indexes": [
                    models.Index(
                        fields=["asset_code", "status"], name="alpha_trigg_asset_c_84a22e_idx"
                    ),
                    models.Index(
                        fields=["status", "-created_at"], name="alpha_trigg_status_6b854d_idx"
                    ),
                    models.Index(
                        fields=["trigger_type", "status"], name="alpha_trigg_trigger_f85785_idx"
                    ),
                    models.Index(fields=["expires_at"], name="alpha_trigg_expires_afff13_idx"),
                ],
            },
        ),
    ]
