diff --git a/core/admin.py b/core/admin.py index 761e230..60f5bf0 100644 --- a/core/admin.py +++ b/core/admin.py @@ -31,7 +31,7 @@ class CustomUserAdmin(UserAdmin): fieldsets = ( *UserAdmin.fieldsets, ( - "Stripe information", + "Billing information", {"fields": ("billing_provider_id",)}, ), # ( diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py index 26a2c7b..6d31469 100644 --- a/core/migrations/0001_initial.py +++ b/core/migrations/0001_initial.py @@ -30,8 +30,7 @@ class Migration(migrations.Migration): ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), - ('stripe_id', models.CharField(blank=True, max_length=255, null=True)), - ('last_payment', models.DateTimeField(blank=True, null=True)), + ('billing_provider_id', models.CharField(blank=True, max_length=255, null=True)), ('email', models.EmailField(max_length=254, unique=True)), ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')), ], @@ -44,32 +43,6 @@ class Migration(migrations.Migration): ('objects', django.contrib.auth.models.UserManager()), ], ), - migrations.CreateModel( - name='Plan', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255, unique=True)), - ('description', models.CharField(blank=True, max_length=1024, null=True)), - ('cost', models.IntegerField()), - ('product_id', models.CharField(blank=True, max_length=255, null=True, unique=True)), - ('image', models.CharField(blank=True, max_length=1024, null=True)), - ], - ), - migrations.CreateModel( - name='Session', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('request', models.CharField(blank=True, max_length=255, null=True)), - ('subscription_id', models.CharField(blank=True, max_length=255, null=True)), - ('plan', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.plan')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.AddField( - model_name='user', - name='plans', - field=models.ManyToManyField(blank=True, to='core.plan'), - ), migrations.AddField( model_name='user', name='user_permissions', diff --git a/core/migrations/0002_account_activemanagementpolicy_assetgroup_hook_and_more.py b/core/migrations/0002_account_activemanagementpolicy_assetgroup_hook_and_more.py new file mode 100644 index 0000000..d04ec72 --- /dev/null +++ b/core/migrations/0002_account_activemanagementpolicy_assetgroup_hook_and_more.py @@ -0,0 +1,230 @@ +# Generated by Django 4.1.7 on 2023-02-24 13:18 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import uuid + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Account', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('exchange', models.CharField(choices=[('alpaca', 'Alpaca'), ('oanda', 'OANDA'), ('fake', 'Fake')], max_length=255)), + ('api_key', models.CharField(max_length=255)), + ('api_secret', models.CharField(max_length=255)), + ('sandbox', models.BooleanField(default=False)), + ('enabled', models.BooleanField(default=True)), + ('supported_symbols', models.JSONField(default=list)), + ('instruments', models.JSONField(default=list)), + ('currency', models.CharField(blank=True, max_length=255, null=True)), + ('initial_balance', models.FloatField(default=0)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='ActiveManagementPolicy', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('description', models.TextField(blank=True, null=True)), + ('when_trading_time_violated', models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255)), + ('when_trends_violated', models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255)), + ('when_position_size_violated', models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only'), ('adjust', 'Adjust violating trades')], default='none', max_length=255)), + ('when_protection_violated', models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only'), ('adjust', 'Adjust violating trades')], default='none', max_length=255)), + ('when_asset_groups_violated', models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255)), + ('when_max_open_trades_violated', models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255)), + ('when_max_open_trades_per_symbol_violated', models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255)), + ('when_max_loss_violated', models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255)), + ('when_max_risk_violated', models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255)), + ('when_crossfilter_violated', models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='AssetGroup', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('description', models.TextField(blank=True, null=True)), + ('webhook_id', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)), + ('when_no_data', models.IntegerField(choices=[(6, 'Always allow'), (7, 'Always deny'), (2, 'Bullish'), (3, 'Bearish')], default=7)), + ('when_no_match', models.IntegerField(choices=[(6, 'Always allow'), (7, 'Always deny'), (2, 'Bullish'), (3, 'Bearish')], default=6)), + ('when_no_aggregation', models.IntegerField(choices=[(6, 'Always allow'), (7, 'Always deny'), (2, 'Bullish'), (3, 'Bearish')], default=6)), + ('when_not_in_bounds', models.IntegerField(choices=[(6, 'Always allow'), (7, 'Always deny'), (2, 'Bullish'), (3, 'Bearish')], default=6)), + ('when_bullish', models.IntegerField(choices=[(6, 'Always allow'), (7, 'Always deny'), (2, 'Bullish'), (3, 'Bearish')], default=2)), + ('when_bearish', models.IntegerField(choices=[(6, 'Always allow'), (7, 'Always deny'), (2, 'Bullish'), (3, 'Bearish')], default=3)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Hook', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=1024)), + ('hook', models.CharField(max_length=255, unique=True)), + ('received', models.IntegerField(default=0)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='OrderSettings', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('description', models.TextField(blank=True, null=True)), + ('order_type', models.CharField(choices=[('market', 'Market'), ('limit', 'Limit')], default='market', max_length=255)), + ('time_in_force', models.CharField(choices=[('gtc', 'GTC (Good Til Cancelled)'), ('gfd', 'GFD (Good For Day)'), ('fok', 'FOK (Fill Or Kill)'), ('ioc', 'IOC (Immediate Or Cancel)')], default='gtc', max_length=255)), + ('take_profit_percent', models.FloatField(default=1.5)), + ('stop_loss_percent', models.FloatField(default=1.0)), + ('trailing_stop_loss_percent', models.FloatField(blank=True, default=1.0, null=True)), + ('trade_size_percent', models.FloatField(default=0.5)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='RiskModel', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('description', models.TextField(blank=True, null=True)), + ('max_loss_percent', models.FloatField(default=0.05)), + ('max_risk_percent', models.FloatField(default=0.05)), + ('max_open_trades', models.IntegerField(default=10)), + ('max_open_trades_per_symbol', models.IntegerField(default=2)), + ('price_slippage_percent', models.FloatField(default=2.5)), + ('callback_price_deviation_percent', models.FloatField(default=0.5)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Signal', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=1024)), + ('signal', models.CharField(max_length=256)), + ('direction', models.CharField(choices=[('buy', 'Buy'), ('sell', 'Sell')], max_length=255)), + ('received', models.IntegerField(default=0)), + ('type', models.CharField(choices=[('entry', 'Entry'), ('exit', 'Exit'), ('trend', 'Trend')], max_length=255)), + ('hook', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.hook')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='TradingTime', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('description', models.TextField(blank=True, null=True)), + ('start_day', models.IntegerField(choices=[(1, 'Monday'), (2, 'Tuesday'), (3, 'Wednesday'), (4, 'Thursday'), (5, 'Friday'), (6, 'Saturday'), (7, 'Sunday')])), + ('end_day', models.IntegerField(choices=[(1, 'Monday'), (2, 'Tuesday'), (3, 'Wednesday'), (4, 'Thursday'), (5, 'Friday'), (6, 'Saturday'), (7, 'Sunday')])), + ('start_time', models.TimeField()), + ('end_time', models.TimeField()), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Trade', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('symbol', models.CharField(max_length=255)), + ('time_in_force', models.CharField(choices=[('gtc', 'GTC (Good Til Cancelled)'), ('gfd', 'GFD (Good For Day)'), ('fok', 'FOK (Fill Or Kill)'), ('ioc', 'IOC (Immediate Or Cancel)')], default='gtc', max_length=255)), + ('type', models.CharField(choices=[('market', 'Market'), ('limit', 'Limit')], max_length=255)), + ('amount', models.FloatField(blank=True, null=True)), + ('amount_usd', models.FloatField(blank=True, null=True)), + ('price', models.FloatField(blank=True, null=True)), + ('stop_loss', models.FloatField(blank=True, null=True)), + ('trailing_stop_loss', models.FloatField(blank=True, null=True)), + ('take_profit', models.FloatField(blank=True, null=True)), + ('status', models.CharField(blank=True, max_length=255, null=True)), + ('information', models.JSONField(blank=True, null=True)), + ('direction', models.CharField(choices=[('buy', 'Buy'), ('sell', 'Sell')], max_length=255)), + ('order_id', models.CharField(blank=True, max_length=255, null=True)), + ('client_order_id', models.CharField(blank=True, max_length=255, null=True)), + ('response', models.JSONField(blank=True, null=True)), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.account')), + ('hook', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.hook')), + ('signal', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.signal')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Strategy', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('description', models.TextField(blank=True, null=True)), + ('enabled', models.BooleanField(default=False)), + ('signal_trading_enabled', models.BooleanField(default=False)), + ('active_management_enabled', models.BooleanField(default=False)), + ('trends', models.JSONField(blank=True, null=True)), + ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.account')), + ('active_management_policy', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='core.activemanagementpolicy')), + ('asset_group', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='core.assetgroup')), + ('entry_signals', models.ManyToManyField(blank=True, related_name='entry_strategies', to='core.signal')), + ('exit_signals', models.ManyToManyField(blank=True, related_name='exit_strategies', to='core.signal')), + ('order_settings', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='core.ordersettings')), + ('risk_model', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='core.riskmodel')), + ('trading_times', models.ManyToManyField(to='core.tradingtime')), + ('trend_signals', models.ManyToManyField(blank=True, related_name='trend_strategies', to='core.signal')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + options={ + 'verbose_name_plural': 'strategies', + }, + ), + migrations.CreateModel( + name='NotificationSettings', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('ntfy_topic', models.CharField(blank=True, max_length=255, null=True)), + ('ntfy_url', models.CharField(blank=True, max_length=255, null=True)), + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Callback', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(blank=True, max_length=1024, null=True)), + ('message', models.CharField(blank=True, max_length=1024, null=True)), + ('period', models.CharField(blank=True, max_length=255, null=True)), + ('sent', models.BigIntegerField(blank=True, null=True)), + ('trade', models.BigIntegerField(blank=True, null=True)), + ('exchange', models.CharField(blank=True, max_length=255, null=True)), + ('base', models.CharField(blank=True, max_length=255, null=True)), + ('quote', models.CharField(blank=True, max_length=255, null=True)), + ('contract', models.CharField(blank=True, max_length=255, null=True)), + ('price', models.FloatField(blank=True, null=True)), + ('symbol', models.CharField(max_length=255)), + ('hook', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.hook')), + ('signal', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.signal')), + ], + ), + migrations.CreateModel( + name='AssetRule', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('asset', models.CharField(max_length=64)), + ('aggregation', models.CharField(choices=[('none', 'None'), ('avg_sentiment', 'Average sentiment')], default='none', max_length=255)), + ('value', models.FloatField(blank=True, null=True)), + ('original_status', models.IntegerField(choices=[(0, 'No data'), (1, 'No match'), (2, 'Bullish'), (3, 'Bearish'), (4, 'No aggregation'), (5, 'Not in bounds'), (6, 'Always allow'), (7, 'Always deny')], default=0)), + ('status', models.IntegerField(choices=[(0, 'No data'), (1, 'No match'), (2, 'Bullish'), (3, 'Bearish'), (4, 'No aggregation'), (5, 'Not in bounds'), (6, 'Always allow'), (7, 'Always deny')], default=0)), + ('trigger_below', models.FloatField(blank=True, null=True)), + ('trigger_above', models.FloatField(blank=True, null=True)), + ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.assetgroup')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + options={ + 'unique_together': {('asset', 'group')}, + }, + ), + ] diff --git a/core/migrations/0002_session_session.py b/core/migrations/0002_session_session.py deleted file mode 100644 index 3db3db5..0000000 --- a/core/migrations/0002_session_session.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.0.6 on 2022-10-12 09:08 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='session', - name='session', - field=models.CharField(blank=True, max_length=255, null=True), - ), - ] diff --git a/core/migrations/0003_hook.py b/core/migrations/0003_hook.py deleted file mode 100644 index b48ad7a..0000000 --- a/core/migrations/0003_hook.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-14 23:15 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0002_session_session'), - ] - - operations = [ - migrations.CreateModel( - name='Hook', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(blank=True, max_length=1024, null=True)), - ('hook', models.CharField(max_length=255)), - ('received', models.IntegerField(default=0)), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - ] diff --git a/core/migrations/0004_callback.py b/core/migrations/0004_callback.py deleted file mode 100644 index 68dcd94..0000000 --- a/core/migrations/0004_callback.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-15 18:19 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0003_hook'), - ] - - operations = [ - migrations.CreateModel( - name='Callback', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('data', models.JSONField()), - ('hook', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.hook')), - ], - ), - ] diff --git a/core/migrations/0005_remove_callback_data_callback_market_and_more.py b/core/migrations/0005_remove_callback_data_callback_market_and_more.py deleted file mode 100644 index 1b8391a..0000000 --- a/core/migrations/0005_remove_callback_data_callback_market_and_more.py +++ /dev/null @@ -1,77 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-15 22:35 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0004_callback'), - ] - - operations = [ - migrations.RemoveField( - model_name='callback', - name='data', - ), - migrations.AddField( - model_name='callback', - name='market', - field=models.CharField(blank=True, max_length=255, null=True), - ), - migrations.AddField( - model_name='callback', - name='market_contract', - field=models.CharField(blank=True, max_length=255, null=True), - ), - migrations.AddField( - model_name='callback', - name='market_currency', - field=models.CharField(blank=True, max_length=255, null=True), - ), - migrations.AddField( - model_name='callback', - name='market_exchange', - field=models.CharField(blank=True, max_length=255, null=True), - ), - migrations.AddField( - model_name='callback', - name='market_item', - field=models.CharField(blank=True, max_length=255, null=True), - ), - migrations.AddField( - model_name='callback', - name='message', - field=models.CharField(blank=True, max_length=1024, null=True), - ), - migrations.AddField( - model_name='callback', - name='period', - field=models.CharField(blank=True, max_length=255, null=True), - ), - migrations.AddField( - model_name='callback', - name='timestamp_sent', - field=models.DateTimeField(blank=True, null=True), - ), - migrations.AddField( - model_name='callback', - name='timestamp_trade', - field=models.DateTimeField(blank=True, null=True), - ), - migrations.AddField( - model_name='callback', - name='title', - field=models.CharField(blank=True, max_length=1024, null=True), - ), - migrations.AlterField( - model_name='hook', - name='hook', - field=models.CharField(max_length=255, unique=True), - ), - migrations.AlterField( - model_name='hook', - name='name', - field=models.CharField(blank=True, max_length=1024, null=True, unique=True), - ), - ] diff --git a/core/migrations/0006_remove_callback_market_alter_callback_timestamp_sent_and_more.py b/core/migrations/0006_remove_callback_market_alter_callback_timestamp_sent_and_more.py deleted file mode 100644 index 352b2b5..0000000 --- a/core/migrations/0006_remove_callback_market_alter_callback_timestamp_sent_and_more.py +++ /dev/null @@ -1,27 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-16 13:34 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0005_remove_callback_data_callback_market_and_more'), - ] - - operations = [ - migrations.RemoveField( - model_name='callback', - name='market', - ), - migrations.AlterField( - model_name='callback', - name='timestamp_sent', - field=models.BigIntegerField(blank=True, null=True), - ), - migrations.AlterField( - model_name='callback', - name='timestamp_trade', - field=models.BigIntegerField(blank=True, null=True), - ), - ] diff --git a/core/migrations/0007_account.py b/core/migrations/0007_account.py deleted file mode 100644 index 7f25c26..0000000 --- a/core/migrations/0007_account.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-17 17:18 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0006_remove_callback_market_alter_callback_timestamp_sent_and_more'), - ] - - operations = [ - migrations.CreateModel( - name='Account', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ('exchange', models.CharField(max_length=255)), - ('api_key', models.CharField(max_length=255)), - ('api_secret', models.CharField(max_length=255)), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - ] diff --git a/core/migrations/0008_trade.py b/core/migrations/0008_trade.py deleted file mode 100644 index 587b29a..0000000 --- a/core/migrations/0008_trade.py +++ /dev/null @@ -1,28 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-17 17:39 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0007_account'), - ] - - operations = [ - migrations.CreateModel( - name='Trade', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('symbol', models.CharField(max_length=255)), - ('type', models.CharField(max_length=255)), - ('amount', models.FloatField()), - ('price', models.FloatField()), - ('stop_loss', models.FloatField(blank=True, null=True)), - ('take_profit', models.FloatField(blank=True, null=True)), - ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.account')), - ('hook', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.hook')), - ], - ), - ] diff --git a/core/migrations/0009_trade_exchange_id.py b/core/migrations/0009_trade_exchange_id.py deleted file mode 100644 index 0028b7b..0000000 --- a/core/migrations/0009_trade_exchange_id.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-17 18:07 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0008_trade'), - ] - - operations = [ - migrations.AddField( - model_name='trade', - name='exchange_id', - field=models.CharField(blank=True, max_length=255, null=True), - ), - ] diff --git a/core/migrations/0010_account_sandbox_trade_direction_trade_status_and_more.py b/core/migrations/0010_account_sandbox_trade_direction_trade_status_and_more.py deleted file mode 100644 index ab71f9f..0000000 --- a/core/migrations/0010_account_sandbox_trade_direction_trade_status_and_more.py +++ /dev/null @@ -1,38 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-17 18:18 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0009_trade_exchange_id'), - ] - - operations = [ - migrations.AddField( - model_name='account', - name='sandbox', - field=models.BooleanField(default=False), - ), - migrations.AddField( - model_name='trade', - name='direction', - field=models.CharField(blank=True, choices=[('buy', 'Buy'), ('sell', 'Sell')], max_length=255, null=True), - ), - migrations.AddField( - model_name='trade', - name='status', - field=models.CharField(blank=True, max_length=255, null=True), - ), - migrations.AlterField( - model_name='trade', - name='symbol', - field=models.CharField(choices=[('BTCUSD', 'Bitcoin/USD')], max_length=255), - ), - migrations.AlterField( - model_name='trade', - name='type', - field=models.CharField(choices=[('market', 'Market'), ('limit', 'Limit')], max_length=255), - ), - ] diff --git a/core/migrations/0011_alter_account_exchange.py b/core/migrations/0011_alter_account_exchange.py deleted file mode 100644 index 21e7c1f..0000000 --- a/core/migrations/0011_alter_account_exchange.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-18 08:36 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0010_account_sandbox_trade_direction_trade_status_and_more'), - ] - - operations = [ - migrations.AlterField( - model_name='account', - name='exchange', - field=models.CharField(choices=[('binance', 'Binance'), ('alpaca', 'Alpaca')], max_length=255), - ), - ] diff --git a/core/migrations/0012_rename_exchange_id_trade_client_order_id_and_more.py b/core/migrations/0012_rename_exchange_id_trade_client_order_id_and_more.py deleted file mode 100644 index 7580c0a..0000000 --- a/core/migrations/0012_rename_exchange_id_trade_client_order_id_and_more.py +++ /dev/null @@ -1,33 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-18 13:05 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0011_alter_account_exchange'), - ] - - operations = [ - migrations.RenameField( - model_name='trade', - old_name='exchange_id', - new_name='client_order_id', - ), - migrations.AddField( - model_name='trade', - name='order_id', - field=models.CharField(blank=True, max_length=255, null=True), - ), - migrations.AddField( - model_name='trade', - name='response', - field=models.JSONField(blank=True, null=True), - ), - migrations.AlterField( - model_name='trade', - name='symbol', - field=models.CharField(choices=[('BTC/USD', 'Bitcoin/US Dollar'), ('LTC/USD', 'Litecoin/US Dollar')], max_length=255), - ), - ] diff --git a/core/migrations/0013_alter_trade_direction_alter_trade_price.py b/core/migrations/0013_alter_trade_direction_alter_trade_price.py deleted file mode 100644 index 1535681..0000000 --- a/core/migrations/0013_alter_trade_direction_alter_trade_price.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-18 13:14 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0012_rename_exchange_id_trade_client_order_id_and_more'), - ] - - operations = [ - migrations.AlterField( - model_name='trade', - name='direction', - field=models.CharField(choices=[('buy', 'Buy'), ('sell', 'Sell')], default='buy', max_length=255), - preserve_default=False, - ), - migrations.AlterField( - model_name='trade', - name='price', - field=models.FloatField(blank=True, null=True), - ), - ] diff --git a/core/migrations/0014_alter_account_exchange.py b/core/migrations/0014_alter_account_exchange.py deleted file mode 100644 index 29dcc8d..0000000 --- a/core/migrations/0014_alter_account_exchange.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-21 22:38 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0013_alter_trade_direction_alter_trade_price'), - ] - - operations = [ - migrations.AlterField( - model_name='account', - name='exchange', - field=models.CharField(choices=[('alpaca', 'Alpaca')], max_length=255), - ), - ] diff --git a/core/migrations/0015_strategy.py b/core/migrations/0015_strategy.py deleted file mode 100644 index 41c513d..0000000 --- a/core/migrations/0015_strategy.py +++ /dev/null @@ -1,27 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-25 21:08 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0014_alter_account_exchange'), - ] - - operations = [ - migrations.CreateModel( - name='Strategy', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ('description', models.TextField(blank=True, null=True)), - ('enabled', models.BooleanField(default=False)), - ('take_profit_percent', models.FloatField(default=300.0)), - ('stop_loss_percent', models.FloatField(default=100.0)), - ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.account')), - ('hooks', models.ManyToManyField(to='core.hook')), - ], - ), - ] diff --git a/core/migrations/0016_strategy_user_trade_user.py b/core/migrations/0016_strategy_user_trade_user.py deleted file mode 100644 index 21d751b..0000000 --- a/core/migrations/0016_strategy_user_trade_user.py +++ /dev/null @@ -1,27 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-25 21:26 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0015_strategy'), - ] - - operations = [ - migrations.AddField( - model_name='strategy', - name='user', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), - preserve_default=False, - ), - migrations.AddField( - model_name='trade', - name='user', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), - preserve_default=False, - ), - ] diff --git a/core/migrations/0017_hook_direction_strategy_price_slippage_percent.py b/core/migrations/0017_hook_direction_strategy_price_slippage_percent.py deleted file mode 100644 index 1154443..0000000 --- a/core/migrations/0017_hook_direction_strategy_price_slippage_percent.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-26 09:34 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0016_strategy_user_trade_user'), - ] - - operations = [ - migrations.AddField( - model_name='hook', - name='direction', - field=models.CharField(choices=[('buy', 'Buy'), ('sell', 'Sell')], default='buy', max_length=255), - preserve_default=False, - ), - migrations.AddField( - model_name='strategy', - name='price_slippage_percent', - field=models.FloatField(default=2.5), - ), - ] diff --git a/core/migrations/0018_strategy_trade_size_percent_trade_amount_usd_and_more.py b/core/migrations/0018_strategy_trade_size_percent_trade_amount_usd_and_more.py deleted file mode 100644 index f4e70ba..0000000 --- a/core/migrations/0018_strategy_trade_size_percent_trade_amount_usd_and_more.py +++ /dev/null @@ -1,28 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-26 09:54 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0017_hook_direction_strategy_price_slippage_percent'), - ] - - operations = [ - migrations.AddField( - model_name='strategy', - name='trade_size_percent', - field=models.FloatField(default=2.5), - ), - migrations.AddField( - model_name='trade', - name='amount_usd', - field=models.FloatField(blank=True, null=True), - ), - migrations.AlterField( - model_name='trade', - name='amount', - field=models.FloatField(blank=True, null=True), - ), - ] diff --git a/core/migrations/0019_account_supported_symbols_and_more.py b/core/migrations/0019_account_supported_symbols_and_more.py deleted file mode 100644 index d7c2f84..0000000 --- a/core/migrations/0019_account_supported_symbols_and_more.py +++ /dev/null @@ -1,33 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-27 16:33 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0018_strategy_trade_size_percent_trade_amount_usd_and_more'), - ] - - operations = [ - migrations.AddField( - model_name='account', - name='supported_symbols', - field=models.JSONField(default=list), - ), - migrations.AlterField( - model_name='strategy', - name='stop_loss_percent', - field=models.FloatField(default=1.0), - ), - migrations.AlterField( - model_name='strategy', - name='take_profit_percent', - field=models.FloatField(default=3.0), - ), - migrations.AlterField( - model_name='trade', - name='symbol', - field=models.CharField(max_length=255), - ), - ] diff --git a/core/migrations/0020_rename_market_item_callback_base_and_more.py b/core/migrations/0020_rename_market_item_callback_base_and_more.py deleted file mode 100644 index affe327..0000000 --- a/core/migrations/0020_rename_market_item_callback_base_and_more.py +++ /dev/null @@ -1,54 +0,0 @@ -# Generated by Django 4.1.2 on 2022-10-27 16:51 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0019_account_supported_symbols_and_more'), - ] - - operations = [ - migrations.RenameField( - model_name='callback', - old_name='market_item', - new_name='base', - ), - migrations.RenameField( - model_name='callback', - old_name='market_contract', - new_name='contract', - ), - migrations.RenameField( - model_name='callback', - old_name='market_exchange', - new_name='exchange', - ), - migrations.RenameField( - model_name='callback', - old_name='market_currency', - new_name='quote', - ), - migrations.RenameField( - model_name='callback', - old_name='timestamp_sent', - new_name='sent', - ), - migrations.RenameField( - model_name='callback', - old_name='timestamp_trade', - new_name='trade', - ), - migrations.AddField( - model_name='callback', - name='price', - field=models.FloatField(blank=True, null=True), - ), - migrations.AddField( - model_name='callback', - name='symbol', - field=models.CharField(default='NUL/NUL', max_length=255), - preserve_default=False, - ), - ] diff --git a/core/migrations/0021_account_instruments_alter_account_exchange_and_more.py b/core/migrations/0021_account_instruments_alter_account_exchange_and_more.py deleted file mode 100644 index b8c3a58..0000000 --- a/core/migrations/0021_account_instruments_alter_account_exchange_and_more.py +++ /dev/null @@ -1,33 +0,0 @@ -# Generated by Django 4.1.3 on 2022-11-10 18:01 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0020_rename_market_item_callback_base_and_more'), - ] - - operations = [ - migrations.AddField( - model_name='account', - name='instruments', - field=models.JSONField(default=list), - ), - migrations.AlterField( - model_name='account', - name='exchange', - field=models.CharField(choices=[('alpaca', 'Alpaca'), ('oanda', 'OANDA')], max_length=255), - ), - migrations.AlterField( - model_name='strategy', - name='take_profit_percent', - field=models.FloatField(default=1.5), - ), - migrations.AlterField( - model_name='strategy', - name='trade_size_percent', - field=models.FloatField(default=0.5), - ), - ] diff --git a/core/migrations/0022_account_currency.py b/core/migrations/0022_account_currency.py deleted file mode 100644 index a431232..0000000 --- a/core/migrations/0022_account_currency.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.3 on 2022-11-10 18:44 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0021_account_instruments_alter_account_exchange_and_more'), - ] - - operations = [ - migrations.AddField( - model_name='account', - name='currency', - field=models.CharField(blank=True, max_length=255, null=True), - ), - ] diff --git a/core/migrations/0023_alter_strategy_options_and_more.py b/core/migrations/0023_alter_strategy_options_and_more.py deleted file mode 100644 index 1069df2..0000000 --- a/core/migrations/0023_alter_strategy_options_and_more.py +++ /dev/null @@ -1,27 +0,0 @@ -# Generated by Django 4.1.3 on 2022-11-15 15:13 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0022_account_currency'), - ] - - operations = [ - migrations.AlterModelOptions( - name='strategy', - options={'verbose_name_plural': 'strategies'}, - ), - migrations.AddField( - model_name='strategy', - name='callback_price_deviation_percent', - field=models.FloatField(default=0.5), - ), - migrations.AddField( - model_name='strategy', - name='order_type', - field=models.CharField(choices=[('market', 'Market'), ('limit', 'Limit')], default='market', max_length=255), - ), - ] diff --git a/core/migrations/0024_strategy_time_in_force.py b/core/migrations/0024_strategy_time_in_force.py deleted file mode 100644 index 6cf374c..0000000 --- a/core/migrations/0024_strategy_time_in_force.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.3 on 2022-11-15 15:18 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0023_alter_strategy_options_and_more'), - ] - - operations = [ - migrations.AddField( - model_name='strategy', - name='time_in_force', - field=models.CharField(choices=[('gtc', 'Good Til Cancelled'), ('gfd', 'Good For Day'), ('fok', 'Fill Or Kill'), ('ioc', 'Immediate Or Cancel')], default='gtc', max_length=255), - ), - ] diff --git a/core/migrations/0025_alter_strategy_time_in_force.py b/core/migrations/0025_alter_strategy_time_in_force.py deleted file mode 100644 index f434160..0000000 --- a/core/migrations/0025_alter_strategy_time_in_force.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.3 on 2022-11-15 15:19 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0024_strategy_time_in_force'), - ] - - operations = [ - migrations.AlterField( - model_name='strategy', - name='time_in_force', - field=models.CharField(choices=[('gtc', 'GTC (Good Til Cancelled)'), ('gfd', 'GFD (Good For Day)'), ('fok', 'FOK (Fill Or Kill)'), ('ioc', 'IOC (Immediate Or Cancel)')], default='gtc', max_length=255), - ), - ] diff --git a/core/migrations/0026_trade_time_in_force.py b/core/migrations/0026_trade_time_in_force.py deleted file mode 100644 index 070a273..0000000 --- a/core/migrations/0026_trade_time_in_force.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.3 on 2022-11-15 15:23 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0025_alter_strategy_time_in_force'), - ] - - operations = [ - migrations.AddField( - model_name='trade', - name='time_in_force', - field=models.CharField(choices=[('gtc', 'GTC (Good Til Cancelled)'), ('gfd', 'GFD (Good For Day)'), ('fok', 'FOK (Fill Or Kill)'), ('ioc', 'IOC (Immediate Or Cancel)')], default='gtc', max_length=255), - ), - ] diff --git a/core/migrations/0027_strategy_trailing_stop_loss_percent_and_more.py b/core/migrations/0027_strategy_trailing_stop_loss_percent_and_more.py deleted file mode 100644 index ce78040..0000000 --- a/core/migrations/0027_strategy_trailing_stop_loss_percent_and_more.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 4.1.3 on 2022-11-15 15:50 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0026_trade_time_in_force'), - ] - - operations = [ - migrations.AddField( - model_name='strategy', - name='trailing_stop_loss_percent', - field=models.FloatField(blank=True, default=1.0, null=True), - ), - migrations.AddField( - model_name='trade', - name='trailing_stop_loss', - field=models.FloatField(blank=True, null=True), - ), - ] diff --git a/core/migrations/0028_tradingtime.py b/core/migrations/0028_tradingtime.py deleted file mode 100644 index 5967675..0000000 --- a/core/migrations/0028_tradingtime.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 4.1.3 on 2022-11-25 17:39 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0027_strategy_trailing_stop_loss_percent_and_more'), - ] - - operations = [ - migrations.CreateModel( - name='TradingTime', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(blank=True, max_length=255, null=True)), - ('description', models.TextField(blank=True, null=True)), - ('start_ts', models.DateTimeField()), - ('end_ts', models.DateTimeField()), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - ] diff --git a/core/migrations/0029_alter_tradingtime_name.py b/core/migrations/0029_alter_tradingtime_name.py deleted file mode 100644 index 462baab..0000000 --- a/core/migrations/0029_alter_tradingtime_name.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 4.1.3 on 2022-11-25 17:40 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0028_tradingtime'), - ] - - operations = [ - migrations.AlterField( - model_name='tradingtime', - name='name', - field=models.CharField(default='DEFAULT', max_length=255), - preserve_default=False, - ), - ] diff --git a/core/migrations/0030_remove_tradingtime_end_ts_and_more.py b/core/migrations/0030_remove_tradingtime_end_ts_and_more.py deleted file mode 100644 index 7803dc0..0000000 --- a/core/migrations/0030_remove_tradingtime_end_ts_and_more.py +++ /dev/null @@ -1,45 +0,0 @@ -# Generated by Django 4.1.3 on 2022-11-25 17:43 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0029_alter_tradingtime_name'), - ] - - operations = [ - migrations.RemoveField( - model_name='tradingtime', - name='end_ts', - ), - migrations.RemoveField( - model_name='tradingtime', - name='start_ts', - ), - migrations.AddField( - model_name='tradingtime', - name='end_day', - field=models.CharField(choices=[('monday', 'Monday'), ('tuesday', 'Tuesday'), ('wednesday', 'Wednesday'), ('thursday', 'Thursday'), ('friday', 'Friday'), ('saturday', 'Saturday'), ('sunday', 'Sunday')], default='monday', max_length=255), - preserve_default=False, - ), - migrations.AddField( - model_name='tradingtime', - name='end_time', - field=models.TimeField(default='12:00'), - preserve_default=False, - ), - migrations.AddField( - model_name='tradingtime', - name='start_day', - field=models.CharField(choices=[('monday', 'Monday'), ('tuesday', 'Tuesday'), ('wednesday', 'Wednesday'), ('thursday', 'Thursday'), ('friday', 'Friday'), ('saturday', 'Saturday'), ('sunday', 'Sunday')], default='monday', max_length=255), - preserve_default=False, - ), - migrations.AddField( - model_name='tradingtime', - name='start_time', - field=models.TimeField(default='12:00'), - preserve_default=False, - ), - ] diff --git a/core/migrations/0031_strategy_trading_times.py b/core/migrations/0031_strategy_trading_times.py deleted file mode 100644 index d3edc4d..0000000 --- a/core/migrations/0031_strategy_trading_times.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.3 on 2022-11-25 18:03 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0030_remove_tradingtime_end_ts_and_more'), - ] - - operations = [ - migrations.AddField( - model_name='strategy', - name='trading_times', - field=models.ManyToManyField(blank=True, to='core.tradingtime'), - ), - ] diff --git a/core/migrations/0032_alter_tradingtime_end_day_and_more.py b/core/migrations/0032_alter_tradingtime_end_day_and_more.py deleted file mode 100644 index 1bee980..0000000 --- a/core/migrations/0032_alter_tradingtime_end_day_and_more.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 4.1.3 on 2022-11-25 18:29 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0031_strategy_trading_times'), - ] - - operations = [ - migrations.AlterField( - model_name='tradingtime', - name='end_day', - field=models.CharField(choices=[(0, 'Monday'), (1, 'Tuesday'), (2, 'Wednesday'), (3, 'Thursday'), (4, 'Friday'), (5, 'Saturday'), (6, 'Sunday')], max_length=255), - ), - migrations.AlterField( - model_name='tradingtime', - name='start_day', - field=models.CharField(choices=[(0, 'Monday'), (1, 'Tuesday'), (2, 'Wednesday'), (3, 'Thursday'), (4, 'Friday'), (5, 'Saturday'), (6, 'Sunday')], max_length=255), - ), - ] diff --git a/core/migrations/0033_alter_tradingtime_end_day_and_more.py b/core/migrations/0033_alter_tradingtime_end_day_and_more.py deleted file mode 100644 index 860423e..0000000 --- a/core/migrations/0033_alter_tradingtime_end_day_and_more.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 4.1.3 on 2022-11-25 18:35 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0032_alter_tradingtime_end_day_and_more'), - ] - - operations = [ - migrations.AlterField( - model_name='tradingtime', - name='end_day', - field=models.IntegerField(choices=[(0, 'Monday'), (1, 'Tuesday'), (2, 'Wednesday'), (3, 'Thursday'), (4, 'Friday'), (5, 'Saturday'), (6, 'Sunday')]), - ), - migrations.AlterField( - model_name='tradingtime', - name='start_day', - field=models.IntegerField(choices=[(0, 'Monday'), (1, 'Tuesday'), (2, 'Wednesday'), (3, 'Thursday'), (4, 'Friday'), (5, 'Saturday'), (6, 'Sunday')]), - ), - ] diff --git a/core/migrations/0034_alter_strategy_trading_times.py b/core/migrations/0034_alter_strategy_trading_times.py deleted file mode 100644 index c8f6d16..0000000 --- a/core/migrations/0034_alter_strategy_trading_times.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.3 on 2022-11-25 18:49 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0033_alter_tradingtime_end_day_and_more'), - ] - - operations = [ - migrations.AlterField( - model_name='strategy', - name='trading_times', - field=models.ManyToManyField(to='core.tradingtime'), - ), - ] diff --git a/core/migrations/0035_alter_tradingtime_end_day_and_more.py b/core/migrations/0035_alter_tradingtime_end_day_and_more.py deleted file mode 100644 index deae4bf..0000000 --- a/core/migrations/0035_alter_tradingtime_end_day_and_more.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 4.1.3 on 2022-11-25 19:01 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0034_alter_strategy_trading_times'), - ] - - operations = [ - migrations.AlterField( - model_name='tradingtime', - name='end_day', - field=models.IntegerField(choices=[(1, 'Monday'), (2, 'Tuesday'), (3, 'Wednesday'), (4, 'Thursday'), (5, 'Friday'), (6, 'Saturday'), (7, 'Sunday')]), - ), - migrations.AlterField( - model_name='tradingtime', - name='start_day', - field=models.IntegerField(choices=[(1, 'Monday'), (2, 'Tuesday'), (3, 'Wednesday'), (4, 'Thursday'), (5, 'Friday'), (6, 'Saturday'), (7, 'Sunday')]), - ), - ] diff --git a/core/migrations/0036_remove_hook_direction_alter_hook_name_signal.py b/core/migrations/0036_remove_hook_direction_alter_hook_name_signal.py deleted file mode 100644 index 8addd8a..0000000 --- a/core/migrations/0036_remove_hook_direction_alter_hook_name_signal.py +++ /dev/null @@ -1,37 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-01 18:22 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0035_alter_tradingtime_end_day_and_more'), - ] - - operations = [ - migrations.RemoveField( - model_name='hook', - name='direction', - ), - migrations.AlterField( - model_name='hook', - name='name', - field=models.CharField(default='Unknown', max_length=1024), - preserve_default=False, - ), - migrations.CreateModel( - name='Signal', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=1024)), - ('signal', models.CharField(max_length=256)), - ('direction', models.CharField(choices=[('buy', 'Buy'), ('sell', 'Sell')], max_length=255)), - ('received', models.IntegerField(default=0)), - ('hook', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.hook')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - ] diff --git a/core/migrations/0037_callback_signal.py b/core/migrations/0037_callback_signal.py deleted file mode 100644 index 92852a0..0000000 --- a/core/migrations/0037_callback_signal.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-01 18:33 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0036_remove_hook_direction_alter_hook_name_signal'), - ] - - operations = [ - migrations.AddField( - model_name='callback', - name='signal', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='core.signal'), - preserve_default=False, - ), - ] diff --git a/core/migrations/0038_remove_strategy_hooks_strategy_entry_signals_and_more.py b/core/migrations/0038_remove_strategy_hooks_strategy_entry_signals_and_more.py deleted file mode 100644 index 42fc89b..0000000 --- a/core/migrations/0038_remove_strategy_hooks_strategy_entry_signals_and_more.py +++ /dev/null @@ -1,33 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-01 18:40 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0037_callback_signal'), - ] - - operations = [ - migrations.RemoveField( - model_name='strategy', - name='hooks', - ), - migrations.AddField( - model_name='strategy', - name='entry_signals', - field=models.ManyToManyField(related_name='entry_strategies', to='core.signal'), - ), - migrations.AddField( - model_name='strategy', - name='exit_signals', - field=models.ManyToManyField(related_name='exit_signals', to='core.signal'), - ), - migrations.AddField( - model_name='trade', - name='signal', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.signal'), - ), - ] diff --git a/core/migrations/0039_alter_strategy_exit_signals.py b/core/migrations/0039_alter_strategy_exit_signals.py deleted file mode 100644 index 25d6f45..0000000 --- a/core/migrations/0039_alter_strategy_exit_signals.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-01 18:42 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0038_remove_strategy_hooks_strategy_entry_signals_and_more'), - ] - - operations = [ - migrations.AlterField( - model_name='strategy', - name='exit_signals', - field=models.ManyToManyField(related_name='exit_strategies', to='core.signal'), - ), - ] diff --git a/core/migrations/0040_alter_strategy_entry_signals_and_more.py b/core/migrations/0040_alter_strategy_entry_signals_and_more.py deleted file mode 100644 index 5f2110b..0000000 --- a/core/migrations/0040_alter_strategy_entry_signals_and_more.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-01 18:44 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0039_alter_strategy_exit_signals'), - ] - - operations = [ - migrations.AlterField( - model_name='strategy', - name='entry_signals', - field=models.ManyToManyField(blank=True, null=True, related_name='entry_strategies', to='core.signal'), - ), - migrations.AlterField( - model_name='strategy', - name='exit_signals', - field=models.ManyToManyField(blank=True, null=True, related_name='exit_strategies', to='core.signal'), - ), - ] diff --git a/core/migrations/0041_alter_strategy_entry_signals_and_more.py b/core/migrations/0041_alter_strategy_entry_signals_and_more.py deleted file mode 100644 index 3d678db..0000000 --- a/core/migrations/0041_alter_strategy_entry_signals_and_more.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-01 18:48 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0040_alter_strategy_entry_signals_and_more'), - ] - - operations = [ - migrations.AlterField( - model_name='strategy', - name='entry_signals', - field=models.ManyToManyField(blank=True, related_name='entry_strategies', to='core.signal'), - ), - migrations.AlterField( - model_name='strategy', - name='exit_signals', - field=models.ManyToManyField(blank=True, related_name='exit_strategies', to='core.signal'), - ), - ] diff --git a/core/migrations/0042_trade_information.py b/core/migrations/0042_trade_information.py deleted file mode 100644 index 1034ff4..0000000 --- a/core/migrations/0042_trade_information.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-01 19:42 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0041_alter_strategy_entry_signals_and_more'), - ] - - operations = [ - migrations.AddField( - model_name='trade', - name='information', - field=models.JSONField(blank=True, null=True), - ), - ] diff --git a/core/migrations/0043_strategy_trend_signals.py b/core/migrations/0043_strategy_trend_signals.py deleted file mode 100644 index 045f6bf..0000000 --- a/core/migrations/0043_strategy_trend_signals.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-06 19:24 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0042_trade_information'), - ] - - operations = [ - migrations.AddField( - model_name='strategy', - name='trend_signals', - field=models.ManyToManyField(blank=True, related_name='trend_strategies', to='core.signal'), - ), - ] diff --git a/core/migrations/0044_strategy_trends.py b/core/migrations/0044_strategy_trends.py deleted file mode 100644 index c037287..0000000 --- a/core/migrations/0044_strategy_trends.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-06 19:33 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0043_strategy_trend_signals'), - ] - - operations = [ - migrations.AddField( - model_name='strategy', - name='trends', - field=models.JSONField(blank=True, null=True), - ), - ] diff --git a/core/migrations/0045_hook_type.py b/core/migrations/0045_hook_type.py deleted file mode 100644 index e0605c1..0000000 --- a/core/migrations/0045_hook_type.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-07 09:57 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0044_strategy_trends'), - ] - - operations = [ - migrations.AddField( - model_name='hook', - name='type', - field=models.CharField(choices=[('entry', 'Entry'), ('exit', 'Exit'), ('trend', 'Trend')], default='entry', max_length=255), - preserve_default=False, - ), - ] diff --git a/core/migrations/0046_remove_hook_type_signal_type.py b/core/migrations/0046_remove_hook_type_signal_type.py deleted file mode 100644 index ace00c2..0000000 --- a/core/migrations/0046_remove_hook_type_signal_type.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-07 10:16 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0045_hook_type'), - ] - - operations = [ - migrations.RemoveField( - model_name='hook', - name='type', - ), - migrations.AddField( - model_name='signal', - name='type', - field=models.CharField(choices=[('entry', 'Entry'), ('exit', 'Exit'), ('trend', 'Trend')], default='entry', max_length=255), - preserve_default=False, - ), - ] diff --git a/core/migrations/0047_notificationsettings.py b/core/migrations/0047_notificationsettings.py deleted file mode 100644 index 91e4223..0000000 --- a/core/migrations/0047_notificationsettings.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-18 17:10 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0046_remove_hook_type_signal_type'), - ] - - operations = [ - migrations.CreateModel( - name='NotificationSettings', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('ntfy_topic', models.CharField(blank=True, max_length=255, null=True)), - ('ntfy_url', models.CharField(blank=True, max_length=255, null=True)), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - ] diff --git a/core/migrations/0048_riskmodel_account_riskmodel.py b/core/migrations/0048_riskmodel_account_riskmodel.py deleted file mode 100644 index d6f974a..0000000 --- a/core/migrations/0048_riskmodel_account_riskmodel.py +++ /dev/null @@ -1,33 +0,0 @@ -# Generated by Django 4.1.4 on 2022-12-21 21:43 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0047_notificationsettings'), - ] - - operations = [ - migrations.CreateModel( - name='RiskModel', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ('description', models.TextField(blank=True, null=True)), - ('max_loss_percent', models.FloatField(default=0.05)), - ('max_risk_percent', models.FloatField(default=0.05)), - ('max_open_trades', models.IntegerField(default=10)), - ('max_open_trades_per_symbol', models.IntegerField(default=2)), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.AddField( - model_name='account', - name='riskmodel', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.riskmodel'), - ), - ] diff --git a/core/migrations/0049_rename_riskmodel_account_risk_model.py b/core/migrations/0049_rename_riskmodel_account_risk_model.py deleted file mode 100644 index 6223681..0000000 --- a/core/migrations/0049_rename_riskmodel_account_risk_model.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.4 on 2022-12-21 21:51 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0048_riskmodel_account_riskmodel'), - ] - - operations = [ - migrations.RenameField( - model_name='account', - old_name='riskmodel', - new_name='risk_model', - ), - ] diff --git a/core/migrations/0050_account_enabled.py b/core/migrations/0050_account_enabled.py deleted file mode 100644 index ae5e08a..0000000 --- a/core/migrations/0050_account_enabled.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.4 on 2023-01-01 15:42 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0049_rename_riskmodel_account_risk_model'), - ] - - operations = [ - migrations.AddField( - model_name='account', - name='enabled', - field=models.BooleanField(default=True), - ), - ] diff --git a/core/migrations/0051_account_initial_balance.py b/core/migrations/0051_account_initial_balance.py deleted file mode 100644 index f351736..0000000 --- a/core/migrations/0051_account_initial_balance.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.4 on 2023-01-11 17:42 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0050_account_enabled'), - ] - - operations = [ - migrations.AddField( - model_name='account', - name='initial_balance', - field=models.FloatField(default=0), - ), - ] diff --git a/core/migrations/0052_assetgroup_assetrestriction.py b/core/migrations/0052_assetgroup_assetrestriction.py deleted file mode 100644 index 38e8337..0000000 --- a/core/migrations/0052_assetgroup_assetrestriction.py +++ /dev/null @@ -1,37 +0,0 @@ -# Generated by Django 4.1.4 on 2023-02-10 13:29 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0051_account_initial_balance'), - ] - - operations = [ - migrations.CreateModel( - name='AssetGroup', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ('description', models.TextField(blank=True, null=True)), - ('allowed', models.JSONField(blank=True, null=True)), - ('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.account')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.CreateModel( - name='AssetRestriction', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ('description', models.TextField(blank=True, null=True)), - ('pairs', models.CharField(blank=True, max_length=4096, null=True)), - ('group', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.assetgroup')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - ] diff --git a/core/migrations/0053_assetrestriction_pairs_parsed_and_more.py b/core/migrations/0053_assetrestriction_pairs_parsed_and_more.py deleted file mode 100644 index 498bdf0..0000000 --- a/core/migrations/0053_assetrestriction_pairs_parsed_and_more.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 4.1.4 on 2023-02-10 13:38 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0052_assetgroup_assetrestriction'), - ] - - operations = [ - migrations.AddField( - model_name='assetrestriction', - name='pairs_parsed', - field=models.JSONField(blank=True, null=True), - ), - migrations.AlterField( - model_name='assetgroup', - name='allowed', - field=models.JSONField(blank=True, default={}, null=True), - ), - ] diff --git a/core/migrations/0054_assetrestriction_webhook_id_alter_assetgroup_allowed.py b/core/migrations/0054_assetrestriction_webhook_id_alter_assetgroup_allowed.py deleted file mode 100644 index aaaeeac..0000000 --- a/core/migrations/0054_assetrestriction_webhook_id_alter_assetgroup_allowed.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-10 21:07 - -import uuid - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0053_assetrestriction_pairs_parsed_and_more'), - ] - - operations = [ - migrations.AddField( - model_name='assetrestriction', - name='webhook_id', - field=models.UUIDField(default=uuid.uuid4, editable=False, unique=True), - ), - migrations.AlterField( - model_name='assetgroup', - name='allowed', - field=models.JSONField(blank=True, default=dict, null=True), - ), - ] diff --git a/core/migrations/0055_strategy_asset_group.py b/core/migrations/0055_strategy_asset_group.py deleted file mode 100644 index dc3aed6..0000000 --- a/core/migrations/0055_strategy_asset_group.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-10 22:57 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0054_assetrestriction_webhook_id_alter_assetgroup_allowed'), - ] - - operations = [ - migrations.AddField( - model_name='strategy', - name='asset_group', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='core.assetgroup'), - ), - ] diff --git a/core/migrations/0056_alter_assetrestriction_pairs_parsed.py b/core/migrations/0056_alter_assetrestriction_pairs_parsed.py deleted file mode 100644 index eab2c72..0000000 --- a/core/migrations/0056_alter_assetrestriction_pairs_parsed.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-10 23:09 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0055_strategy_asset_group'), - ] - - operations = [ - migrations.AlterField( - model_name='assetrestriction', - name='pairs_parsed', - field=models.JSONField(blank=True, default=dict, null=True), - ), - ] diff --git a/core/migrations/0057_alter_assetgroup_account_and_more.py b/core/migrations/0057_alter_assetgroup_account_and_more.py deleted file mode 100644 index 9f3ba32..0000000 --- a/core/migrations/0057_alter_assetgroup_account_and_more.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-11 18:17 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0056_alter_assetrestriction_pairs_parsed'), - ] - - operations = [ - migrations.AlterField( - model_name='assetgroup', - name='account', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='core.account'), - ), - migrations.AlterField( - model_name='assetrestriction', - name='pairs_parsed', - field=models.JSONField(blank=True, default=list, null=True), - ), - ] diff --git a/core/migrations/0058_remove_assetgroup_account.py b/core/migrations/0058_remove_assetgroup_account.py deleted file mode 100644 index 960e43a..0000000 --- a/core/migrations/0058_remove_assetgroup_account.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-11 18:46 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0057_alter_assetgroup_account_and_more'), - ] - - operations = [ - migrations.RemoveField( - model_name='assetgroup', - name='account', - ), - ] diff --git a/core/migrations/0059_assetgroup_webhook_id_delete_assetrestriction.py b/core/migrations/0059_assetgroup_webhook_id_delete_assetrestriction.py deleted file mode 100644 index 99b822e..0000000 --- a/core/migrations/0059_assetgroup_webhook_id_delete_assetrestriction.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-13 10:28 - -import uuid - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0058_remove_assetgroup_account'), - ] - - operations = [ - migrations.AddField( - model_name='assetgroup', - name='webhook_id', - field=models.UUIDField(default=uuid.uuid4, editable=False, unique=True), - ), - migrations.DeleteModel( - name='AssetRestriction', - ), - ] diff --git a/core/migrations/0060_assetgroup_aggregation_assetgroup_trigger_above_and_more.py b/core/migrations/0060_assetgroup_aggregation_assetgroup_trigger_above_and_more.py deleted file mode 100644 index 2625be4..0000000 --- a/core/migrations/0060_assetgroup_aggregation_assetgroup_trigger_above_and_more.py +++ /dev/null @@ -1,28 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-13 10:52 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0059_assetgroup_webhook_id_delete_assetrestriction'), - ] - - operations = [ - migrations.AddField( - model_name='assetgroup', - name='aggregation', - field=models.CharField(choices=[('none', 'None'), ('avg_sentiment', 'Average sentiment')], default='none', max_length=255), - ), - migrations.AddField( - model_name='assetgroup', - name='trigger_above', - field=models.FloatField(blank=True, null=True), - ), - migrations.AddField( - model_name='assetgroup', - name='trigger_below', - field=models.FloatField(blank=True, null=True), - ), - ] diff --git a/core/migrations/0061_assetrule.py b/core/migrations/0061_assetrule.py deleted file mode 100644 index 24296c3..0000000 --- a/core/migrations/0061_assetrule.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-13 18:56 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0060_assetgroup_aggregation_assetgroup_trigger_above_and_more'), - ] - - operations = [ - migrations.CreateModel( - name='AssetRule', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('asset', models.CharField(max_length=64)), - ('aggregation', models.CharField(choices=[('none', 'None'), ('avg_sentiment', 'Average sentiment')], default='none', max_length=255)), - ('value', models.FloatField(blank=True, null=True)), - ('status', models.FloatField(choices=[(0, 'No data'), (1, 'No match'), (2, 'Positive'), (3, 'Negative')], default=0)), - ('trigger_below', models.FloatField(blank=True, null=True)), - ('trigger_above', models.FloatField(blank=True, null=True)), - ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.assetgroup')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - ] diff --git a/core/migrations/0062_alter_assetrule_status.py b/core/migrations/0062_alter_assetrule_status.py deleted file mode 100644 index 66de078..0000000 --- a/core/migrations/0062_alter_assetrule_status.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-13 18:59 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0061_assetrule'), - ] - - operations = [ - migrations.AlterField( - model_name='assetrule', - name='status', - field=models.IntegerField(choices=[(0, 'No data'), (1, 'No match'), (2, 'Positive'), (3, 'Negative')], default=0), - ), - ] diff --git a/core/migrations/0063_alter_assetrule_unique_together.py b/core/migrations/0063_alter_assetrule_unique_together.py deleted file mode 100644 index c33a9c4..0000000 --- a/core/migrations/0063_alter_assetrule_unique_together.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-13 19:03 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0062_alter_assetrule_status'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='assetrule', - unique_together={('asset', 'group')}, - ), - ] diff --git a/core/migrations/0064_remove_assetgroup_aggregation_and_more.py b/core/migrations/0064_remove_assetgroup_aggregation_and_more.py deleted file mode 100644 index 9b50c1c..0000000 --- a/core/migrations/0064_remove_assetgroup_aggregation_and_more.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-13 19:28 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0063_alter_assetrule_unique_together'), - ] - - operations = [ - migrations.RemoveField( - model_name='assetgroup', - name='aggregation', - ), - migrations.RemoveField( - model_name='assetgroup', - name='allowed', - ), - migrations.RemoveField( - model_name='assetgroup', - name='trigger_above', - ), - migrations.RemoveField( - model_name='assetgroup', - name='trigger_below', - ), - ] diff --git a/core/migrations/0065_assetgroup_when_bearish_assetgroup_when_bullish_and_more.py b/core/migrations/0065_assetgroup_when_bearish_assetgroup_when_bullish_and_more.py deleted file mode 100644 index 5783f95..0000000 --- a/core/migrations/0065_assetgroup_when_bearish_assetgroup_when_bullish_and_more.py +++ /dev/null @@ -1,53 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-13 20:21 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0064_remove_assetgroup_aggregation_and_more'), - ] - - operations = [ - migrations.AddField( - model_name='assetgroup', - name='when_bearish', - field=models.IntegerField(choices=[(6, 'Ignore (no action)'), (-1, 'Default (no remapping)'), (2, 'Bullish'), (3, 'Bearish')], default=-1, max_length=255), - ), - migrations.AddField( - model_name='assetgroup', - name='when_bullish', - field=models.IntegerField(choices=[(6, 'Ignore (no action)'), (-1, 'Default (no remapping)'), (2, 'Bullish'), (3, 'Bearish')], default=-1, max_length=255), - ), - migrations.AddField( - model_name='assetgroup', - name='when_no_aggregation', - field=models.IntegerField(choices=[(6, 'Ignore (no action)'), (-1, 'Default (no remapping)'), (2, 'Bullish'), (3, 'Bearish')], default=-1, max_length=255), - ), - migrations.AddField( - model_name='assetgroup', - name='when_no_data', - field=models.IntegerField(choices=[(6, 'Ignore (no action)'), (-1, 'Default (no remapping)'), (2, 'Bullish'), (3, 'Bearish')], default=-1, max_length=255), - ), - migrations.AddField( - model_name='assetgroup', - name='when_no_match', - field=models.IntegerField(choices=[(6, 'Ignore (no action)'), (-1, 'Default (no remapping)'), (2, 'Bullish'), (3, 'Bearish')], default=-1, max_length=255), - ), - migrations.AddField( - model_name='assetgroup', - name='when_not_in_bounds', - field=models.IntegerField(choices=[(6, 'Ignore (no action)'), (-1, 'Default (no remapping)'), (2, 'Bullish'), (3, 'Bearish')], default=-1, max_length=255), - ), - migrations.AddField( - model_name='assetrule', - name='original_status', - field=models.IntegerField(choices=[(0, 'No data'), (1, 'No match'), (2, 'Bullish'), (3, 'Bearish'), (4, 'No aggregation'), (5, 'Not in bounds'), (6, 'No action')], default=0), - ), - migrations.AlterField( - model_name='assetrule', - name='status', - field=models.IntegerField(choices=[(0, 'No data'), (1, 'No match'), (2, 'Bullish'), (3, 'Bearish'), (4, 'No aggregation'), (5, 'Not in bounds'), (6, 'No action')], default=0), - ), - ] diff --git a/core/migrations/0066_remove_account_risk_model_and_more.py b/core/migrations/0066_remove_account_risk_model_and_more.py deleted file mode 100644 index 5f98019..0000000 --- a/core/migrations/0066_remove_account_risk_model_and_more.py +++ /dev/null @@ -1,81 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-15 18:11 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0065_assetgroup_when_bearish_assetgroup_when_bullish_and_more'), - ] - - operations = [ - migrations.RemoveField( - model_name='account', - name='risk_model', - ), - migrations.RemoveField( - model_name='strategy', - name='callback_price_deviation_percent', - ), - migrations.RemoveField( - model_name='strategy', - name='price_slippage_percent', - ), - migrations.AddField( - model_name='riskmodel', - name='callback_price_deviation_percent', - field=models.FloatField(default=0.5), - ), - migrations.AddField( - model_name='riskmodel', - name='price_slippage_percent', - field=models.FloatField(default=2.5), - ), - migrations.AddField( - model_name='strategy', - name='risk_model', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='core.riskmodel'), - ), - migrations.AlterField( - model_name='assetgroup', - name='when_bearish', - field=models.IntegerField(choices=[(6, 'Always allow'), (7, 'Always deny'), (2, 'Bullish'), (3, 'Bearish')], default=3), - ), - migrations.AlterField( - model_name='assetgroup', - name='when_bullish', - field=models.IntegerField(choices=[(6, 'Always allow'), (7, 'Always deny'), (2, 'Bullish'), (3, 'Bearish')], default=2), - ), - migrations.AlterField( - model_name='assetgroup', - name='when_no_aggregation', - field=models.IntegerField(choices=[(6, 'Always allow'), (7, 'Always deny'), (2, 'Bullish'), (3, 'Bearish')], default=6), - ), - migrations.AlterField( - model_name='assetgroup', - name='when_no_data', - field=models.IntegerField(choices=[(6, 'Always allow'), (7, 'Always deny'), (2, 'Bullish'), (3, 'Bearish')], default=7), - ), - migrations.AlterField( - model_name='assetgroup', - name='when_no_match', - field=models.IntegerField(choices=[(6, 'Always allow'), (7, 'Always deny'), (2, 'Bullish'), (3, 'Bearish')], default=6), - ), - migrations.AlterField( - model_name='assetgroup', - name='when_not_in_bounds', - field=models.IntegerField(choices=[(6, 'Always allow'), (7, 'Always deny'), (2, 'Bullish'), (3, 'Bearish')], default=6), - ), - migrations.AlterField( - model_name='assetrule', - name='original_status', - field=models.IntegerField(choices=[(0, 'No data'), (1, 'No match'), (2, 'Bullish'), (3, 'Bearish'), (4, 'No aggregation'), (5, 'Not in bounds'), (6, 'Always allow'), (7, 'Always deny')], default=0), - ), - migrations.AlterField( - model_name='assetrule', - name='status', - field=models.IntegerField(choices=[(0, 'No data'), (1, 'No match'), (2, 'Bullish'), (3, 'Bearish'), (4, 'No aggregation'), (5, 'Not in bounds'), (6, 'Always allow'), (7, 'Always deny')], default=0), - ), - ] diff --git a/core/migrations/0067_ordersettings_strategy_order_settings.py b/core/migrations/0067_ordersettings_strategy_order_settings.py deleted file mode 100644 index 1a2e176..0000000 --- a/core/migrations/0067_ordersettings_strategy_order_settings.py +++ /dev/null @@ -1,30 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-15 18:31 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0066_remove_account_risk_model_and_more'), - ] - - operations = [ - migrations.CreateModel( - name='OrderSettings', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ('description', models.TextField(blank=True, null=True)), - ('order_type', models.CharField(choices=[('market', 'Market'), ('limit', 'Limit')], default='market', max_length=255)), - ('time_in_force', models.CharField(choices=[('gtc', 'GTC (Good Til Cancelled)'), ('gfd', 'GFD (Good For Day)'), ('fok', 'FOK (Fill Or Kill)'), ('ioc', 'IOC (Immediate Or Cancel)')], default='gtc', max_length=255)), - ('take_profit_percent', models.FloatField(default=1.5)), - ('stop_loss_percent', models.FloatField(default=1.0)), - ('trailing_stop_loss_percent', models.FloatField(blank=True, default=1.0, null=True)), - ('trade_size_percent', models.FloatField(default=0.5)), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - ] diff --git a/core/migrations/0068_strategy_order_settings.py b/core/migrations/0068_strategy_order_settings.py deleted file mode 100644 index e8037d3..0000000 --- a/core/migrations/0068_strategy_order_settings.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-15 18:34 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0067_ordersettings_strategy_order_settings'), - ] - - operations = [ - migrations.AddField( - model_name='strategy', - name='order_settings', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.PROTECT, to='core.ordersettings'), - preserve_default=False, - ), - ] diff --git a/core/migrations/0069_remove_strategy_order_type_and_more.py b/core/migrations/0069_remove_strategy_order_type_and_more.py deleted file mode 100644 index 1ee5a99..0000000 --- a/core/migrations/0069_remove_strategy_order_type_and_more.py +++ /dev/null @@ -1,37 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-15 19:12 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0068_strategy_order_settings'), - ] - - operations = [ - migrations.RemoveField( - model_name='strategy', - name='order_type', - ), - migrations.RemoveField( - model_name='strategy', - name='stop_loss_percent', - ), - migrations.RemoveField( - model_name='strategy', - name='take_profit_percent', - ), - migrations.RemoveField( - model_name='strategy', - name='time_in_force', - ), - migrations.RemoveField( - model_name='strategy', - name='trade_size_percent', - ), - migrations.RemoveField( - model_name='strategy', - name='trailing_stop_loss_percent', - ), - ] diff --git a/core/migrations/0070_strategy_active_management_enabled_and_more.py b/core/migrations/0070_strategy_active_management_enabled_and_more.py deleted file mode 100644 index 80cb93f..0000000 --- a/core/migrations/0070_strategy_active_management_enabled_and_more.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 4.1.6 on 2023-02-15 19:14 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0069_remove_strategy_order_type_and_more'), - ] - - operations = [ - migrations.AddField( - model_name='strategy', - name='active_management_enabled', - field=models.BooleanField(default=False), - ), - migrations.AddField( - model_name='strategy', - name='signal_trading_enabled', - field=models.BooleanField(default=False), - ), - ] diff --git a/core/migrations/0071_alter_account_exchange_activemanagementpolicy.py b/core/migrations/0071_alter_account_exchange_activemanagementpolicy.py deleted file mode 100644 index ef21c0b..0000000 --- a/core/migrations/0071_alter_account_exchange_activemanagementpolicy.py +++ /dev/null @@ -1,30 +0,0 @@ -# Generated by Django 4.1.7 on 2023-02-17 11:50 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0070_strategy_active_management_enabled_and_more'), - ] - - operations = [ - migrations.AlterField( - model_name='account', - name='exchange', - field=models.CharField(choices=[('alpaca', 'Alpaca'), ('oanda', 'OANDA'), ('fake', 'Fake')], max_length=255), - ), - migrations.CreateModel( - name='ActiveManagementPolicy', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ('description', models.TextField(blank=True, null=True)), - ('when_trading_time_violated', models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255)), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - ] diff --git a/core/migrations/0072_activemanagementpolicy_when_asset_groups_violated_and_more.py b/core/migrations/0072_activemanagementpolicy_when_asset_groups_violated_and_more.py deleted file mode 100644 index 21b24e8..0000000 --- a/core/migrations/0072_activemanagementpolicy_when_asset_groups_violated_and_more.py +++ /dev/null @@ -1,58 +0,0 @@ -# Generated by Django 4.1.7 on 2023-02-17 11:58 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0071_alter_account_exchange_activemanagementpolicy'), - ] - - operations = [ - migrations.AddField( - model_name='activemanagementpolicy', - name='when_asset_groups_violated', - field=models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255), - ), - migrations.AddField( - model_name='activemanagementpolicy', - name='when_crossfilter_violated', - field=models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255), - ), - migrations.AddField( - model_name='activemanagementpolicy', - name='when_max_loss_violated', - field=models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255), - ), - migrations.AddField( - model_name='activemanagementpolicy', - name='when_max_open_trades_per_symbol_violated', - field=models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255), - ), - migrations.AddField( - model_name='activemanagementpolicy', - name='when_max_open_trades_violated', - field=models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255), - ), - migrations.AddField( - model_name='activemanagementpolicy', - name='when_max_risk_violated', - field=models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255), - ), - migrations.AddField( - model_name='activemanagementpolicy', - name='when_position_size_violated', - field=models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only'), ('adjust', 'Adjust violating trades')], default='none', max_length=255), - ), - migrations.AddField( - model_name='activemanagementpolicy', - name='when_protection_violated', - field=models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only'), ('adjust', 'Adjust violating trades')], default='none', max_length=255), - ), - migrations.AddField( - model_name='activemanagementpolicy', - name='when_trends_violated', - field=models.CharField(choices=[('none', 'None'), ('close', 'Close violating trades'), ('notify', 'Notify only')], default='none', max_length=255), - ), - ] diff --git a/core/migrations/0073_strategy_active_management_policy.py b/core/migrations/0073_strategy_active_management_policy.py deleted file mode 100644 index 95ac006..0000000 --- a/core/migrations/0073_strategy_active_management_policy.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 4.1.7 on 2023-02-17 13:16 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0072_activemanagementpolicy_when_asset_groups_violated_and_more'), - ] - - operations = [ - migrations.AddField( - model_name='strategy', - name='active_management_policy', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='core.activemanagementpolicy'), - ), - ] diff --git a/core/migrations/0074_remove_session_plan_remove_session_user_and_more.py b/core/migrations/0074_remove_session_plan_remove_session_user_and_more.py deleted file mode 100644 index acdb898..0000000 --- a/core/migrations/0074_remove_session_plan_remove_session_user_and_more.py +++ /dev/null @@ -1,42 +0,0 @@ -# Generated by Django 4.1.7 on 2023-02-24 12:20 - -import uuid - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('core', '0073_strategy_active_management_policy'), - ] - - operations = [ - migrations.RemoveField( - model_name='session', - name='plan', - ), - migrations.RemoveField( - model_name='session', - name='user', - ), - migrations.RenameField( - model_name='user', - old_name='stripe_id', - new_name='billing_provider_id', - ), - migrations.RemoveField( - model_name='user', - name='last_payment', - ), - migrations.RemoveField( - model_name='user', - name='plans', - ), - migrations.DeleteModel( - name='Plan', - ), - migrations.DeleteModel( - name='Session', - ), - ]