summaryrefslogtreecommitdiff
path: root/app/trading/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/trading/models.py')
-rw-r--r--app/trading/models.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/trading/models.py b/app/trading/models.py
index 026c9cb..704f3bb 100644
--- a/app/trading/models.py
+++ b/app/trading/models.py
@@ -106,6 +106,10 @@ class LuxTradeStatsManager(models.Manager):
end_date = datetime.date(timezone.now().year, month, last_day)
return self.filter(close_date__range=(start_date, end_date)).aggregate(Sum('pl'))
+ def get_year_pl(self, year=timezone.now().year):
+ start_date = datetime.date(year, 1, 1)
+ end_date = datetime.date(year, 12, 31)
+ return self.filter(close_date__range=(start_date, end_date)).aggregate(Sum('pl'))
class LuxTrade(models.Model):
symbol = models.CharField(max_length=256)