Intelligence, Advanced Charting & Trading Platform
fix(paper): normalize negative-zero simulated P&L for stable summaries
davoodmehraban89 committed
Oct 14, 2026 at 22:43 UTC
9bfe8891ecf204b5e19c5a6aea61affdec21d77c
1 file changed
+4
-1
packages/market-domain/src/paper-position.mjs
+4
-1
@@ -29,7 +29,10 @@ const asTimestamp = (timestamp, name) => {
29
}
30
return new Date(timestamp).toISOString();
31
};
32
-const decimal = (x) => Math.round(x * 1e10) / 1e10;
32
+const decimal = (x) => {
33
+ const rounded = Math.round(x * 1e10) / 1e10;
34
+ return Object.is(rounded, -0) ? 0 : rounded;
35
+};
36
const sideSign = (side) => side === 'LONG' ? 1 : -1;
37
38
export function openPaperPosition({