Commit 56df5f7
committed
fix(pnl): skip invalid PnL; broadcast close only with real PnL
- Handle undefined/null/NaN in formatPnL by returning an empty string
- Show PnL in toasts only when a valid formatted value exists
- Default toast variant to success when PnL is missing/zero
- Stop broadcasting position_closed on immediate close; only send position_update
and rely on ORDER_TRADE_UPDATE to broadcast position_closed with actual PnL
This prevents misleading "PnL: $NaN"/zero displays and avoids premature or duplicate
close notifications, improving accuracy and UX.1 parent 6cdb83f commit 56df5f7
File tree
2 files changed
+12
-14
lines changed- src
- hooks
- lib/bot
2 files changed
+12
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
79 | | - | |
| 82 | + | |
| 83 | + | |
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
| |||
133 | 137 | | |
134 | 138 | | |
135 | 139 | | |
136 | | - | |
137 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
138 | 143 | | |
139 | 144 | | |
140 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
667 | | - | |
| 667 | + | |
| 668 | + | |
668 | 669 | | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
| 670 | + | |
678 | 671 | | |
679 | 672 | | |
680 | 673 | | |
| |||
0 commit comments