liquidity-analysis

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Liquidity Analysis — DEX Depth Assessment for Solana Tokens

流动性分析——Solana 代币的 DEX 深度评估

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.
流动性分析在每次交易前回答三个关键问题:我能否以合理价格进场? 我需要退出时能否顺利卖出? 这个资金池安全吗? 如果不进行流动性分析,您可能会承担过高滑点、退出失败和 rug pull(跑路盘)风险。

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.
仓位规模:最大仓位规模受可用流动性限制。一个 TVL 为 2 万美元的池子中放入 1 万美元仓位,会显著推动价格。经验法则:交易规模保持在池深度的 2% 以下,将滑点控制在 1% 以下。
执行成本:滑点会直接构成成本。对于一笔 5 SOL 的买入,0.3% 与 3% 滑点之间的差异,会在每次进场和退出时造成真金白银的损失。
rug pull 风险检测:流动性薄弱、单一资金池、已解锁的 LP token 和新创建的资金池都是警示信号。流动性分析可以在进场前发现这些问题。
退出规划:进场流动性可能不同于退出流动性。如果 LP 已解锁且由一个钱包持有,它随时都可能被撤走。

Key Concepts

核心概念

Total Value Locked (TVL)

总价值锁定(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.
池中存入资产的总价值。对于一个包含 100 SOL 和 1M TOKEN(TOKEN 单价为 0.01 美元)的 SOL/TOKEN 池,TVL = 100 * SOL_price + 1M * $0.01。仅看 TVL 并不足够——还需要当前价格区间内的深度。

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.
在价格变动 X% 之前可以交易多少。恒定乘积 AMM 的深度是均匀的。在集中流动性(CLMM)中,深度会随价格区间变化——当前价格附近很厚,活跃区间之外则很薄或为零。

Concentration Factor (CLMM)

集中度因子(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.
集中流动性池将资本集中在狭窄的价格区间内,在该区间内提供更深的流动性,但区间之外则没有流动性。一个 TVL 为 5 万美元、集中于 +/-5% 区间的池子,在该区间内可提供与 50 万美元恒定乘积池相同的深度,但在区间之外的深度为零。

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.
滑点并非线性变化。将滑点与交易规模绘制成曲线后,小额交易对应的曲线较平缓,大额交易对应的曲线较陡峭。曲线形状取决于池类型、TVL 和集中度。

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.
流动性提供者是谁很重要。锁定的 LP token 无法被提取(更安全)。单边流动性意味着资金池不平衡。资金池年龄可反映稳定性——创建超过 7 天且 TVL 稳定的池更可靠。

Data Sources

数据源

Four complementary data sources, from free to comprehensive:
SourceAuth RequiredBest ForLimitations
DexScreenerNoneQuick pool lookup, liquidity.usdNo on-chain pool details
Jupiter Quote APINoneEmpirical slippage at any sizeAggregate across pools
BirdeyeAPI keyDetailed pool data, trade historyRate limited on free tier
On-chainRPC onlyLP lock status, exact reservesRequires program knowledge
See
references/data_sources.md
for complete endpoint documentation and usage examples.
四种互补的数据源,覆盖从免费到全面的需求:
数据源是否需要认证最适合限制
DexScreener无快速查询资金池、liquidity.usd不提供链上资金池详情
Jupiter Quote API无估算任意规模下的经验滑点跨资金池聚合
BirdeyeAPI key详细资金池数据、交易历史免费套餐有速率限制
链上数据仅需 RPCLP 锁定状态、精确储备量需要了解相关 program
有关完整的端点文档和使用示例,请参阅
references/data_sources.md
。

Core Analysis Pipeline

核心分析流程

Step 1: Identify Pools

第 1 步:识别资金池

Fetch all pools for a token. Most Solana tokens have multiple pools across Raydium, Orca, and Meteora.
python
import httpx

def get_pools(mint: str) -> list[dict]:
    """Fetch all DEX pools for a token from DexScreener."""
    resp = httpx.get(f"https://api.dexscreener.com/tokens/v1/solana/{mint}")
    resp.raise_for_status()
    pairs = resp.json()
    return [p for p in pairs if p.get("liquidity", {}).get("usd", 0) > 0]
获取代币的所有资金池。大多数 Solana 代币在 Raydium、Orca 和 Meteora 上都有多个资金池。
python
import httpx

def get_pools(mint: str) -> list[dict]:
    """Fetch all DEX pools for a token from DexScreener."""
    resp = httpx.get(f"https://api.dexscreener.com/tokens/v1/solana/{mint}")
    resp.raise_for_status()
    pairs = resp.json()
    return [p for p in pairs if p.get("liquidity", {}).get("usd", 0) > 0]

Step 2: Measure Depth

第 2 步:衡量深度

For each pool, extract liquidity metrics:
python
def extract_depth(pool: dict) -> dict:
    """Extract liquidity metrics from a DexScreener pool."""
    return {
        "dex": pool.get("dexId", "unknown"),
        "liquidity_usd": pool.get("liquidity", {}).get("usd", 0),
        "volume_24h": pool.get("volume", {}).get("h24", 0),
        "pool_age_hours": _pool_age_hours(pool.get("pairCreatedAt", 0)),
        "pair_address": pool.get("pairAddress", ""),
    }
从每个资金池提取流动性指标:
python
def extract_depth(pool: dict) -> dict:
    """Extract liquidity metrics from a DexScreener pool."""
    return {
        "dex": pool.get("dexId", "unknown"),
        "liquidity_usd": pool.get("liquidity", {}).get("usd", 0),
        "volume_24h": pool.get("volume", {}).get("h24", 0),
        "pool_age_hours": _pool_age_hours(pool.get("pairCreatedAt", 0)),
        "pair_address": pool.get("pairAddress", ""),
    }

Step 3: Estimate Slippage

第 3 步:估算滑点

Use Jupiter quotes at multiple sizes to build an empirical slippage curve. This captures real routing across all pools:
python
import httpx

SOL_MINT = "So11111111111111111111111111111111111111112"
LAMPORTS = 1_000_000_000

async def estimate_slippage(token_mint: str, sol_amounts: list[float]) -> list[dict]:
    """Query Jupiter for slippage at multiple trade sizes.

    Args:
        token_mint: Token mint address to buy.
        sol_amounts: List of SOL amounts to test (e.g., [0.1, 0.5, 1, 5, 10]).

    Returns:
        List of dicts with sol_amount, output_tokens, price_per_token, slippage_bps.
    """
    results = []
    base_price = None
    async with httpx.AsyncClient() as client:
        for sol in sol_amounts:
            lamports = int(sol * LAMPORTS)
            resp = await client.get(
                "https://api.jup.ag/quote/v1",
                params={
                    "inputMint": SOL_MINT,
                    "outputMint": token_mint,
                    "amount": str(lamports),
                    "slippageBps": 5000,
                },
            )
            if resp.status_code != 200:
                continue
            data = resp.json()
            out_amount = int(data["outAmount"])
            price = sol / out_amount if out_amount > 0 else 0
            if base_price is None:
                base_price = price
            slippage_bps = int((price - base_price) / base_price * 10000) if base_price > 0 else 0
            results.append({
                "sol_amount": sol,
                "output_tokens": out_amount,
                "price_per_token": price,
                "slippage_bps": max(0, slippage_bps),
            })
    return results
使用多个交易规模的 Jupiter 报价构建经验滑点曲线。这能反映跨所有资金池的真实路由:
python
import httpx

SOL_MINT = "So11111111111111111111111111111111111111112"
LAMPORTS = 1_000_000_000

async def estimate_slippage(token_mint: str, sol_amounts: list[float]) -> list[dict]:
    """Query Jupiter for slippage at multiple trade sizes.

    Args:
        token_mint: Token mint address to buy.
        sol_amounts: List of SOL amounts to test (e.g., [0.1, 0.5, 1, 5, 10]).

    Returns:
        List of dicts with sol_amount, output_tokens, price_per_token, slippage_bps.
    """
    results = []
    base_price = None
    async with httpx.AsyncClient() as client:
        for sol in sol_amounts:
            lamports = int(sol * LAMPORTS)
            resp = await client.get(
                "https://api.jup.ag/quote/v1",
                params={
                    "inputMint": SOL_MINT,
                    "outputMint": token_mint,
                    "amount": str(lamports),
                    "slippageBps": 5000,
                },
            )
            if resp.status_code != 200:
                continue
            data = resp.json()
            out_amount = int(data["outAmount"])
            price = sol / out_amount if out_amount > 0 else 0
            if base_price is None:
                base_price = price
            slippage_bps = int((price - base_price) / base_price * 10000) if base_price > 0 else 0
            results.append({
                "sol_amount": sol,
                "output_tokens": out_amount,
                "price_per_token": price,
                "slippage_bps": max(0, slippage_bps),
            })
    return results

Step 4: Assess Concentration

第 4 步:评估集中度

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:
python
def assess_concentration(pools: list[dict]) -> dict:
    """Assess concentration risk from pool data."""
    clmm_pools = [p for p in pools if p.get("dexId") in ("raydium", "orca") and "clmm" in p.get("labels", [])]
    cpmm_pools = [p for p in pools if p not in clmm_pools]

    total_clmm = sum(p.get("liquidity", {}).get("usd", 0) for p in clmm_pools)
    total_cpmm = sum(p.get("liquidity", {}).get("usd", 0) for p in cpmm_pools)
    total = total_clmm + total_cpmm

    return {
        "clmm_ratio": total_clmm / total if total > 0 else 0,
        "cpmm_liquidity": total_cpmm,
        "clmm_liquidity": total_clmm,
        "concentration_risk": "high" if total_clmm / total > 0.8 and total > 0 else "low",
    }
对于 CLMM 池(Orca Whirlpool、Raydium CLMM、Meteora DLMM),流动性可能集中在狭窄区间内。检查当前价格是否位于活跃区间内,以及流动性深度延伸到哪里:
python
def assess_concentration(pools: list[dict]) -> dict:
    """Assess concentration risk from pool data."""
    clmm_pools = [p for p in pools if p.get("dexId") in ("raydium", "orca") and "clmm" in p.get("labels", [])]
    cpmm_pools = [p for p in pools if p not in clmm_pools]

    total_clmm = sum(p.get("liquidity", {}).get("usd", 0) for p in clmm_pools)
    total_cpmm = sum(p.get("liquidity", {}).get("usd", 0) for p in cpmm_pools)
    total = total_clmm + total_cpmm

    return {
        "clmm_ratio": total_clmm / total if total > 0 else 0,
        "cpmm_liquidity": total_cpmm,
        "clmm_liquidity": total_clmm,
        "concentration_risk": "high" if total_clmm / total > 0.8 and total > 0 else "low",
    }

Step 5: Compute Liquidity Score

第 5 步:计算流动性评分

Composite score from 0 (dangerous) to 100 (deep, safe liquidity):
python
def compute_liquidity_score(
    total_liquidity_usd: float,
    pool_count: int,
    largest_pool_pct: float,
    oldest_pool_hours: float,
    max_slippage_bps_at_1sol: int,
) -> int:
    """Compute composite liquidity score (0-100).

    Components:
        Depth (40%): log-scaled TVL from $1K (0) to $1M+ (40)
        Diversity (15%): more pools = more resilient
        Concentration (15%): penalty if one pool dominates
        Age (15%): older pools are more reliable
        Slippage (15%): lower slippage = better
    """
    import math
    # Depth: 0-40 points
    depth = min(40, int(40 * math.log10(max(total_liquidity_usd, 1)) / 6))

    # Diversity: 0-15 points
    diversity = min(15, pool_count * 3)

    # Concentration: 0-15 points (penalty for single-pool dominance)
    concentration = int(15 * (1 - largest_pool_pct))

    # Age: 0-15 points (7+ days = full marks)
    age = min(15, int(15 * oldest_pool_hours / 168))

    # Slippage: 0-15 points
    slippage = max(0, 15 - max_slippage_bps_at_1sol // 10)

    return max(0, min(100, depth + diversity + concentration + age + slippage))
综合评分从 0(危险)到 100(深度充足且安全的流动性):
python
def compute_liquidity_score(
    total_liquidity_usd: float,
    pool_count: int,
    largest_pool_pct: float,
    oldest_pool_hours: float,
    max_slippage_bps_at_1sol: int,
) -> int:
    """Compute composite liquidity score (0-100).

    Components:
        Depth (40%): log-scaled TVL from $1K (0) to $1M+ (40)
        Diversity (15%): more pools = more resilient
        Concentration (15%): penalty if one pool dominates
        Age (15%): older pools are more reliable
        Slippage (15%): lower slippage = better
    """
    import math
    # Depth: 0-40 points
    depth = min(40, int(40 * math.log10(max(total_liquidity_usd, 1)) / 6))

    # Diversity: 0-15 points
    diversity = min(15, pool_count * 3)

    # Concentration: 0-15 points (penalty for single-pool dominance)
    concentration = int(15 * (1 - largest_pool_pct))

    # Age: 0-15 points (7+ days = full marks)
    age = min(15, int(15 * oldest_pool_hours / 168))

    # Slippage: 0-15 points
    slippage = max(0, 15 - max_slippage_bps_at_1sol // 10)

    return max(0, min(100, depth + diversity + concentration + age + slippage))

Risk Flags

风险标记

Flag these conditions before entering any position:
FlagConditionRisk Level
Single PoolOnly 1 DEX pool existsHigh
Thin LiquidityTotal TVL < $10,000Critical
New PoolPool created < 2 hours agoHigh
Unlocked LPLP tokens not burned/lockedMedium
Volume MismatchVolume >> TVL (wash trading)Medium
Price Deviation>5% price difference across poolsHigh
Concentrated CLMM>80% liquidity in CLMM with narrow rangeMedium
python
def detect_risk_flags(pools: list[dict]) -> list[str]:
    """Detect liquidity risk flags from pool data."""
    flags = []
    if len(pools) < 2:
        flags.append("SINGLE_POOL: Only 1 pool exists — exit may be difficult")

    total_liq = sum(p.get("liquidity", {}).get("usd", 0) for p in pools)
    if total_liq < 10_000:
        flags.append(f"THIN_LIQUIDITY: Total TVL ${total_liq:,.0f} < $10,000")

    for p in pools:
        age_ms = p.get("pairCreatedAt", 0)
        if age_ms > 0:
            import time
            age_hours = (time.time() * 1000 - age_ms) / 3_600_000
            if age_hours < 2:
                flags.append(f"NEW_POOL: {p.get('dexId')} pool is {age_hours:.1f}h old")

    volumes = [p.get("volume", {}).get("h24", 0) for p in pools]
    liqs = [p.get("liquidity", {}).get("usd", 0) for p in pools]
    for v, l, p in zip(volumes, liqs, pools):
        if l > 0 and v / l > 10:
            flags.append(f"VOLUME_MISMATCH: {p.get('dexId')} volume/TVL = {v/l:.1f}x")

    prices = [float(p.get("priceUsd", 0)) for p in pools if float(p.get("priceUsd", 0)) > 0]
    if len(prices) >= 2:
        deviation = (max(prices) - min(prices)) / min(prices)
        if deviation > 0.05:
            flags.append(f"PRICE_DEVIATION: {deviation:.1%} across pools")

    return flags
在任何仓位进场前,标记以下情况:
风险标记条件风险等级
单一资金池仅存在 1 个 DEX 资金池高
流动性薄弱总 TVL < $10,000严重
新资金池创建时间不足 2 小时高
未锁定的 LPLP token 未销毁/锁定中
交易量不匹配交易量 >> TVL(刷量交易)中
价格偏差各资金池之间价格差异 >5%高
集中式 CLMM>80% 流动性位于 CLMM 且区间狭窄中
python
def detect_risk_flags(pools: list[dict]) -> list[str]:
    """Detect liquidity risk flags from pool data."""
    flags = []
    if len(pools) < 2:
        flags.append("SINGLE_POOL: Only 1 pool exists — exit may be difficult")

    total_liq = sum(p.get("liquidity", {}).get("usd", 0) for p in pools)
    if total_liq < 10_000:
        flags.append(f"THIN_LIQUIDITY: Total TVL ${total_liq:,.0f} < $10,000")

    for p in pools:
        age_ms = p.get("pairCreatedAt", 0)
        if age_ms > 0:
            import time
            age_hours = (time.time() * 1000 - age_ms) / 3_600_000
            if age_hours < 2:
                flags.append(f"NEW_POOL: {p.get('dexId')} pool is {age_hours:.1f}h old")

    volumes = [p.get("volume", {}).get("h24", 0) for p in pools]
    liqs = [p.get("liquidity", {}).get("usd", 0) for p in pools]
    for v, l, p in zip(volumes, liqs, pools):
        if l > 0 and v / l > 10:
            flags.append(f"VOLUME_MISMATCH: {p.get('dexId')} volume/TVL = {v/l:.1f}x")

    prices = [float(p.get("priceUsd", 0)) for p in pools if float(p.get("priceUsd", 0)) > 0]
    if len(prices) >= 2:
        deviation = (max(prices) - min(prices)) / min(prices)
        if deviation > 0.05:
            flags.append(f"PRICE_DEVIATION: {deviation:.1%} across pools")

    return flags

Position Sizing from Liquidity

基于流动性的仓位管理

Maximum position size should keep slippage under your threshold:
Trade TypeMax SlippageMax Position % of TVL
Scalp0.5% (50 bps)1%
Swing2% (200 bps)2-5%
Position5% (500 bps)5-10%
python
def max_position_from_liquidity(
    total_liquidity_usd: float,
    max_slippage_pct: float = 1.0,
    trade_type: str = "swing",
) -> float:
    """Estimate maximum position size in USD based on liquidity.

    Uses rule-of-thumb: max_position = tvl_fraction * total_liquidity.
    For constant-product AMM, 1% of TVL produces ~2% slippage.

    Args:
        total_liquidity_usd: Total liquidity across all pools.
        max_slippage_pct: Maximum acceptable slippage percentage.
        trade_type: "scalp", "swing", or "position".

    Returns:
        Maximum position size in USD.
    """
    fractions = {"scalp": 0.01, "swing": 0.03, "position": 0.07}
    base_fraction = fractions.get(trade_type, 0.03)
    adjusted = base_fraction * (max_slippage_pct / 2.0)
    return total_liquidity_usd * adjusted
最大仓位规模应确保滑点低于你的阈值:
交易类型最大滑点最大仓位占 TVL 比例
超短线(Scalp)0.5%(50 bps)1%
波段(Swing)2%(200 bps)2-5%
持仓(Position)5%(500 bps)5-10%
python
def max_position_from_liquidity(
    total_liquidity_usd: float,
    max_slippage_pct: float = 1.0,
    trade_type: str = "swing",
) -> float:
    """Estimate maximum position size in USD based on liquidity.

    Uses rule-of-thumb: max_position = tvl_fraction * total_liquidity.
    For constant-product AMM, 1% of TVL produces ~2% slippage.

    Args:
        total_liquidity_usd: Total liquidity across all pools.
        max_slippage_pct: Maximum acceptable slippage percentage.
        trade_type: "scalp", "swing", or "position".

    Returns:
        Maximum position size in USD.
    """
    fractions = {"scalp": 0.01, "swing": 0.03, "position": 0.07}
    base_fraction = fractions.get(trade_type, 0.03)
    adjusted = base_fraction * (max_slippage_pct / 2.0)
    return total_liquidity_usd * adjusted

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:
slippage = Δx / (x + Δx)
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%.
如需了解包括恒定乘积公式、CLMM 模型和经验曲线拟合在内的详细滑点数学原理,请参阅
references/slippage_curves.md
。
恒定乘积 AMM 的关键公式:
slippage = Δx / (x + Δx)
其中
Δx
是交易规模,
x
是输入代币的池内储备量。对于在 100 SOL 储备量的池中进行 1 SOL 交易,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
Solana DEX 采用不同的 AMM 设计,流动性特征各不相同。有关全面介绍,请参阅
references/pool_types.md
,内容包括:
  • 恒定乘积(Constant Product)(Raydium V4、Orca Legacy):流动性均匀,滑点可预测
  • 集中流动性(Concentrated Liquidity)(Raydium CLMM、Orca Whirlpool):当前价格附近深度高,区间外为零
  • 动态 AMM(Dynamic AMM)(Meteora DLMM):自适应费用,基于 bin 的流动性

Integration with Other Skills

与其他 skill 的集成

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.
token-holder-analysis:进场前检查 LP token 持有者分布。如果某个钱包持有超过 50% 的 LP token 且已解锁,则退出风险较高。
position-sizing:将
max_position_from_liquidity()
的输出传入仓位规模模型,作为上限。
slippage-modeling:将该 skill 的经验滑点曲线作为执行成本模型的输入。
birdeye-api:获取包括交易历史和 LP 事件在内的详细资金池数据。
dexscreener-api:免费发现资金池并获取基础流动性指标。

Example Workflow

示例工作流

python
undefined
python
undefined

Full liquidity assessment for a token

Full liquidity assessment for a token

import httpx
TOKEN = "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263" # BONK
import httpx
TOKEN = "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263" # BONK

1. Get pools

1. Get pools

resp = httpx.get(f"https://api.dexscreener.com/tokens/v1/solana/{TOKEN}") pools = [p for p in resp.json() if p.get("liquidity", {}).get("usd", 0) > 0]
resp = httpx.get(f"https://api.dexscreener.com/tokens/v1/solana/{TOKEN}") pools = [p for p in resp.json() if p.get("liquidity", {}).get("usd", 0) > 0]

2. Analyze

2. Analyze

total_liq = sum(p["liquidity"]["usd"] for p in pools) largest = max(p["liquidity"]["usd"] for p in pools) largest_pct = largest / total_liq if total_liq > 0 else 1.0
total_liq = sum(p["liquidity"]["usd"] for p in pools) largest = max(p["liquidity"]["usd"] for p in pools) largest_pct = largest / total_liq if total_liq > 0 else 1.0

3. Risk flags

3. Risk flags

flags = detect_risk_flags(pools)
flags = detect_risk_flags(pools)

4. Score

4. Score

score = compute_liquidity_score(total_liq, len(pools), largest_pct, 1000, 50)
score = compute_liquidity_score(total_liq, len(pools), largest_pct, 1000, 50)

5. Position sizing

5. Position sizing

max_pos = max_position_from_liquidity(total_liq, max_slippage_pct=1.0, trade_type="swing")
print(f"Total Liquidity: ${total_liq:,.0f}") print(f"Pools: {len(pools)}") print(f"Score: {score}/100") print(f"Max Position (swing, 1% slip): ${max_pos:,.0f}") for f in flags: print(f" WARNING: {f}")
undefined
max_pos = max_position_from_liquidity(total_liq, max_slippage_pct=1.0, trade_type="swing")
print(f"Total Liquidity: ${total_liq:,.0f}") print(f"Pools: {len(pools)}") print(f"Score: {score}/100") print(f"Max Position (swing, 1% slip): ${max_pos:,.0f}") for f in flags: print(f" WARNING: {f}")
undefined

Files

文件

FileDescription
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
文件描述
references/slippage_curves.md
恒定乘积和 CLMM 池的滑点数学原理、经验曲线拟合
references/pool_types.md
Solana 上的 AMM 设计:恒定乘积、集中流动性、动态 AMM
references/data_sources.md
用于获取流动性数据的 API 端点和链上方法
scripts/analyze_liquidity.py
包含评分和风险标记的完整流动性评估
scripts/pool_comparison.py
比较某代币在各 DEX 上的资金池