{"uid":"cap_6-jKvdaJfftg6kIa-jsBo","slug":"finmath-dca-backtest-bd3a31a6","name":"finmath DCA Backtest","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/dca_backtest","method":"POST","headers":{},"bodySchema":{"type":"object","required":["prices","contribution"],"properties":{"prices":{"type":"array","description":"prices"},"contribution":{"type":"number","description":"contribution"}}},"responseSchema":{"type":"object","required":["result","meta"],"properties":{"meta":{"type":"object"},"result":{}}},"example":{"request":{"prices":[100,102,98,105,103,107,104,106],"contribution":500},"response":{"meta":{"tool":"dca_backtest","disclaimer":"Deterministic calculation utility. Not financial, investment, or trading advice.","deterministic":true},"result":{"roi":0.028672917161252826,"avg_cost":103.045388122514,"final_value":4114.691668645011,"total_units":38.817845930613316,"total_invested":4000}}},"exampleRequest":{"prices":[100,102,98,105,103,107,104,106],"contribution":500},"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_qiWBeb8TgLclpoisM3kXh","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":"Backtests a dollar-cost averaging (DCA) strategy against a historical price series, computing exact portfolio metrics using deterministic arithmetic","exampleAgentPrompt":"Run a DCA backtest for me — here are the weekly closing prices for ETH over the past year: [1800, 1750, 1900, 2100, 1950, 2200, 2400, 2300, 2500, 2450, 2600, 2700, 2650, 2800, 2750, 2900, 3000, 2950, 3100, 3050, 3200, 3150, 3300, 3250, 3400, 3350, 3500, 3450, 3600, 3550, 3700, 3650, 3800, 3750, 3900, 3850, 4000, 3950, 4100, 4050, 4200, 4150, 4300, 4250, 4400, 4350, 4500, 4450, 4600, 4550, 4700] — and assume I put in $200 each period.","exampleUseCases":null,"resultDescription":"Returns a result object with DCA portfolio metrics computed from the price series and fixed contribution, including total invested, total portfolio value, number of units accumulated, average cost basis, total return, and possibly period-by-period breakdown; plus a meta object with request metadata.","failureModes":["Missing required 'prices' array — returns 400 error","Missing required 'contribution' amount — returns 400 error","Empty prices array — may return zero or error","Non-numeric values in prices array — validation error","Payment not provided or insufficient USDC — 402 Payment Required","Contribution value of zero or negative — may return error or degenerate result"],"whenToPreferThis":"Use this endpoint when you need exact, deterministic DCA backtest calculations rather than relying on LLM arithmetic, which is error-prone for iterative financial computations. Prefer this over manual calculation when you have a historical price series and want precise average cost basis, total return, and unit accumulation figures for a fixed periodic contribution strategy.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T18:47:43.966Z","isFirstParty":false}