-
Notifications
You must be signed in to change notification settings - Fork 23
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
Conversation
Signed-off-by: Philipp Hoenisch <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this 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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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]>
39de90d
to
c44ab0d
Compare
Resolves #2187
App:
Webapp: