Intro
The Tycho Market Maker is a Rust program that monitors price differences between a reference (e.g. centralised exchanges) and on-chain liquidity pools. When it finds spread or profitable opportunities, it executes trades to bring the pool price back in line with the reference price.
In other words, it keeps on-chain pool prices aligned with external reference prices by trading when deviations occur.
It's best suited for stablecoin pairs (e.g. USDC/DAI) or highly liquid pairs with strong CEX price discovery (ETH/USDC). It's also ideal for enforcing pegs on DAO tokens, custom tokens, or stablecoins with hardcoded reference prices (e.g. $1 for dollar-pegged stablecoins).
The difference between a peg stabiliser and a arbitrage bot ?
Basic arbitrage: Buy low/sell high between two sources when spread > costs. Instant, risk-free.
Statistical arbitrage: Predict price moves using historical data patterns.
Peg stabiliser: Trade when pool price ≠ reference price (Binance/Chainlink), either:
Bet on price returning to peg
Force price back to peg
The market maker automatically measures trade costs including gas fees and manages execution based on user-defined spread thresholds, ensuring trades are only executed when economically viable.
This is a reference implementation meant to be forked and customised, not a production-grade trading system or library to import as a dependency.
Key Components
Price Feeds
Binance WebSocket for real-time CEX prices
Chainlink oracles as a backup option
Any reference price you wish to set up
Execution
Chain-specific transaction building
Gas estimation and slippage limits
Flashbots support on mainnet (Flashblocks on Unichain and Base) to reduce MEV risk
Monitoring
Redis pub/sub for real-time events
PostgreSQL for storing trade history (optional)
Automatic restart, error handling
How It Works
Fetch current price from reference endpoint
Query Tycho for on-chain pool states
Calculate spread and potential profit after gas and fees
If profitable, build and submit transaction
Log results to database and Redis
What You Need
Basic Rust knowledge
Understanding of EVM transactions and gas
Familiarity with AMMs and liquidity pools
PostgreSQL and Docker for local setup
Private keys and RPC endpoints for your target chains
This is a working implementation, not a production-grade trading system. Use it as a reference or starting point for your own market making strategy.
Last updated
