{"uid":"cap_io5PjDNc1i7ajxpHA30n0","slug":"investing-math-dca-vs-lump-sum-comparator-65ac958b","name":"Investing Math: DCA vs Lump Sum Comparator","description":"Compare equal periodic buys (dollar-cost averaging) with one lump sum on the first date, over a list of prices.","url":"https://invest-math.x402tookit.com/dca-vs-lump?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["prices","perBuy"],"properties":{"perBuy":{"type":"number","description":"Amount invested at each date"},"prices":{"type":"string","description":"Price at each buy date, comma separated, 2 to 600 values"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"dca":{"type":["null","object"],"properties":{"units":{"type":["null","number"]},"returnPct":{"type":["null","number"]},"finalValue":{"type":["null","number"]},"averageCost":{"type":["null","number"]}}},"asOf":{"type":["null","string"]},"buys":{"type":["null","number"]},"source":{"type":["null","string"]},"winner":{"type":["null","string"]},"lumpSum":{"type":["null","object"],"properties":{"cost":{"type":["null","number"]},"units":{"type":["null","number"]},"returnPct":{"type":["null","number"]},"finalValue":{"type":["null","number"]}}},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"disclaimer":{"type":["null","string"]},"finalPrice":{"type":["null","number"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"totalInvested":{"type":["null","number"]},"priceChangePct":{"type":["null","number"]}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","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.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_Ag9X8N1VCH99ZTNaK_lBr","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Compares dollar-cost averaging (equal periodic buys) against a single lump-sum investment on the first date, given a series of prices, returning returns, units acquired, and a verdict on which strategy won.","exampleAgentPrompt":"Compare dollar-cost averaging $500 per period versus investing the full amount as a lump sum at the start, using these prices: 100,105,98,110,115,108,120,125,118,130.","exampleUseCases":[{"title":"Evaluating DCA on a volatile stock","prompt":"I bought $200 worth of a stock every month for 10 months. The prices were 50,48,55,45,60,58,65,70,62,75. Would I have done better just buying everything at the start instead of spreading it out?"},{"title":"Crypto periodic investment analysis","prompt":"Compare investing $1000 per week in Bitcoin versus putting in the whole $10,000 at the beginning, using these weekly prices: 30000,28000,32000,25000,35000,38000,34000,40000,42000,45000."},{"title":"Backtesting index fund DCA strategy","prompt":"I'm curious whether DCA or lump sum would have performed better with $500 per period on these S&P 500 prices: 4000,4100,3950,4200,4300,4250,4400,4500,4450,4600. Which strategy came out ahead and by how much?"}],"resultDescription":"Returns a structured comparison including: DCA stats (units acquired, average cost, final value, return %), lump sum stats (cost, units, final value, return %), total amount invested, final asset price, price change %, a winner field indicating which strategy outperformed, a human-readable summary and verdict, supporting reasons, and optional disclaimers or degraded-mode flags.","failureModes":["Fewer than 2 or more than 600 prices provided — validation error","Non-numeric values in the prices string — parse error","Missing required perBuy or prices parameters — 400 bad request","Payment failure or missing x402 payment header — 402 payment required","Extremely large or zero perBuy values may produce edge-case results"],"whenToPreferThis":"Use this endpoint when you need a fast, deterministic head-to-head comparison of periodic DCA investing versus a single lump-sum purchase over a known price series. It is ideal for backtesting investment timing strategies, validating personal finance decisions, or explaining to a user which approach would have yielded better returns given historical prices. Prefer this over building your own simulation when you want a ready-made verdict, reasons, and summary narrative alongside the raw numbers.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-30T00:35:07.945Z","isFirstParty":false,"canonicalSlug":"investing-math-dca-vs-lump-sum-comparator-65ac958b"}