From 2f642c1ad311437aa64e8ebc199c3048bacc3b22 Mon Sep 17 00:00:00 2001 From: Denis Tereshkin Date: Tue, 7 Mar 2017 20:13:19 +0700 Subject: [PATCH] ClosedTrade model --- migrations/0003_closedtrade.py | 29 +++++++++++++++++++++++++++++ models.py | 15 +++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 migrations/0003_closedtrade.py diff --git a/migrations/0003_closedtrade.py b/migrations/0003_closedtrade.py new file mode 100644 index 0000000..a4d83a7 --- /dev/null +++ b/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)), + ], + ), + ] diff --git a/models.py b/models.py index d948642..6c0c6d5 100644 --- a/models.py +++ b/models.py @@ -16,3 +16,18 @@ class Trade(models.Model): timestamp = models.DateTimeField() 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)