diff --git a/core/templates/partials/account-list.html b/core/templates/partials/account-list.html
index 0d2c46a..c7ce988 100644
--- a/core/templates/partials/account-list.html
+++ b/core/templates/partials/account-list.html
@@ -13,6 +13,7 @@
name |
exchange |
currency |
+ initial |
API key |
sandbox |
enabled |
@@ -25,6 +26,7 @@
{{ item.name }} |
{{ item.exchange }} |
{{ item.currency }} |
+ {{ item.initial_balance }} |
{{ item.api_key }} |
{% if item.sandbox %}
diff --git a/core/views/accounts.py b/core/views/accounts.py
index 7a2d4e5..e6572d5 100644
--- a/core/views/accounts.py
+++ b/core/views/accounts.py
@@ -23,6 +23,7 @@ class AccountInfo(LoginRequiredMixin, OTPRequiredMixin, ObjectRead):
"api_key",
"sandbox",
"supported_symbols",
+ "initial_balance",
# "instruments",
]
diff --git a/core/views/profit.py b/core/views/profit.py
index b87300b..8b98a88 100644
--- a/core/views/profit.py
+++ b/core/views/profit.py
@@ -1,3 +1,5 @@
+from decimal import Decimal as D
+
from django.contrib.auth.mixins import LoginRequiredMixin
from two_factor.views.mixins import OTPRequiredMixin
@@ -29,8 +31,8 @@ class Profit(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
details = account.client.get_account()
item = {
"account": account,
- "pl": float(details["pl"]),
- "unrealizedPL": float(details["unrealizedPL"]),
+ "pl": D(account.initial_balance) - D(details["balance"]),
+ "unrealizedPL": D(details["unrealizedPL"]),
"balance": details["balance"],
"currency": details["currency"],
}
|