# Generated by Django 5.2.7 on 2026-02-06 11:38

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0005_sitesettings'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='order',
            name='close_price',
        ),
        migrations.RemoveField(
            model_name='order',
            name='entry_price',
        ),
        migrations.RemoveField(
            model_name='order',
            name='filled_amount',
        ),
        migrations.RemoveField(
            model_name='order',
            name='profit_loss',
        ),
        migrations.AddField(
            model_name='account',
            name='frozen_balance',
            field=models.DecimalField(decimal_places=8, default=0, max_digits=30, verbose_name='冻结余额 (USDT)'),
        ),
        migrations.AddField(
            model_name='order',
            name='total_usdt',
            field=models.DecimalField(blank=True, decimal_places=8, max_digits=30, null=True, verbose_name='成交额 (USDT)'),
        ),
        migrations.AlterField(
            model_name='order',
            name='amount',
            field=models.DecimalField(decimal_places=8, max_digits=30, verbose_name='数量/手数'),
        ),
        migrations.AlterField(
            model_name='order',
            name='status',
            field=models.CharField(choices=[('PENDING', '等待成交'), ('PARTIALLY_FILLED', '部分成交'), ('FILLED', '已成交'), ('CANCELED', '已撤销')], default='PENDING', max_length=20, verbose_name='状态'),
        ),
        migrations.CreateModel(
            name='Position',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('symbol', models.CharField(max_length=20, verbose_name='交易对')),
                ('side', models.CharField(choices=[('LONG', '做多'), ('SHORT', '做空')], max_length=10, verbose_name='方向')),
                ('leverage', models.IntegerField(default=20, verbose_name='杠杆')),
                ('entry_price', models.DecimalField(decimal_places=8, max_digits=30, verbose_name='开仓均价')),
                ('lots', models.DecimalField(decimal_places=8, max_digits=30, verbose_name='手数')),
                ('margin', models.DecimalField(decimal_places=8, max_digits=30, verbose_name='占用保证金')),
                ('is_active', models.BooleanField(default=True, verbose_name='是否持仓')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='时间')),
                ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='positions', to='core.account')),
            ],
            options={
                'verbose_name': '持仓',
                'verbose_name_plural': '持仓管理',
            },
        ),
    ]
