# Generated by Django 3.2.5 on 2021-09-13 08:09

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('plugin', '0001_initial'),
        ('django_celery_beat', '0015_edit_solarschedule_events_choices'),
    ]

    operations = [
        migrations.CreateModel(
            name='DataSource',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=20, unique=True)),
                ('connection_params', models.CharField(max_length=500)),
                ('active', models.BooleanField(default=True)),
                ('pluginclass', models.ForeignKey(limit_choices_to={'plugin_type': 'DataSourceImplementation'}, on_delete=django.db.models.deletion.CASCADE, to='plugin.pluginclass')),
                ('task', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='django_celery_beat.periodictask')),
            ],
        ),
        migrations.CreateModel(
            name='DataSourceCandlePeriod',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('period', models.CharField(choices=[('1S', '1 Second'), ('5S', '5 Second'), ('10S', '10 Second'), ('15S', '15 Second'), ('30S', '30 Second'), ('1M', '1 Minute'), ('5M', '5 Minute'), ('10M', '10 Minute'), ('15M', '15 Minute'), ('30M', '30 Minute'), ('1H', '1 Hour'), ('3H', '3 Hour'), ('6H', '6 Hour'), ('12H', '12 Hour'), ('1D', '1 Day'), ('1W', '1 Week'), ('1MO', '1 Month')], max_length=3)),
                ('start_from', models.DateTimeField()),
                ('active', models.BooleanField(default=False)),
                ('datasource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricedata.datasource')),
                ('task', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='django_celery_beat.periodictask')),
            ],
            options={
                'unique_together': {('datasource', 'period')},
            },
        ),
        migrations.CreateModel(
            name='SummaryBatch',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('time', models.DateTimeField(unique=True)),
                ('status', models.CharField(choices=[('NOT_STARTED', 'NOT_STARTED'), ('IN_PROGRESS', 'IN_PROGRESS'), ('COMPLETE', 'COMPLETE')], default='NOT_STARTED', max_length=11)),
            ],
        ),
        migrations.CreateModel(
            name='Symbol',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, unique=True)),
                ('instrument_type', models.CharField(choices=[('FOREX', 'Foreign Exchange'), ('CFD', 'Contract for Difference'), ('STOCK', 'Company Stock'), ('CRYPTO', 'Crypto Currency')], max_length=10)),
            ],
        ),
        migrations.CreateModel(
            name='DataSourceSymbol',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('retrieve_price_data', models.BooleanField(default=True)),
                ('symbol_info', models.CharField(max_length=1000)),
                ('datasource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricedata.datasource')),
                ('symbol', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricedata.symbol')),
            ],
            options={
                'unique_together': {('datasource', 'symbol')},
            },
        ),
        migrations.CreateModel(
            name='SummaryMetricAllDatasources',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('period', models.CharField(choices=[('1S', '1 Second'), ('5S', '5 Second'), ('10S', '10 Second'), ('15S', '15 Second'), ('30S', '30 Second'), ('1M', '1 Minute'), ('5M', '5 Minute'), ('10M', '10 Minute'), ('15M', '15 Minute'), ('30M', '30 Minute'), ('1H', '1 Hour'), ('3H', '3 Hour'), ('6H', '6 Hour'), ('12H', '12 Hour'), ('1D', '1 Day'), ('1W', '1 Week'), ('1MO', '1 Month')], max_length=3)),
                ('first_candle_time', models.DateTimeField()),
                ('last_candle_time', models.DateTimeField()),
                ('num_candles', models.BigIntegerField()),
                ('minutes_min', models.BigIntegerField()),
                ('minutes_max', models.BigIntegerField()),
                ('minutes_avg', models.BigIntegerField()),
                ('hours_min', models.BigIntegerField()),
                ('hours_max', models.BigIntegerField()),
                ('hours_avg', models.BigIntegerField()),
                ('days_min', models.BigIntegerField()),
                ('days_max', models.BigIntegerField()),
                ('days_avg', models.BigIntegerField()),
                ('weeks_min', models.BigIntegerField()),
                ('weeks_max', models.BigIntegerField()),
                ('weeks_avg', models.BigIntegerField()),
                ('months_min', models.BigIntegerField()),
                ('months_max', models.BigIntegerField()),
                ('months_avg', models.BigIntegerField()),
                ('summary_batch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricedata.summarybatch')),
                ('symbol', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricedata.symbol')),
            ],
            options={
                'unique_together': {('summary_batch', 'period', 'symbol')},
            },
        ),
        migrations.CreateModel(
            name='SummaryMetric',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_candle_time', models.DateTimeField()),
                ('last_candle_time', models.DateTimeField()),
                ('num_candles', models.BigIntegerField()),
                ('minutes_min', models.BigIntegerField()),
                ('minutes_max', models.BigIntegerField()),
                ('minutes_avg', models.BigIntegerField()),
                ('hours_min', models.BigIntegerField()),
                ('hours_max', models.BigIntegerField()),
                ('hours_avg', models.BigIntegerField()),
                ('days_min', models.BigIntegerField()),
                ('days_max', models.BigIntegerField()),
                ('days_avg', models.BigIntegerField()),
                ('weeks_min', models.BigIntegerField()),
                ('weeks_max', models.BigIntegerField()),
                ('weeks_avg', models.BigIntegerField()),
                ('months_min', models.BigIntegerField()),
                ('months_max', models.BigIntegerField()),
                ('months_avg', models.BigIntegerField()),
                ('datasource_candleperiod', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricedata.datasourcecandleperiod')),
                ('datasource_symbol', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricedata.datasourcesymbol')),
                ('summary_batch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricedata.summarybatch')),
            ],
            options={
                'unique_together': {('summary_batch', 'datasource_candleperiod', 'datasource_symbol')},
            },
        ),
        migrations.CreateModel(
            name='SummaryAggregation',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('time', models.DateTimeField()),
                ('aggregation_period', models.CharField(choices=[('minutes', 'Minutes'), ('hours', 'Hours'), ('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months')], max_length=7)),
                ('num_candles', models.BigIntegerField()),
                ('datasource_candleperiod', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricedata.datasourcecandleperiod')),
                ('datasource_symbol', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricedata.datasourcesymbol')),
                ('summary_batch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricedata.summarybatch')),
            ],
            options={
                'unique_together': {('summary_batch', 'datasource_candleperiod', 'time', 'datasource_symbol', 'aggregation_period')},
            },
        ),
        migrations.CreateModel(
            name='Candle',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('time', models.DateTimeField()),
                ('period', models.CharField(choices=[('1S', '1 Second'), ('5S', '5 Second'), ('10S', '10 Second'), ('15S', '15 Second'), ('30S', '30 Second'), ('1M', '1 Minute'), ('5M', '5 Minute'), ('10M', '10 Minute'), ('15M', '15 Minute'), ('30M', '30 Minute'), ('1H', '1 Hour'), ('3H', '3 Hour'), ('6H', '6 Hour'), ('12H', '12 Hour'), ('1D', '1 Day'), ('1W', '1 Week'), ('1MO', '1 Month')], max_length=3)),
                ('bid_open', models.DecimalField(decimal_places=6, max_digits=12)),
                ('bid_high', models.DecimalField(decimal_places=6, max_digits=12)),
                ('bid_low', models.DecimalField(decimal_places=6, max_digits=12)),
                ('bid_close', models.DecimalField(decimal_places=6, max_digits=12)),
                ('ask_open', models.DecimalField(decimal_places=6, max_digits=12)),
                ('ask_high', models.DecimalField(decimal_places=6, max_digits=12)),
                ('ask_low', models.DecimalField(decimal_places=6, max_digits=12)),
                ('ask_close', models.DecimalField(decimal_places=6, max_digits=12)),
                ('volume', models.IntegerField()),
                ('datasource_symbol', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricedata.datasourcesymbol')),
            ],
            options={
                'unique_together': {('datasource_symbol', 'time', 'period')},
            },
        ),
    ]
