impermanent-loss

impermanent-loss is a skill for Claude Code from agiprolabs/claude-trading-skills. It costs 24 tokens per session (1,997 once invoked), scanned A, original, MIT.

A calculator and modeling guide for impermanent loss, the difference between providing tokens to an automated market maker and simply holding them. An automated market maker is a trading pool that adjusts its token balances as prices change.

In plain words
What is it for?
Use it to calculate impermanent loss, model price-ratio changes across pool types, and analyze breakeven points for liquidity provision.
Why use it?
It helps estimate how price changes can reduce the value of a liquidity position compared with holding the same tokens. It can also identify when fees or other returns would need to offset that difference.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

Part of the trading-skills plugin — 68 skills shipped together

Good fit Use it to calculate impermanent loss, model price-ratio changes across pool types, and analyze breakeven points for liquidity provision.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/agiprolabs/claude-trading-skills/impermanent-loss
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.

Any agent
npx skills add agiprolabs/claude-trading-skills --skill impermanent-loss
Clone the repo
git clone --depth 1 https://github.com/agiprolabs/claude-trading-skills

Made for: Claude Code.

Or install trading-skills, the plugin that ships this one along with the rest of its 68 skills.

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 impermanent-loss

README.md
[![agentmods](https://agentmods.dev/badge/skills/agiprolabs/claude-trading-skills/impermanent-loss/github.svg)](https://agentmods.dev/skills/agiprolabs/claude-trading-skills/impermanent-loss)
Your own site
<a href="https://agentmods.dev/skills/agiprolabs/claude-trading-skills/impermanent-loss"><img src="https://agentmods.dev/badge/skills/agiprolabs/claude-trading-skills/impermanent-loss/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 impermanent-loss

Your own site · 80×15
<a href="https://agentmods.dev/skills/agiprolabs/claude-trading-skills/impermanent-loss"><img src="https://agentmods.dev/badge/skills/agiprolabs/claude-trading-skills/impermanent-loss.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 24 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,997 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00024 $0.01997
Opus 5 $0.00012 $0.00999
Sonnet 5 $0.00005 $0.00399
Haiku 4.5 $0.00002 $0.00200

Measured 13d ago against content hash 140149abdc5d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

impermanent-loss 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 13d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/il_calculator.py, scripts/il_scenario_modeler.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/impermanent-loss/SKILL.md · 196 lines

How it starts

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

Impermanent Loss — Calculation, Modeling & Breakeven Analysis

Impermanent loss (IL) is the cost of providing liquidity to an automated market maker (AMM) relative to simply holding the tokens. When you deposit tokens into a liquidity pool, the AMM continuously rebalances your position as prices move. This rebalancing always works against you — selling winners and buying losers — resulting in less value than if you had just held the original tokens.

Why "Impermanent"?

IL is called "impermanent" because it only crystallizes when you withdraw. If prices return to their original ratio, IL reverts to zero. However, in practice, prices rarely return exactly, so IL is usually quite real.

Key Insight

IL is a function of the price ratio change, not the absolute price. A token moving from $1 to $2 produces the same IL as a token moving from $100 to $200 — both are a 2x ratio change. Direction does not matter either: a 2x increase and a 0.5x decrease produce the same IL magnitude.

Constant-Product IL Formula

For a standard x * y = k AMM (Raydium standard, Orca legacy):

IL = 2 * sqrt(r) / (1 + r) - 1

Where r = P_new / P_initial (the price ratio).

IL at Key Price Ratios

Price Change Ratio (r) IL
-75% 0.25 -5.72%
-50% 0.50 -5.72%
-25% 0.75 -0.60%
0% 1.00 0.00%
+25% 1.25 -0.60%
+50% 1.50 -2.02%
+100% (2x) 2.00 -5.72%
+200% (3x) 3.00 -13.40%
+400% (5x) 5.00 -25.46%
+900% (10x) 10.00 -42.54%

Note the symmetry: a 2x increase (r=2.0) and a 2x decrease (r=0.5) both produce -5.72% IL.

Concentrated Liquidity (CLMM) Amplified IL

Concentrated liquidity market makers (Orca Whirlpools, Raydium CLMM, Meteora DLMM) allow LPs to concentrate liquidity within a price range [P_lower, P_upper]. This amplifies both fee income and IL.

Read the full file on GitHub · 196 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 13d ago First seen · 196 lines · 24 tokens per session scan A 140149abdc5d

Subscribe to this mod's changes

impermanent-loss is a skill published in the GitHub repository agiprolabs/claude-trading-skills (356 stars, last pushed 9d ago), licensed MIT. It adds 24 tokens to every session and 1,997 once invoked, about $0.0001 per session on Opus 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-30.