Browse Source

ClosedTrade model

master
Denis Tereshkin 9 years ago
parent
commit
2f642c1ad3
  1. 29
      migrations/0003_closedtrade.py
  2. 15
      models.py

29
migrations/0003_closedtrade.py

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-07 13:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0002_trade'),
]
operations = [
migrations.CreateModel(
name='ClosedTrade',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('account', models.CharField(max_length=256)),
('security', models.CharField(max_length=256)),
('entryTime', models.DateTimeField()),
('exitTime', models.DateTimeField()),
('profit', models.DecimalField(decimal_places=10, max_digits=25)),
('profitCurrency', models.CharField(max_length=10)),
('strategyId', models.CharField(max_length=64)),
('direction', models.CharField(choices=[('long', 'long'), ('short', 'short')], max_length=10)),
],
),
]

15
models.py

@ -16,3 +16,18 @@ class Trade(models.Model):
timestamp = models.DateTimeField() timestamp = models.DateTimeField()
balanced = models.BooleanField(default=False) balanced = models.BooleanField(default=False)
class ClosedTrade(models.Model):
LONG = 'long'
SHORT = 'short'
DIRECTION_CHOICES = (
(LONG, 'long'),
(SHORT, 'short')
)
account = models.CharField(max_length=256)
security = models.CharField(max_length=256)
entryTime = models.DateTimeField()
exitTime = models.DateTimeField()
profit = models.DecimalField(max_digits=25, decimal_places=10)
profitCurrency = models.CharField(max_length=10)
strategyId = models.CharField(max_length=64)
direction = models.CharField(max_length=10, choices=DIRECTION_CHOICES)

Loading…
Cancel
Save