lp-math
Installation
SKILL.md
LP Math — AMM Liquidity Provision Mathematics
Automated Market Makers (AMMs) replace traditional orderbooks with liquidity pools. Instead of matching buyers and sellers, a mathematical formula determines prices based on reserve ratios. Liquidity providers (LPs) deposit both assets into a pool and earn fees from every trade.
Understanding the math behind AMMs is essential for:
- Evaluating whether providing liquidity is profitable after impermanent loss
- Estimating price impact before executing large trades
- Comparing capital efficiency across pool types (constant product vs concentrated)
- Calculating expected fee revenue for a given pool position
Related skills: See impermanent-loss for IL calculations, yield-analysis for LP yield modeling, liquidity-analysis for pool depth assessment.
1. Constant Product AMM (xy = k)
The foundational AMM model used by Raydium V4 and most Solana DEXes.