# Generated by Django 5.2.10 on 2026-03-10 23:16

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("equity", "0006_valuationdataqualitysnapshotmodel_and_more"),
    ]

    operations = [
        migrations.CreateModel(
            name="ValuationRepairConfigModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("version", models.IntegerField(default=1, verbose_name="版本号")),
                (
                    "is_active",
                    models.BooleanField(
                        db_index=True, default=False, verbose_name="是否激活（生效中）"
                    ),
                ),
                (
                    "effective_from",
                    models.DateTimeField(blank=True, null=True, verbose_name="生效时间"),
                ),
                (
                    "min_history_points",
                    models.IntegerField(default=120, verbose_name="最小历史样本数"),
                ),
                (
                    "default_lookback_days",
                    models.IntegerField(default=756, verbose_name="默认回看交易日数"),
                ),
                (
                    "confirm_window",
                    models.IntegerField(default=20, verbose_name="修复确认窗口（交易日）"),
                ),
                (
                    "min_rebound",
                    models.FloatField(default=0.05, verbose_name="最小反弹幅度（百分位）"),
                ),
                (
                    "stall_window",
                    models.IntegerField(default=40, verbose_name="停滞检测窗口（交易日）"),
                ),
                (
                    "stall_min_progress",
                    models.FloatField(default=0.02, verbose_name="停滞最小进展阈值"),
                ),
                ("target_percentile", models.FloatField(default=0.5, verbose_name="目标百分位")),
                ("undervalued_threshold", models.FloatField(default=0.2, verbose_name="低估阈值")),
                (
                    "near_target_threshold",
                    models.FloatField(default=0.45, verbose_name="接近目标阈值"),
                ),
                ("overvalued_threshold", models.FloatField(default=0.8, verbose_name="高估阈值")),
                ("pe_weight", models.FloatField(default=0.6, verbose_name="PE 权重")),
                ("pb_weight", models.FloatField(default=0.4, verbose_name="PB 权重")),
                ("confidence_base", models.FloatField(default=0.4, verbose_name="置信度基础值")),
                (
                    "confidence_sample_threshold",
                    models.IntegerField(default=252, verbose_name="置信度样本数阈值"),
                ),
                (
                    "confidence_sample_bonus",
                    models.FloatField(default=0.2, verbose_name="置信度样本数奖励"),
                ),
                (
                    "confidence_blend_bonus",
                    models.FloatField(default=0.15, verbose_name="置信度 pe_pb_blend 奖励"),
                ),
                (
                    "confidence_repair_start_bonus",
                    models.FloatField(default=0.15, verbose_name="置信度修复起点奖励"),
                ),
                (
                    "confidence_not_stalled_bonus",
                    models.FloatField(default=0.1, verbose_name="置信度非停滞奖励"),
                ),
                (
                    "repairing_threshold",
                    models.FloatField(default=0.1, verbose_name="REPAIRING 阶段阈值"),
                ),
                ("eta_max_days", models.IntegerField(default=999, verbose_name="ETA 最大天数")),
                (
                    "change_reason",
                    models.TextField(blank=True, default="", verbose_name="变更原因"),
                ),
                (
                    "created_by",
                    models.CharField(blank=True, default="", max_length=64, verbose_name="创建人"),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("updated_at", models.DateTimeField(auto_now=True, verbose_name="更新时间")),
            ],
            options={
                "verbose_name": "估值修复策略参数",
                "verbose_name_plural": "估值修复策略参数",
                "db_table": "equity_valuation_repair_config",
                "ordering": ["-version"],
                "indexes": [
                    models.Index(
                        fields=["is_active", "effective_from"],
                        name="equity_valu_is_acti_cf8b99_idx",
                    ),
                    models.Index(fields=["version"], name="equity_valu_version_962b52_idx"),
                ],
            },
        ),
    ]
