Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(webapp/app): show pnl as percent #2221

Merged
merged 2 commits into from
Mar 13, 2024
Merged

feat(webapp/app): show pnl as percent #2221

merged 2 commits into from
Mar 13, 2024

Conversation

bonomat
Copy link
Contributor

@bonomat bonomat commented Mar 12, 2024

Resolves #2187

App:

image

Webapp:

image

Signed-off-by: Philipp Hoenisch <[email protected]>
Copy link
Contributor

@luckysori luckysori left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@holzeis holzeis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@@ -70,6 +71,10 @@ class _PositionListItemState extends State<PositionListItem> {

TextStyle dataRowStyle = const TextStyle(fontSize: 14);

Amount? unrealizedPnl = notNullPosition.unrealizedPnl;
double pnlPercent =
((unrealizedPnl?.sats ?? Amount.zero().sats) / notNullPosition.collateral.sats) * 100.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 we should probably round here to 2 numbers after the comma.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out.

It's done when the pnlPercent is being used with toStringAsFixed(2). (I initially used the wrong function, but now it's correct).

Signed-off-by: Philipp Hoenisch <[email protected]>
@bonomat bonomat enabled auto-merge March 13, 2024 01:38
@bonomat bonomat added this pull request to the merge queue Mar 13, 2024
Merged via the queue into main with commit 4a6d4b9 Mar 13, 2024
19 checks passed
@bonomat bonomat deleted the feat/pnl-percent branch March 13, 2024 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show PnL in % (App and Webapp)
3 participants