summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/trading/templates/trading/list.html13
-rw-r--r--app/trading/views.py3
2 files changed, 16 insertions, 0 deletions
diff --git a/app/trading/templates/trading/list.html b/app/trading/templates/trading/list.html
index 57b2b4b..47ed27e 100644
--- a/app/trading/templates/trading/list.html
+++ b/app/trading/templates/trading/list.html
@@ -110,5 +110,18 @@
<td class="notes">{{object.notes}}</td>
</tr>
{% endfor %}
+ <tr>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td>{{month}} P/L:</td>
+ <td>{{monthly_pl.pl__sum}}</td>
+ </tr>
</table>
{% endblock %}
diff --git a/app/trading/views.py b/app/trading/views.py
index a32d571..4d33497 100644
--- a/app/trading/views.py
+++ b/app/trading/views.py
@@ -1,3 +1,4 @@
+from datetime import datetime
from django.shortcuts import render
from django.views.generic.edit import FormView
from django.views.generic.edit import CreateView, DeleteView, UpdateView
@@ -35,6 +36,8 @@ class LuxTradeListView(PaginatedListView):
context = super(LuxTradeListView, self).get_context_data(**kwargs)
context['open_trades'] = LuxTrade.objects.filter(status=0)
context['watch_trades'] = LuxTrade.objects.filter(status=2)
+ context['monthly_pl'] = LuxTrade.stats.get_month_pl()
+ context['month'] = datetime.now().strftime('%h')
return context
def get_queryset(self):