# Generated by Django 2.2.1 on 2019-12-04 04:13

import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('backtest', '0027_auto_20191203_1045'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('optimize', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='BuyStrategy',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('active', models.IntegerField(default=1)),
                ('order', models.IntegerField(default=1)),
                ('strategy', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='period_strategy', to='backtest.Strategy')),
            ],
        ),
        migrations.CreateModel(
            name='Result',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('Total_return', models.DecimalField(decimal_places=2, default=0.0, max_digits=6)),
                ('Benchmark_return', models.DecimalField(decimal_places=2, default=0.0, max_digits=6)),
                ('Annualized_return', models.DecimalField(decimal_places=2, default=0.0, max_digits=6)),
                ('Max_drawdown', models.DecimalField(decimal_places=2, default=0.0, max_digits=6)),
                ('Benchmark_max_drawdown', models.DecimalField(decimal_places=2, default=0.0, max_digits=6)),
                ('pctwinners', models.DecimalField(decimal_places=2, default=0.0, max_digits=6)),
                ('Sharpe_ratio', models.DecimalField(decimal_places=2, default=0.0, max_digits=6)),
                ('date', models.DateField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='PeriodStrategy',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('offset', models.CharField(blank=True, choices=[('day', 'day'), ('week', 'week'), ('month', 'month')], max_length=20, null=True, verbose_name='Offset')),
                ('peroid', models.CharField(blank=True, choices=[('6 months', '6 months'), ('1 year or 2 years', '1 year or 2 years')], max_length=20, null=True, verbose_name='Period')),
                ('startdate', models.DateField(default=datetime.date(1999, 1, 1), verbose_name='StartDate')),
                ('enddate', models.DateField(default=datetime.date(2018, 12, 31), verbose_name='EndDate')),
                ('buystrategy', models.ManyToManyField(related_name='buy_strategys', to='optimize.BuyStrategy')),
                ('results', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='optimize.Result')),
                ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
