From a0d719c828953c4b655eb54c8c2ab3b7cfde7607 Mon Sep 17 00:00:00 2001 From: lxf Date: Wed, 16 Mar 2022 10:10:43 -0400 Subject: trad: shortened list of WON trades to just current month --- app/trading/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/trading') 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() -- cgit v1.2.3-70-g09d2