From a18572ebda92f30ea4621e0b254562e8e5d4db6c Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Thu, 8 Dec 2022 07:20:46 +0000 Subject: [PATCH] Add unrealized PL to profit screen --- core/templates/partials/profit-list.html | 2 ++ core/views/profit.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/templates/partials/profit-list.html b/core/templates/partials/profit-list.html index 7e5aab9..57a0ab4 100644 --- a/core/templates/partials/profit-list.html +++ b/core/templates/partials/profit-list.html @@ -11,6 +11,7 @@ id name P/L + Trade balance currency @@ -22,6 +23,7 @@ {{ item.account.id }} {{ item.account.name }} {{ item.pl }} + {{ item.unrealizedPL }} {{ item.balance }} {{ item.currency }} diff --git a/core/views/profit.py b/core/views/profit.py index 8b367e1..fac2377 100644 --- a/core/views/profit.py +++ b/core/views/profit.py @@ -26,10 +26,10 @@ class Profit(LoginRequiredMixin, OTPRequiredMixin, ObjectList): for account in accounts: try: details = account.client.get_account() - pl = details["pl"] item = { "account": account, - "pl": float(pl), + "pl": float(details["pl"]), + "unrealizedPL": float(details["unrealizedPL"]), "balance": details["balance"], "currency": details["currency"], }