Intelligence, Advanced Charting & Trading Platform
fix: make spike threshold boundary floating-point safe
davoodmehraban89 committed
Oct 5, 2026 at 17:01 UTC
4497c25189faa334b6c707b9112cd9b095034b13
1 file changed
+2
-1
packages/market-domain/src/data-quality.mjs
+2
-1
@@ -43,7 +43,8 @@ export function evaluateObservationQuality({
43
}
44
finiteNonNegative(maxMovePct, 'maxMovePct');
45
movePct = Math.abs(price / previousPrice - 1) * 100;
46
- if (movePct > maxMovePct) flags.push('PRICE_SPIKE');
46
+ const epsilon = Math.max(1e-12, Math.abs(maxMovePct) * Number.EPSILON * 8);
47
+ if (movePct - maxMovePct > epsilon) flags.push('PRICE_SPIKE');
48
}
49
50
if (flags.includes('STALE_SOURCE')) return { state: 'STALE', flags, divergencePct, movePct };