# Generated by Django 2.1.2 on 2019-05-15 13:59

from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Allocation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('target_allocation', django.contrib.postgres.fields.jsonb.JSONField(default=list)),
                ('realized_allocation', django.contrib.postgres.fields.jsonb.JSONField(default=list)),
                ('is_realized', models.BooleanField(default=False)),
                ('BTC_value', models.FloatField(null=True)),
                ('BTC_price', models.BigIntegerField(null=True)),
                ('_timestamp', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name_plural': 'allocations',
                'ordering': ['-_timestamp'],
            },
        ),
        migrations.CreateModel(
            name='AllocationCommittee',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ticker', models.TextField(max_length=15)),
                ('committee_id', models.TextField(max_length=10)),
                ('voted_at', models.DateTimeField()),
                ('vote', models.FloatField()),
                ('horizon', models.IntegerField()),
                ('allocation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='portfolio.Allocation')),
            ],
        ),
        migrations.CreateModel(
            name='ExchangeAccount',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('modified_at', models.DateTimeField(auto_now=True)),
                ('api_key', models.CharField(blank=True, max_length=64, null=True)),
                ('secret_key', models.CharField(blank=True, max_length=64, null=True)),
                ('is_active', models.BooleanField(default=True)),
            ],
            options={
                'verbose_name_plural': 'exchange_accounts',
            },
        ),
        migrations.CreateModel(
            name='Portfolio',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('modified_at', models.DateTimeField(auto_now=True)),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('rebalanced_at', models.DateTimeField(null=True)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='portfolio', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'portfolios',
            },
        ),
        migrations.AddField(
            model_name='exchangeaccount',
            name='portfolio',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='exchange_accounts', to='portfolio.Portfolio'),
        ),
        migrations.AddField(
            model_name='allocation',
            name='portfolio',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='allocations', to='portfolio.Portfolio'),
        ),
    ]
