DeFi Liquidity Optimizer
Analyzes concentrated liquidity pools across Solana and Ethereum to find optimal LP positions and monitor existing positions for rebalancing needs.
Pool Analysis Features
- APR Comparison - Ranks pools by annual percentage yield
- TVL Safety Scores - Higher TVL = lower IL risk and more stable fees
- Fee Efficiency - Fees earned relative to trading volume
- Impermanent Loss Calculator - Shows impact at multiple price scenarios
- Rebalancing Alerts - Detects when positions fall out of range
Usage
# Full comparison report
python scripts/liquidity_optimizer.py compare
# APR rankings only
python scripts/liquidity_optimizer.py rank
# IL calculation for specific price change
python scripts/liquidity_optimizer.py il 1.5 # 1.5x = 50% increase
python scripts/liquidity_optimizer.py il 0.75 # 0.75x = 25% decrease
Understanding the Output
The comparison report shows each pool with:
- APR and daily fee earnings on a $1000 investment
- TVL-based safety score (1-5 stars)
- Fee efficiency percentage
- IL scenarios for different price changes
Production Integration
For live pool data, connect to:
- Meteora DLMM API for Solana pools
- Raydium API for Solana pools
- Hummingbot Gateway for Ethereum Uniswap V4
The current script uses mock data structure that maps to real API responses.