{"uid":"cap_9Xy01V4MG2t9DxtLpz_SU","slug":"crypto-backtest-api-4e8d1ebe","name":"Crypto Backtest API","description":"Fee-aware moving-average backtests from caller-supplied OHLC candles. Historical calculations only.","url":"https://crypto-backtest-x402.crypto-auto-investor-x402.workers.dev/v1/backtest?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"feeBps":{"type":"number","description":"Fee per order in basis points, default 10"},"candles":{"type":"array","items":{"type":"object","required":["open","close"],"properties":{"open":{"type":"number","exclusiveMinimum":0},"close":{"type":"number","exclusiveMinimum":0}}},"maxItems":2000,"minItems":30},"fastPeriod":{"type":"integer","description":"Fast SMA window, at least 2"},"slowPeriod":{"type":"integer","description":"Slow SMA window, greater than fastPeriod"},"initialCapital":{"type":"number","description":"Starting cash, default 1000"}}},"responseSchema":{"type":"json","example":{"bars":30,"maxDrawdownPct":0.8,"buyHoldReturnPct":2.1,"strategyReturnPct":1.2}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.1","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.1/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_hieO-3ikDRwY3G3Ojtvp0","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.1","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Runs fee-aware simple moving average (SMA) crossover backtests on caller-supplied OHLC candle data, returning strategy vs buy-hold performance metrics.","exampleAgentPrompt":"Run a moving average crossover backtest on these 200 BTC/USDT daily candles with a fast period of 10, slow period of 50, 10 basis points fee per trade, and starting capital of $5000 — I want to see how the strategy return compares to just holding.","exampleUseCases":[{"title":"SMA parameter tuning for altcoin","prompt":"I have 500 hourly ETH/USDT candles — can you backtest a fast SMA of 8 and slow SMA of 21, with 15 basis points in fees and $2000 starting capital, and tell me the strategy return versus buy-and-hold and the max drawdown?"},{"title":"Fee impact analysis on BTC strategy","prompt":"Backtest my BTC candles using a 12/26 SMA crossover with 5 basis points of fees and $10,000 starting capital so I can see how much the trading fees eat into my returns compared to just holding."},{"title":"Validating a new trading strategy before deployment","prompt":"Before I go live, can you run a backtest on these 300 daily SOL candles with fast period 7, slow period 30, 20 bps fee, and $1000 starting capital — I need the strategy return, buy-hold return, and worst drawdown to decide if it's worth running."}],"resultDescription":"Returns a JSON object with: strategyReturnPct (percentage return of the SMA crossover strategy over the candle window), buyHoldReturnPct (percentage return of simply holding over the same window), maxDrawdownPct (worst peak-to-trough drawdown of the strategy), and bars (number of candles processed).","failureModes":["Fewer than 30 candles supplied — minimum required","slowPeriod not greater than fastPeriod — validation error","Candle open or close values are zero or negative — schema violation","More than 2000 candles submitted — exceeds maxItems limit","Missing required candle fields (open/close) — schema error","Payment not attached or insufficient — 402 Payment Required"],"whenToPreferThis":"Choose this endpoint when you have your own OHLC candle data and need a fast, fee-aware SMA crossover backtest without managing your own quant infrastructure. It is ideal for agents comparing strategy parameters, validating a strategy before live deployment, or quantifying how fees and SMA window choices affect returns versus passive holding. Prefer it over general financial data APIs when you already have the candles and need computation, not data retrieval.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-18T06:37:07.229Z","isFirstParty":false,"canonicalSlug":"crypto-backtest-api-4e8d1ebe"}