impermanentlosscalc: Calculate Impermanent Loss in Automated Market Maker (AMM) Liquidity Pools

Computes the key metrics for assessing the performance of a liquidity provider (LP) position in a weighted multi-asset Automated Market Maker (AMM) pool. Calculates the nominal and percentage impermanent loss (IL) by comparing the portfolio value inside the pool (based on the weighted geometric mean of price ratios) against the value of simply holding the assets outside the pool (based on the weighted arithmetic mean). The primary function, `impermanent_loss()`, incorporates the effect of earned trading fees to provide the LP's net profit and loss relative to a holding strategy, using a methodology derived from Tiruviluamala, N., Port, A., and Lewis, E. (2022) <doi:10.48550/arXiv.2203.11352>.

Package details

AuthorAmber Krause [aut, cre] (ORCID: <https://orcid.org/0000-0002-7493-3909>)
MaintainerAmber Krause <amber32k@gmail.com>
LicenseGPL-3
Version0.1.0
Package repositoryView on CRAN
Installation Install the latest version of this package by entering the following in R:
install.packages("impermanentlosscalc")

Try the impermanentlosscalc package in your browser

Any scripts or data that you put into this service are public.

impermanentlosscalc documentation built on Dec. 11, 2025, 5:08 p.m.