liquidity-analysis
DEX liquidity depth assessment, slippage estimation, and pool composition analysis for Solana tokens
By agiprolabs · 346 installs
npx skills add agiprolabs/claude-trading-skills --skill liquidity-analysis
Source repository · Upstream listing
Liquidity Analysis — DEX Depth Assessment for Solana Tokens
Liquidity analysis answers three critical questions before every trade: Can I get in at a reasonable price? Can I get out when I need to? and Is this pool safe? Without it, you risk excessive slippage, failed exits, and rug pulls.
Why Liquidity Analysis Matters
Position sizing : Maximum position size is bounded by available liquidity. A $10K position in a pool with $20K TVL will move the price significantly. Rule of thumb: keep trade size under 2% of pool depth to limit slippage below 1%.
Execution cost : Slippage is a direct cost. On a 5 SOL buy, the difference between 0.3% and 3% slippage is real money lost on every entry and exit.
Rug risk detection : Thin liquidity, single pools, unlocked LP tokens, and newly created pools are warning signs. Liquidity analysis catches these before you enter.
Exit planning : Entry liquidity may differ from exit liquidity. If LP is unlocked and owned by one wallet, it can be pulled at any time.
Key Concepts
Total Value Locked (TVL)
Total value of assets deposited in a pool. For a SOL/TOKEN pool with 100 SOL and 1M TOKEN at $0.01 each, TVL = 100 SOL price + 1M $0.01. TVL alone is insufficient — you need depth at the current price range.
Liquidity Depth
How much can be traded before moving the price X%. In constant product AMMs, depth is uniform. In concentrated liquidity (CLMM), depth varies by price range — thick near the current price, thin or zero outside active ranges.
Concentration Factor (CLMM)
Concentrated liquidity pools focus capital in a narrow price range, providing deeper liquidity within that range but nothing outside it. A pool with $50K TVL concentrated in a +/ 5% range provides the same depth as a $500K constant product pool within that range, but zero depth beyond it.
Slippage Curve
Slippage is not linear. Plotting slippage against trade size produces a curve that's gentle for small trades and steep for large ones. The shape depends on pool type, TVL, and concentration.
Pool Composition
Who provides liquidity matters. Locked LP tokens cannot be withdrawn (safer). Single sided liquidity means the pool is imbalanced. Pool age indicates stability — pools older than 7 days with consistent TVL are more reliable.
Data Sources
Four complementary data sources, from free to comprehensive:
Source Auth Required Best For Limitations
DexScreener None Quick pool lookup, liquidity.usd No on chain pool details
Jupiter Quote API None Empirical slippage at any size Aggregate across pools
Birdeye API key Detailed pool data, trade history Rate limited on free tier
On chain RPC only LP lock status, exact reserves Requires program knowledge
See references/data sources.md for complete endpoint documentation and usage examples.
Core Analysis Pipeline
Step 1: Identify Pools
Fetch all pools for a token. Most Solana tokens have multiple pools across Raydium, Orca, and Meteora.
Step 2: Measure Depth
For each pool, extract liquidity metrics:
Step 3: Estimate Slippage
Use Jupiter quotes at multiple sizes to build an empirical slippage curve. This captures real routing across all pools:
Step 4: Assess Concentration
For CLMM pools (Orca Whirlpool, Raydium CLMM, Meteora DLMM), liquidity may be concentrated in a narrow range. Check if the current price is within the active range and how deep liquidity extends:
Step 5: Compute Liquidity Score
Composite score from 0 (dangerous) to 100 (deep, safe liquidity):
Risk Flags
Flag these conditions before entering any position:
Flag Condition Risk Level
Single Pool Only 1 DEX pool exists High
Thin Liquidity Total TVL < $10,000 Critical
New Pool Pool created < 2 hours ago High
Unlocked LP LP tokens not burned/locked Medium
Volume Mismatch Volume TVL (wash trading) Medium
Price Deviation 5% price difference across pools High
Concentrated CLMM 80% liquidity in CLMM with narrow range Medium
Position Sizing from Liquidity
Maximum position size should keep slippage under your threshold:
Trade Type Max Slippage Max Position % of TVL
Scalp 0.5% (50 bps) 1%
Swing 2% (200 bps) 2 5%
Position 5% (500 bps) 5 10%
Slippage Estimation
For detailed slippage mathematics including constant product formulas, CLMM models, and empirical curve fitting, see references/slippage curves.md .
Key formula for constant product AMM:
Where Δx is trade size and x is pool reserve of the input token. For a 1 SOL trade on a pool with 100 SOL reserve, slippage = 1/101 = 0.99%.
Pool Types
Solana DEXes use different AMM designs with different liquidity characteristics. See references/pool types.md for comprehensive coverage including:
Constant Product (Raydium V4, Orca Legacy): Uniform liquidity, predictable slippage
Concentrated Liquidity (Raydium CLMM, Orca Whirlpool): Deep at current price, zero outside range
Dynamic AMM (Meteora DLMM): Adaptive fees, bin based liquidity
Integration with Other Skills
token holder analysis : Check LP token holder distribution before entering. If one wallet holds 50% of LP tokens and they are unlocked, exit risk is high.
position sizing : Feed max position from liquidity() output into position sizing models as an upper bound.
slippage modeling : Use the empirical slippage curves from this skill as input to execution cost models.
birdeye api : Fetch detailed pool data including trade history and LP events.
dexscreener api : Free pool discovery and basic liquidity metrics.
Example Workflow
Files
File Description
references/slippage curves.md Slippage math for constant product and CLMM pools, empirical curve fitting
references/pool types.md AMM designs on Solana: constant product, concentrated, dynamic
references/data sources.md API endpoints and on chain methods for fetching liquidity data
scripts/analyze liquidity.py Full liquidity assessment with scoring and risk flags
scripts/pool comparison.py Compare pools across DEXes for a token