summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/trading/views.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/trading/views.py b/app/trading/views.py
index 62f0dd5..f2ecfe3 100644
--- a/app/trading/views.py
+++ b/app/trading/views.py
@@ -18,7 +18,10 @@ class LuxTradeListView(PaginatedListView):
context['open_trades'] = LuxTrade.objects.filter(status=0)
context['watch_trades'] = LuxTrade.objects.filter(status=2)
context['options_trades'] = LuxOptionsTrade.objects.filter(status__in=[0,2])
- context['options_trades_closed'] = LuxOptionsTrade.objects.filter(status=1)
+ last_day = calendar.monthrange(timezone.now().year, month)[1]
+ start_date = datetime.date(timezone.now().year, month, 1)
+ end_date = datetime.date(timezone.now().year, month, last_day)
+ context['options_trades_closed'] = LuxOptionsTrade.objects.filter(status=1).filter(close_date__range=(start_date, end_date))
context['monthly_pl'] = LuxTrade.stats.get_month_pl()
context['year_pl'] = LuxTrade.stats.get_year_pl()
#context['options_monthly_pl'] = LuxOptionsTrade.stats.get_month_pl()