lp-math

Calculate AMM formulas, price impact, and LP fees for Solana DEXs.

266|54|Updated Mar 11, 2026
One-click install
npx skills add https://github.com/agiprolabs/claude-trading-skills --skill lp-math
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lp-math
Source: https://github.com/agiprolabs/claude-trading-skills/tree/main/skills/lp-math
Command: npx skills add https://github.com/agiprolabs/claude-trading-skills --skill lp-math

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill demystifies the complex mathematics behind Automated Market Makers (AMMs) and Concentrated Liquidity Market Makers (CLMMs), enabling users to make informed decisions about liquidity provision.

Core Features & Use Cases

  • AMM Formulas: Understand constant product (xy=k) and concentrated liquidity models.
  • Price Impact & Slippage: Calculate how trades affect prices and estimate slippage.
  • LP Share & Fee Calculations: Determine LP earnings, impermanent loss, and optimal strategies.
  • Use Case: Before depositing funds into a new liquidity pool, use this Skill to calculate the potential fee APR, estimate impermanent loss for various price scenarios, and compare capital efficiency across different CLMM ranges to maximize your yield.

Quick Start

Calculate the capital efficiency for a concentrated liquidity position with a price range from $95 to $105.

Frequently Asked Questions about lp-math

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I calculate impermanent loss for concentrated liquidity AMMs?

To calculate impermanent loss for concentrated liquidity AMMs, you apply constant product math modified by your specific price range. This Skill provides the exact formulas to compare LP holdings against an undivided asset baseline across various price scenarios.

What is the formula for price impact in a constant product xy=k AMM?

The formula for price impact in a constant product xy=k AMM derives from the shifting ratio of token reserves after a trade. This Skill details the exact mathematical execution to estimate slippage and final spot price.

How do I calculate capital efficiency for a CLMM position on Solana DEXs?

You calculate capital efficiency for a CLMM position by comparing the liquidity density within your chosen price range to a full-range position. This Skill provides examples to compute this ratio for Solana DEXs like Raydium, Orca, and Meteora.

How do I determine LP share minting and fee accrual math in yield farming?

To determine LP share minting and fee accrual math in yield farming, you calculate the proportional ownership of the pool minted upon deposit. This Skill provides the formulas to track accumulating fees against your specific LP share.

Can I use these AMM mathematical formulas for both standard and concentrated liquidity pools?

Yes, you can use these AMM mathematical formulas for both standard and concentrated liquidity pools. The Skill covers constant product xy=k models and CLMM mechanics, providing practical examples for calculating spot price, trade execution, and yield farming returns.