We wanted one chart that shows BTC and ETH from Binance and from every large Ethereum pool as separate lines, with no averaging and no invented points. Binance is the easy half: its @trade stream gives price, quantity and time per trade. The pools are harder: eight protocol families, each with its own events, its own math and its own idea of what "the price" is. This post is what we learned building that observer in Rust, with numbers from its own data.
Two kinds of price
For every pool we keep two things apart:
Trade price — the ratio of what actually changed hands in one swap: quote_amount / base_amount , taken from the swap's two legs. It produces volume.
Spot price — the pool's marginal price right after an event (or at block end). It produces the line on the chart and never produces volume.
A swap whose legs do not move in opposite directions is not a trade and is skipped. All ratios are exact decimals truncated (not rounded) at 24 places; JSON carries them as strings.…