Add unrealized PL to profit screen

This commit is contained in:
Mark Veidemanis 2022-12-08 07:20:46 +00:00
parent 103a15f0e3
commit a18572ebda
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 4 additions and 2 deletions

View File

@ -11,6 +11,7 @@
<th>id</th> <th>id</th>
<th>name</th> <th>name</th>
<th>P/L</th> <th>P/L</th>
<th>Trade</th>
<th>balance</th> <th>balance</th>
<th>currency</th> <th>currency</th>
</thead> </thead>
@ -22,6 +23,7 @@
<td>{{ item.account.id }}</td> <td>{{ item.account.id }}</td>
<td>{{ item.account.name }}</td> <td>{{ item.account.name }}</td>
<td>{{ item.pl }}</td> <td>{{ item.pl }}</td>
<td>{{ item.unrealizedPL }}</td>
<td>{{ item.balance }}</td> <td>{{ item.balance }}</td>
<td>{{ item.currency }}</td> <td>{{ item.currency }}</td>
</tr> </tr>

View File

@ -26,10 +26,10 @@ class Profit(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
for account in accounts: for account in accounts:
try: try:
details = account.client.get_account() details = account.client.get_account()
pl = details["pl"]
item = { item = {
"account": account, "account": account,
"pl": float(pl), "pl": float(details["pl"]),
"unrealizedPL": float(details["unrealizedPL"]),
"balance": details["balance"], "balance": details["balance"],
"currency": details["currency"], "currency": details["currency"],
} }