A command-line tool to compute the 2% depth of on-chain liquidity for a given token pair and protocol, using the Tycho Simulation framework.
For a given token_in
, token_out
, and protocol (e.g. uniswap_v3
, balancer_v2
), this tool simulates swaps using Tycho to determine:
- The maximum amount of
token_in
that can be swapped - Before slippage exceeds 2% relative to the current spot price
The tool performs a binary search over input sizes and logs results to disk.
Liquidity depth is critical for:
- Traders seeking to estimate price impact before executing large swaps
- Protocol researchers analyzing cross-DEX liquidity profiles
- MEV solvers and routing engines evaluating execution viability
This tool gives a fast, scriptable way to inspect protocol-level liquidity without needing custom integrations or node infrastructure.
- Fast REVM-based swap simulation via Tycho
- Slippage-aware binary search for 2% depth
- Logs results in structured JSONL format
- Optional TUI for interactive usage (WIP)
# Not possible to run this right now
- Feat: Generic over ApiProvider to integrate other APIs like Uniswap Routing API, 0x, Odos, 1Inch, etc.
TODO: keep track of which pairs/ProtocolStates have been updated from the stream