clmm-backtest

clmm-backtest is a command for Claude Code from solanabr/position-manager-skill. It costs 21 tokens per session (956 once invoked), scanned A, original, MIT.

A backtest for a concentrated-liquidity market-maker (CLMM) position, using historical prices and trading volume to assess a chosen price range. It compares the result with simply holding the tokens (HODL) and estimates the fee return needed to break even.

In plain words
What is it for?
Use it to test a token pair, price range, deposit amount, fee tier, and historical data, then compare estimated profit or loss with HODL and find the required fee APR.
Why use it?
It helps show how a liquidity range might have performed before committing funds, including the effect of price movements and trading fees.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

Good fit Use it to test a token pair, price range, deposit amount, fee tier, and historical data, then compare estimated profit or loss with HODL and find the required fee APR.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/solanabr/position-manager-skill/clmm-backtest
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/solanabr/position-manager-skill

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for clmm-backtest

README.md
[![agentmods](https://agentmods.dev/badge/commands/solanabr/position-manager-skill/clmm-backtest/github.svg)](https://agentmods.dev/commands/solanabr/position-manager-skill/clmm-backtest)
Your own site
<a href="https://agentmods.dev/commands/solanabr/position-manager-skill/clmm-backtest"><img src="https://agentmods.dev/badge/commands/solanabr/position-manager-skill/clmm-backtest/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for clmm-backtest

Your own site · 80×15
<a href="https://agentmods.dev/commands/solanabr/position-manager-skill/clmm-backtest"><img src="https://agentmods.dev/badge/commands/solanabr/position-manager-skill/clmm-backtest.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 956 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00021 $0.00956
Opus 5.5 $0.00008 $0.00382
Sonnet 5.5 $0.00004 $0.00191
Haiku 4.5 $0.00002 $0.00096

Measured 3mo ago against content hash 6574b84f7ead, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

clmm-backtest scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/clmm-backtest.md · 92 lines

How it starts

The opening of the file, as written. The whole thing — 92 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/clmm-backtest

Backtests a concentrated liquidity range against historical price data, computing net P&L vs HODL and break-even fee-APR requirements.

Steps

  1. Prepare inputs - you need: token pair, tick range, optional historical fee data. Set environment:

    export OWNER_ADDRESS="YourWallet111..."  # optional, for real position ticks
    
  2. Run the backtest script (backtestRange is pure compute; you supply a price/volume series in quote-per-base terms):

    npx tsx -e "
    import { backtestRange } from './skill/templates/il-backtest';
    
    // series: { t: unixSeconds, price: quotePerBase, volume: inQuote }[]
    const series = [
      { t: 1_717_200_000, price: 150, volume: 0 },
      { t: 1_717_286_400, price: 158, volume: 2_000_000 },
      { t: 1_717_372_800, price: 162, volume: 1_800_000 },
    ];
    
    const result = backtestRange({
      series,
      pLow: 140,            // range lower price (quote per base)
      pHigh: 170,           // range upper price
      depositValue: 10000,  // initial value in quote (token B) units
      feeBps: 30,           // pool fee tier in basis points (0.30%)
      // Optional: this position's share of active in-range liquidity (0..1, default 1)
      // activeShare: 0.05,
    });
    
    console.log(JSON.stringify(result, null, 2));
    "
    
  3. Interpret the output (BacktestResult):

    {
      "lpValue": 10180.2,
      "hodlValue": 10240.0,
      "feesEarned": 11.4,
      "ilFraction": -0.0058,
      "netVsHodl": -59.8,
      "feeApr": 0.21,
      "inRangeFraction": 1.0,
      "breakEvenWidth": 0.184
    }
    
    • ilFraction: LP principal vs HODL as a fraction (negative = underperforms HODL)
    • feesEarned / feeApr: fees in quote units, annualized over the series duration
    • netVsHodl: lpValue - hodlValue in quote units (fees included)
    • breakEvenWidth: symmetric half-width w (fraction of p0) where net P&L vs HODL crosses zero on this series; NaN if it never breaks even in the search bounds

Read the full file on GitHub · 92 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 92 lines · 21 tokens per session scan A 6574b84f7ead

Subscribe to this mod's changes

clmm-backtest is a command published in the GitHub repository solanabr/position-manager-skill (2 stars, last pushed 4mo ago), licensed MIT. It adds 21 tokens to every session and 956 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

clmm-backtest compared with commands from other repositories

clmm-backtest next to 6 commands from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
clmm-backtestsolanabr/position-manager-skillCommand24mo agoMITA21Claude Code
hyperliquid-riskaegntic/cldcdeCommand123d agoMITA32Claude Code
global-flagshiromaily/go-crypto-walletCommand1297mo agoMITA0Claude Code
checklistgithub/spec-kitCommand153k3d agoMITA13Claude Code
clarifygithub/spec-kitCommand153k3d agoMITA27Claude Code
analyzegithub/spec-kitCommand153k3d agoMITA26Claude Code
specifygithub/spec-kitCommand153k3d agoMITA13Claude Code