Lp Math

AMM liquidity provision mathematics including constant-product, concentrated liquidity, price impact, and LP share calculations

564 stars 113 forksOther Plugin marketplace

Install

Claude Code plugin
/plugin marketplace add agiprolabs/claude-trading-skills

The repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add agiprolabs/claude-trading-skills --skill lp-math
Manual install
git clone --depth 1 https://github.com/agiprolabs/claude-trading-skills.git /tmp/claude-trading-skills
mkdir -p ~/.claude/skills
cp -r /tmp/claude-trading-skills/skills/lp-math ~/.claude/skills/lp-math

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the 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.

### Core Invariant

```
x * y = k
```

Where:
- `x` = reserve amount of token X (e.g., SOL)
- `y` = reserve amount of token Y (e.g., USDC)
- `k` = constant product (increases over time from fees)

### Spot Price

```
P = x / y    (price of Y in terms of X)
P = y / x    (price of X in terms of Y)
```

For a pool with 100 SOL and 10,000 USDC: price of SOL = 10,000 / 100 = 100 USDC.

### Trade Execution

When a trader swaps Δx of token X into the pool:
Read the full skill on GitHub

Details

Skill name
lp-math
Path
skills/lp-math/SKILL.md
License
MIT
Repo updated
3 September 2026

FAQ

What does the Lp Math skill do?

AMM liquidity provision mathematics including constant-product, concentrated liquidity, price impact, and LP share calculations

How do I install the Lp Math skill?

Claude Code plugin: /plugin marketplace add agiprolabs/claude-trading-skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Lp Math popular?

It lives in agiprolabs/claude-trading-skills, which has 564 GitHub stars and 113 forks.

Related skills

Browse the most popular Claude skills, all other skills, or write your own with the skills generator.