diff --git a/migrations/0004_trade_commission.py b/migrations/0004_trade_commission.py new file mode 100644 index 0000000..3078d3a --- /dev/null +++ b/migrations/0004_trade_commission.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-10-20 02:24 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0003_closedtrade'), + ] + + operations = [ + migrations.AddField( + model_name='trade', + name='commission', + field=models.DecimalField(decimal_places=10, default=0, max_digits=20), + ), + ] diff --git a/models.py b/models.py index 6c0c6d5..9c44f30 100644 --- a/models.py +++ b/models.py @@ -14,6 +14,7 @@ class Trade(models.Model): signalId = models.CharField(max_length=64) comment = models.CharField(max_length=256) timestamp = models.DateTimeField() + commission = models.DecimalField(max_digits=20, decimal_places=10, default=0) balanced = models.BooleanField(default=False) class ClosedTrade(models.Model): diff --git a/templates/dashboard/closed_trades.html b/templates/dashboard/closed_trades.html index 6e273f9..cb05d09 100644 --- a/templates/dashboard/closed_trades.html +++ b/templates/dashboard/closed_trades.html @@ -2,6 +2,7 @@ {% load static %} {% load bootstrap3 %} {% load mathfilters %} +{% load humanize %} {% block content %} @@ -37,7 +38,7 @@ {{ closed_trade.security }} {{ closed_trade.entryTime }} {{ closed_trade.exitTime }} - {{ closed_trade.profit }} {{ closed_trade.profitCurrency}} + {{ closed_trade.profit|floatformat:2 }} {{ closed_trade.profitCurrency}} {{ closed_trade.strategyId }} {% endfor %} diff --git a/templates/dashboard/performance.html b/templates/dashboard/performance.html index 7c36cbd..2da5963 100644 --- a/templates/dashboard/performance.html +++ b/templates/dashboard/performance.html @@ -31,6 +31,10 @@ PF {{ results.total.pf|floatformat:2 }} + + Total commission: + {{ results.total.commission|floatformat:2 }} +