Skip to content

mud2monarch/liquidity-depth-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Liquidity Depth CLI Tool

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.

What It Does

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.

Why It’s Useful

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.

Features

  • 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)

Getting Started

# Not possible to run this right now

Feat/TODO

  • 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

About

CLI tool to calculate 2% liquidity depth for any pair on any AMM protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages