/v1/svm/pools/ohlc exposes the p5 / p95 quantiles of price as low and high, while open and close come from argMin / argMax over time. When a candle's open or close trade falls in the lowest 5% or highest 5% of fills, that price sits outside the [low, high] band — a violation of standard OHLC semantics.
src/routes/ohlcv/svm.sql:14-15:
quantileDeterministicMerge(0.95)(quantile0) AS high_raw,
quantileDeterministicMerge(0.05)(quantile0) AS low_raw,
Suggested fix
Clamp high_raw to greatest(high_quantile, open, close) and low_raw to least(low_quantile, open, close) so that low ≤ {open, close} ≤ high holds for every row.
🤖 Generated with Claude Code
/v1/svm/pools/ohlcexposes the p5 / p95 quantiles of price aslowandhigh, whileopenandclosecome fromargMin/argMaxover time. When a candle's open or close trade falls in the lowest 5% or highest 5% of fills, that price sits outside the[low, high]band — a violation of standard OHLC semantics.src/routes/ohlcv/svm.sql:14-15:Suggested fix
Clamp
high_rawtogreatest(high_quantile, open, close)andlow_rawtoleast(low_quantile, open, close)so thatlow ≤ {open, close} ≤ highholds for every row.🤖 Generated with Claude Code