diff options
author | lxf <sng@luxagraf.net> | 2022-01-06 11:20:15 -0500 |
---|---|---|
committer | lxf <sng@luxagraf.net> | 2022-01-06 11:20:15 -0500 |
commit | b6cfaf59b1736bf91ce7a9497607ffca4a738065 (patch) | |
tree | b2fcf275a48dc4290c972d06e96f0303a5d0a66c /app/trading/models.py | |
parent | 96232c02fe68f7f8c1213ce3e81c9c594ac4e9e5 (diff) |
trad: updated admin
Diffstat (limited to 'app/trading/models.py')
-rw-r--r-- | app/trading/models.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/trading/models.py b/app/trading/models.py index faac7ba..17a1b85 100644 --- a/app/trading/models.py +++ b/app/trading/models.py @@ -376,7 +376,7 @@ class LuxOptionPurchase(models.Model): status = models.IntegerField(choices=STATUS, default=0) class Meta: - ordering = ('-open_date',) + ordering = ('-open_date', 'status') get_latest_by = 'open_date' objects = models.Manager() # The default manager. @@ -393,14 +393,14 @@ class LuxOptionPurchase(models.Model): @property def profit_loss(self): - total = 0 + total = float(0) for option in self.luxoptioncontract_set.all(): if option.contract_close_price: pl = option.contract_close_price - option.contract_open_price else: pl = 0 total = total + pl - return total*100 + return round((total*100),2) @property def stop_price(self): |