From 76e477bcaf57734183f76cf4aa61b0b1e0d9101a Mon Sep 17 00:00:00 2001 From: Richard Holzeis Date: Thu, 25 Jan 2024 08:37:34 +0100 Subject: [PATCH 1/2] feat: Indicate positions direction on quantity --- webapp/frontend/lib/trade/order_and_position_table.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webapp/frontend/lib/trade/order_and_position_table.dart b/webapp/frontend/lib/trade/order_and_position_table.dart index 5cecd2db7..b9f111843 100644 --- a/webapp/frontend/lib/trade/order_and_position_table.dart +++ b/webapp/frontend/lib/trade/order_and_position_table.dart @@ -117,7 +117,9 @@ class OpenPositionTable extends StatelessWidget { for (var position in positions) TableRow( children: [ - buildTableCell(Text(position.quantity.toString())), + buildTableCell(Text(position.direction == "short" + ? "-${position.quantity}" + : "+${position.quantity}")), buildTableCell(Text(position.averageEntryPrice.toString())), buildTableCell(Text(position.liquidationPrice.toString())), buildTableCell(Text(position.collateral.toString())), From c2a4fdce986395a1f467de384c2d5ecfd9ae4d40 Mon Sep 17 00:00:00 2001 From: Richard Holzeis Date: Thu, 25 Jan 2024 08:44:28 +0100 Subject: [PATCH 2/2] fix(frontend): Consider pnl in payout calculation --- webapp/frontend/lib/trade/order_and_position_table.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webapp/frontend/lib/trade/order_and_position_table.dart b/webapp/frontend/lib/trade/order_and_position_table.dart index b9f111843..1f7790d0a 100644 --- a/webapp/frontend/lib/trade/order_and_position_table.dart +++ b/webapp/frontend/lib/trade/order_and_position_table.dart @@ -142,7 +142,9 @@ class OpenPositionTable extends StatelessWidget { pnl: position.pnlSats, fee: position.closingFee, payout: position.closingFee != null - ? Amount(position.collateral.sats + position.closingFee!.sats) + ? Amount(position.collateral.sats + + (position.pnlSats?.sats ?? 0) - + (position.closingFee?.sats ?? 0)) : null, leverage: position.leverage, quantity: position.quantity,