fix(kuru): switch base_trades to OrderBook Trade for full CLOB volume#9695
Open
kkqzhou wants to merge 1 commit into
Open
fix(kuru): switch base_trades to OrderBook Trade for full CLOB volume#9695kkqzhou wants to merge 1 commit into
kkqzhou wants to merge 1 commit into
Conversation
Source was Router.KuruRouterSwap, which captures only ~3% of CLOB fills (just the aggregator-routed path). Direct limit orders, margin fills, and KuruFlow-routed swaps were entirely missing — $248k reported vs $13.4M actual for 2026-05-21. Switch to per-market OrderBook.Trade joined with Router.MarketRegistered for (baseAsset, quoteAsset, sizePrecision). Conversion math verified against Router-OB matched txs: base_atomic = filledSize * 10^base_dec / sizePrecision; quote_atomic = filledSize * price * 10^quote_dec / (sizePrecision * 10^18). The price field is always scaled by 10^18 regardless of pricePrecision (which is UI tick metadata). Direction resolved from isBuy. taker/maker now populated from the event. End-to-end Dune simulation for 2026-05-21: 47,905 rows, \$13.35M USD. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The original source of the kuru trades in dex.trades was Router.KuruRouterSwap, which captures only ~3% of CLOB fills (just the aggregator-routed path). Direct limit orders, margin fills, and KuruFlow-routed swaps were entirely missing. The solution is to switch to per-market OrderBook.Trade joined with Router.MarketRegistered for (baseAsset, quoteAsset, sizePrecision). Conversion math verified against Router-OB matched txs:
The price field is always scaled by 10^18 regardless of pricePrecision (which is UI tick metadata). Direction resolved from isBuy. taker/maker now populated from the event.
quick links for more information: