Problem
pseudoChange(market) on /markets returns ((hashBase(market) % 1601) - 800) / 100 — a deterministic but completely fake number in [-8%, +8%].
MarketHeader's 24h change works correctly against the local anchor price (first observed value after page load), but that's "change since you opened the tab", not 24h.
Proposal
Once #152 ships, MarketInfo can carry a change24hPct field computed at REST read time:
fn change_24h_pct(market_id: &str) -> Decimal {
let candles = self.candles_24h(market_id);
let open = candles.first().map(|c| c.open).unwrap_or_default();
let close = candles.last().map(|c| c.close).unwrap_or_default();
if open.is_zero() { return dec!(0); }
((close - open) / open) * dec!(100)
}
FE: drop pseudoChange everywhere, read market.change24hPct.
Acceptance
Depends on
#152
Problem
pseudoChange(market)on /markets returns((hashBase(market) % 1601) - 800) / 100— a deterministic but completely fake number in [-8%, +8%].MarketHeader's 24h change works correctly against the local anchor price (first observed value after page load), but that's "change since you opened the tab", not 24h.
Proposal
Once #152 ships, MarketInfo can carry a
change24hPctfield computed at REST read time:FE: drop
pseudoChangeeverywhere, readmarket.change24hPct.Acceptance
Depends on
#152