Expand description
The reroute benchmark: how each rerouted route did against the historical one, as win/loss counts, volume-weighted bps, and the venues both sides routed through.
The caller selects the records — landed reroutes whose original also landed, with both
realized amounts present and the two mints distinct. collect adds only what needs every
record to decide: a signature seen twice is an ambiguous pairing and drops wholesale.
ExactOut legs are measured input-side (amount is output-token-denominated and outputs tie by
construction, so a win is paying less major input), which leaves a non-major-input ExactOut leg
unpriceable — those are skipped.
Two deliberate differences from the pre-typed-plan reader, both forced by the typing. Hop
amounts arrive as strings, so a float-typed string like "1.5e3" truncates to an integer
instead of voiding the plan — the JSON number/string distinction died with the DOM parse;
genuinely unparseable text still voids. And an explicit "inAmount": null used to void the
whole plan where an absent key merely contributed zero — an Option<String> cannot tell the
two apart, so both now contribute zero.
Structs§
- Load
Stats - What
collectdropped. - Measurement
- One measured leg: how the rerouted route compared and what it was worth.
- Range
Report - How the reroutes did against the original swaps, for one range or a cross-range aggregate. Dollar figures are USD; volumes are the original swaps’ value.
- Side
Totals - USD totals for one side of the majors/exotic split.
- Venue
Totals - One venue’s USD volume, each leg split across its route’s venues by
percent.
Constants§
- OUTLIER_
BPS - Legs whose change exceeds this many bps either way are treated as pricing artifacts, not routing outcomes, and skipped.
- VENUE_
DUST_ USD - Venues under this USD exposure on both sides are dust, hidden from the table.
Functions§
- collect
- Row order is preserved so float accumulation stays deterministic across runs. A signature seen more than once is an ambiguous multi-swap transaction — pairing is by signature — so its rows drop wholesale, and a skipped ExactOut row never claims a signature it could make ambiguous.
- measure
- ExactIn compares delivered output (buys valued at spend); ExactOut compares major input paid
for the identical output.
None= unpriceable or a |bps| >OUTLIER_BPSdollar-outlier.