diff --git a/migrations/0002_trade.py b/migrations/0002_trade.py new file mode 100644 index 0000000..b41df9b --- /dev/null +++ b/migrations/0002_trade.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.6 on 2017-03-06 14:17 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Trade', + 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)), + ('price', models.DecimalField(decimal_places=10, max_digits=20)), + ('quantity', models.IntegerField()), + ('volume', models.DecimalField(decimal_places=10, max_digits=25)), + ('volumeCurrency', models.CharField(max_length=10)), + ('strategyId', models.CharField(max_length=64)), + ('signalId', models.CharField(max_length=64)), + ('comment', models.CharField(max_length=256)), + ('timestamp', models.DateTimeField()), + ('balanced', models.BooleanField(default=False)), + ], + ), + ] diff --git a/models.py b/models.py index cbece3c..d948642 100644 --- a/models.py +++ b/models.py @@ -2,3 +2,17 @@ from django.db import models class RobotInstance(models.Model): instanceId = models.CharField(max_length=255) + +class Trade(models.Model): + account = models.CharField(max_length=256) + security = models.CharField(max_length=256) + price = models.DecimalField(max_digits=20, decimal_places=10) + quantity = models.IntegerField() + volume = models.DecimalField(max_digits=25, decimal_places=10) + volumeCurrency = models.CharField(max_length=10) + strategyId = models.CharField(max_length=64) + signalId = models.CharField(max_length=64) + comment = models.CharField(max_length=256) + timestamp = models.DateTimeField() + balanced = models.BooleanField(default=False) + diff --git a/templates/dashboard/base.html b/templates/dashboard/base.html index bd84c32..6418644 100644 --- a/templates/dashboard/base.html +++ b/templates/dashboard/base.html @@ -16,6 +16,7 @@
diff --git a/templates/dashboard/trades.html b/templates/dashboard/trades.html new file mode 100644 index 0000000..de9287f --- /dev/null +++ b/templates/dashboard/trades.html @@ -0,0 +1,33 @@ +{% extends "dashboard/base.html" %} +{% load mathfilters %} + +{% block content %} +| Time | +Account | +Security | +Operation | +Price | +Quantity | +Volume | +Strategy ID | +Signal ID | ++ |
| {{ trade.timestamp }} | +{{ trade.account }} | +{{ trade.security }} | +{% if trade.quantity > 0 %} Buy {% else %} Sell {% endif %} | +{{ trade.price }} | +{{ trade.quantity|abs }} | +{{ trade.volume|stringformat:".3f"}} {{ trade.volumeCurrency }} | +{{ trade.strategyId }} | +{{ trade.signalId }} | ++ |