Implement strategies and posting trades
This commit is contained in:
27
core/migrations/0015_strategy.py
Normal file
27
core/migrations/0015_strategy.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# 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')),
|
||||
],
|
||||
),
|
||||
]
|
||||
27
core/migrations/0016_strategy_user_trade_user.py
Normal file
27
core/migrations/0016_strategy_user_trade_user.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# 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,
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,24 @@
|
||||
# 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),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,28 @@
|
||||
# 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),
|
||||
),
|
||||
]
|
||||
33
core/migrations/0019_account_supported_symbols_and_more.py
Normal file
33
core/migrations/0019_account_supported_symbols_and_more.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# 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),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,54 @@
|
||||
# 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,
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user