# Generated by Django 5.0 on 2026-03-10

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('equity', '0003_add_stock_pool_snapshot'),
    ]

    operations = [
        migrations.CreateModel(
            name='ValuationRepairTrackingModel',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('stock_code', models.CharField(db_index=True, max_length=10, verbose_name='股票代码')),
                ('stock_name', models.CharField(blank=True, default='', max_length=100, verbose_name='股票名称')),
                ('as_of_date', models.DateField(db_index=True, verbose_name='数据截止日期')),
                ('repair_start_date', models.DateField(blank=True, null=True, verbose_name='修复开始日期')),
                ('repair_start_percentile', models.FloatField(blank=True, null=True, verbose_name='修复起始分位数')),
                ('current_phase', models.CharField(db_index=True, max_length=32, verbose_name='当前修复阶段')),
                ('signal', models.CharField(db_index=True, default='none', max_length=32, verbose_name='交易信号')),
                ('composite_percentile', models.FloatField(verbose_name='综合分位数')),
                ('pe_percentile', models.FloatField(blank=True, null=True, verbose_name='PE分位数')),
                ('pb_percentile', models.FloatField(verbose_name='PB分位数')),
                ('repair_progress', models.FloatField(blank=True, null=True, verbose_name='修复进度(%)')),
                ('repair_speed_per_30d', models.FloatField(blank=True, null=True, verbose_name='修复速度(每30天百分点)')),
                ('estimated_days_to_target', models.IntegerField(blank=True, null=True, verbose_name='预计到达目标天数')),
                ('is_stalled', models.BooleanField(db_index=True, default=False, verbose_name='是否停滞')),
                ('stall_start_date', models.DateField(blank=True, null=True, verbose_name='停滞开始日期')),
                ('stall_duration_trading_days', models.IntegerField(default=0, verbose_name='停滞持续交易日数')),
                ('repair_duration_trading_days', models.IntegerField(default=0, verbose_name='修复持续交易日数')),
                ('lowest_percentile', models.FloatField(verbose_name='最低分位数')),
                ('lowest_percentile_date', models.DateField(blank=True, null=True, verbose_name='最低分位数日期')),
                ('target_percentile', models.FloatField(default=0.5, verbose_name='目标分位数')),
                ('composite_method', models.CharField(default='pb_only', max_length=20, verbose_name='综合分位数方法')),
                ('confidence', models.FloatField(default=0.0, verbose_name='置信度')),
                ('source_universe', models.CharField(db_index=True, default='all_active', max_length=32, verbose_name='来源股票池')),
                ('is_active', models.BooleanField(db_index=True, default=True, 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_tracking',
                'ordering': ['-composite_percentile', 'stock_code'],
                'indexes': [
                    models.Index(fields=['source_universe', 'current_phase'], name='equity_valu_source_u_idx'),
                    models.Index(fields=['source_universe', 'signal'], name='equity_valu_source_s_idx'),
                    models.Index(fields=['as_of_date'], name='equity_valu_as_of_d_idx'),
                ],
            },
        ),
    ]
