# Generated by Django 4.2.20 on 2025-04-22 07:37

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('accounts', '0006_alter_account_options'),
    ]

    operations = [
        migrations.CreateModel(
            name='Deal',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_by', models.CharField(blank=True, max_length=255, null=True)),
                ('updated_by', models.CharField(blank=True, max_length=255, null=True)),
                ('deal_ticket', models.BigIntegerField(db_index=True, unique=True)),
                ('external_id', models.CharField(blank=True, db_index=True, max_length=100, null=True)),
                ('login', models.BigIntegerField(db_index=True)),
                ('dealer', models.BigIntegerField(db_index=True)),
                ('order_ticket', models.BigIntegerField(db_index=True)),
                ('action', models.IntegerField()),
                ('entry', models.IntegerField(db_index=True)),
                ('digits', models.IntegerField()),
                ('digits_currency', models.IntegerField()),
                ('contract_size', models.DecimalField(decimal_places=10, max_digits=20)),
                ('time', models.DateTimeField(db_index=True)),
                ('time_msc', models.BigIntegerField(db_index=True)),
                ('symbol', models.CharField(db_index=True, max_length=50)),
                ('price', models.DecimalField(decimal_places=10, max_digits=20)),
                ('price_sl', models.DecimalField(decimal_places=10, max_digits=20)),
                ('price_tp', models.DecimalField(decimal_places=10, max_digits=20)),
                ('volume', models.DecimalField(decimal_places=10, max_digits=20)),
                ('volume_ext', models.DecimalField(decimal_places=15, max_digits=30)),
                ('volume_closed', models.DecimalField(decimal_places=10, max_digits=20)),
                ('volume_closed_ext', models.DecimalField(decimal_places=15, max_digits=30)),
                ('profit', models.DecimalField(decimal_places=10, max_digits=20)),
                ('profit_raw', models.DecimalField(decimal_places=10, max_digits=20)),
                ('storage', models.DecimalField(decimal_places=10, max_digits=20)),
                ('commission', models.DecimalField(decimal_places=10, max_digits=20)),
                ('fee', models.DecimalField(decimal_places=10, max_digits=20)),
                ('value', models.DecimalField(decimal_places=10, max_digits=20)),
                ('rate_profit', models.DecimalField(decimal_places=10, max_digits=20)),
                ('rate_margin', models.DecimalField(decimal_places=10, max_digits=20)),
                ('expert_id', models.BigIntegerField(blank=True, null=True)),
                ('position_id', models.BigIntegerField(db_index=True)),
                ('comment', models.CharField(blank=True, max_length=255, null=True)),
                ('price_position', models.DecimalField(decimal_places=10, max_digits=20)),
                ('tick_value', models.DecimalField(decimal_places=10, max_digits=20)),
                ('tick_size', models.DecimalField(decimal_places=10, max_digits=20)),
                ('flags', models.BigIntegerField()),
                ('reason', models.IntegerField(blank=True, db_index=True, null=True)),
                ('gateway', models.CharField(blank=True, max_length=100, null=True)),
                ('price_gateway', models.DecimalField(blank=True, decimal_places=10, max_digits=20, null=True)),
                ('market_bid', models.DecimalField(decimal_places=10, max_digits=20)),
                ('market_ask', models.DecimalField(decimal_places=10, max_digits=20)),
                ('market_last', models.DecimalField(decimal_places=10, max_digits=20)),
                ('modification_flags', models.IntegerField()),
                ('raw_data', models.JSONField(blank=True, default=dict)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('account', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='accounts.account')),
            ],
            options={
                'verbose_name': 'Deal',
                'verbose_name_plural': 'Deals',
                'db_table': 'deal',
                'indexes': [models.Index(fields=['deal_ticket'], name='deal_deal_ti_b8f6f8_idx'), models.Index(fields=['login'], name='deal_login_3738f8_idx'), models.Index(fields=['account'], name='deal_account_cd7429_idx'), models.Index(fields=['time'], name='deal_time_6d2e5e_idx'), models.Index(fields=['time_msc'], name='deal_time_ms_f033a5_idx'), models.Index(fields=['position_id'], name='deal_positio_8f0d04_idx'), models.Index(fields=['symbol'], name='deal_symbol_277615_idx'), models.Index(fields=['entry'], name='deal_entry_09c766_idx'), models.Index(fields=['reason'], name='deal_reason_a48e1d_idx')],
            },
        ),
    ]
