# Generated by Django 5.2.12 on 2026-04-26 23:34

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("account", "0025_systemsettingsmodel_alpha_pool_mode"),
    ]

    operations = [
        migrations.SeparateDatabaseAndState(
            database_operations=[],
            state_operations=[
        migrations.CreateModel(
            name="TransactionCostConfigModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "market",
                    models.CharField(
                        choices=[
                            ("CN_A_SHARE", "A股"),
                            ("CN_HK_STOCK", "港股"),
                            ("US_STOCK", "美股"),
                            ("CN_FUND", "基金"),
                            ("CN_FUTURES", "期货"),
                            ("CRYPTO", "加密货币"),
                            ("other", "其他"),
                        ],
                        max_length=20,
                        verbose_name="市场",
                    ),
                ),
                (
                    "asset_class",
                    models.CharField(
                        choices=[
                            ("equity", "股票"),
                            ("fixed_income", "债券"),
                            ("fund", "基金"),
                            ("derivative", "衍生品"),
                            ("other", "其他"),
                        ],
                        max_length=20,
                        verbose_name="资产类别",
                    ),
                ),
                (
                    "commission_rate",
                    models.FloatField(
                        default=0.0003, help_text="如 0.0003 表示万分之三", verbose_name="佣金费率"
                    ),
                ),
                (
                    "slippage_rate",
                    models.FloatField(
                        default=0.0002, help_text="如 0.0002 表示万分之二", verbose_name="滑点费率"
                    ),
                ),
                (
                    "stamp_duty_rate",
                    models.FloatField(
                        default=0.001,
                        help_text="仅卖出时收取，如 0.001 表示千分之一",
                        verbose_name="印花税率",
                    ),
                ),
                (
                    "transfer_fee_rate",
                    models.FloatField(
                        default=1e-05, help_text="如 0.00001 表示万分之一", verbose_name="过户费率"
                    ),
                ),
                (
                    "min_commission",
                    models.DecimalField(
                        decimal_places=2,
                        default=5.0,
                        help_text="单笔交易最低佣金（元）",
                        max_digits=10,
                        verbose_name="最低佣金",
                    ),
                ),
                (
                    "cost_warning_threshold",
                    models.FloatField(
                        default=0.005,
                        help_text="成本占交易额比例超过此值时预警，如 0.005 表示 0.5%",
                        verbose_name="成本预警阈值",
                    ),
                ),
                ("is_active", models.BooleanField(default=True, verbose_name="是否启用")),
                ("notes", models.TextField(blank=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": "transaction_cost_config",
                "indexes": [
                    models.Index(
                        fields=["market", "asset_class"], name="transaction_market_ce8662_idx"
                    ),
                    models.Index(fields=["is_active"], name="transaction_is_acti_3d5550_idx"),
                ],
                "unique_together": {("market", "asset_class")},
            },
        ),
            ],
        ),
    ]
