{"uid":"cap_hRxQEtOBwmjGoovDJvaS0","slug":"finmath-financial-defi-math-engine-a5d4d00c","name":"finmath – Financial & DeFi Math Engine","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/base64","method":"POST","headers":{},"bodySchema":{"type":"object","required":["input"],"properties":{"mode":{"type":"string","description":"mode"},"input":{"type":"string","description":"input"}}},"responseSchema":{"type":"object","required":["result","meta"],"properties":{"meta":{"type":"object"},"result":{}}},"example":{"request":{"mode":"npv","input":"eyJkaXNjb3VudF9yYXRlIjogMC4xLCAiY2FzaF9mbG93cyI6IFstMTAwMDAsIDMwMDAsIDMwMDAsIDMwMDAsIDMwMDBdLCAicGVyaW9kcyI6IFswLCAxLCAyLCAzLCA0XX0="},"response":{"meta":{"tool":"base64","disclaimer":"Deterministic calculation utility. Not financial, investment, or trading advice.","deterministic":true},"result":{"result":"{\"discount_rate\": 0.1, \"cash_flows\": [-10000, 3000, 3000, 3000, 3000], \"periods\": [0, 1, 2, 3, 4]}"}}},"exampleRequest":{"mode":"npv","input":"eyJkaXNjb3VudF9yYXRlIjogMC4xLCAiY2FzaF9mbG93cyI6IFstMTAwMDAsIDMwMDAsIDMwMDAsIDMwMDAsIDMwMDBdLCAicGVyaW9kcyI6IFswLCAxLCAyLCAzLCA0XX0="},"tags":["x402"],"displayCostAmount":"0.001","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.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_gMNLDKqAJLuLjaFDBcXO9","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes deterministic financial and DeFi calculations (NPV, IRR, Black-Scholes, impermanent loss, Uniswap v3, VaR, health factor, etc.) with base64-encoded input, billed per call in USDC","exampleAgentPrompt":"Can you calculate the Black-Scholes price and delta for a call option with spot price $150, strike $160, 30-day expiry, 20% implied volatility, and 5% risk-free rate?","exampleUseCases":[{"title":"Portfolio value and return analysis","prompt":"I need to know the NPV and IRR for my investment portfolio over the last 3 years. Can you calculate those metrics given my annual cash flows of -$50,000 in year 1, -$75,000 in year 2, and a final value of $180,000?"},{"title":"DeFi liquidity position risk","prompt":"I'm providing liquidity on Uniswap v3 between $1,800 and $2,200 per ETH, currently at $2,000. What's my impermanent loss if the price moves to $2,500, and what's my health factor if I've borrowed 10 USDC against this position?"},{"title":"Leveraged trading liquidation risk","prompt":"I'm long 5 BTC on a perpetual with 10x leverage at an entry price of $45,000. Current funding rate is 0.03% per 8 hours. What's my liquidation price, and how much do I lose to funding costs over the next 30 days?"}],"resultDescription":"Returns a result object containing the computed financial value(s) (e.g. NPV amount, option premium, Greeks, impermanent loss percentage, liquidation price) alongside a meta object with call metadata. The exact shape of result depends on the mode used.","failureModes":["Missing or malformed base64-encoded input returns an error","Invalid or unsupported mode string results in an error response","Mathematically undefined inputs (e.g. negative time to expiry, zero volatility) may return NaN or an error","Payment failure (insufficient USDC balance) blocks the call with a 402 response","Malformed JSON inside the base64 payload causes a parsing error"],"whenToPreferThis":"Choose this endpoint when you need exact, reproducible financial arithmetic that LLMs cannot reliably compute themselves — especially for Black-Scholes pricing, Greeks, IRR/XIRR, bond math, DeFi impermanent loss, Uniswap v3 range math, or perp liquidation levels. Prefer it over asking the LLM directly any time precision matters or the calculation is model-free by definition.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T18:49:14.690Z","isFirstParty":false}