{"uid":"cap_e55t3hUuoJkx4dIwuFns2","slug":"finmath-lp-value-vs-hodl-514d6171","name":"finmath LP Value vs HODL","description":"Deterministic finance and crypto math for AI agents: TradFi (NPV, IRR, XIRR, Black-Scholes + Greeks, bonds, VaR, Sharpe) and DeFi (impermanent loss, perp liquidation, funding, Uniswap v3, health factor, cost basis). Exact, model-free arithmetic that LLMs get wrong — priced per call in USDC.","url":"https://finmath.qzqh5rrbkz.workers.dev/v1/lp_value_vs_hodl","method":"POST","headers":{},"bodySchema":{"type":"object","required":["price_ratio","initial_value"],"properties":{"price_ratio":{"type":"number","description":"price_ratio"},"initial_value":{"type":"number","description":"initial_value"}}},"responseSchema":{"type":"object","required":["result","meta"],"properties":{"meta":{"type":"object"},"result":{}}},"example":{"request":{"price_ratio":1.5,"initial_value":1000},"response":{"meta":{"tool":"lp_value_vs_hodl","model":true,"disclaimer":"Deterministic calculation utility. Not financial, investment, or trading advice.","assumptions":["50/50 constant-product pool","excludes LP fees earned"],"deterministic":true},"result":{"note":"Excludes LP fees earned; fees can offset or exceed IL.","lp_value":1224.744871391589,"difference":-25.25512860841104,"hodl_value":1250,"impermanent_loss_pct":-0.020204102886728803}}},"exampleRequest":{"price_ratio":1.5,"initial_value":1000},"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_epELE7qetJTKgITFtEtzE","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calculates the impermanent loss and LP position value compared to simply holding the tokens, given a price ratio and initial position value.","exampleAgentPrompt":"I put $10,000 into a Uniswap liquidity pool and the price ratio has since moved to 2.5x — can you calculate my current LP value versus what I'd have if I'd just held the tokens, and tell me the impermanent loss?","exampleUseCases":null,"resultDescription":"Returns a result object containing the computed LP position value, the equivalent HODL value, and the impermanent loss in absolute and/or percentage terms, along with a meta object containing call metadata.","failureModes":["Missing required field price_ratio or initial_value returns a validation error","price_ratio of 0 or negative may cause division errors or undefined results","Non-numeric inputs for price_ratio or initial_value return a type error","Payment failure (HTTP 402) if USDC payment is not provided or insufficient"],"whenToPreferThis":"Use this endpoint when you need exact, deterministic arithmetic for impermanent loss and LP vs HODL comparisons — especially when LLM-native math would introduce rounding or hallucination errors. Prefer over manual calculation or LLM estimation when accuracy matters for DeFi portfolio analysis.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T18:56:39.827Z","isFirstParty":false}