{"uid":"cap_-1EIIt67-YyoXO_DhEElD","slug":"strategy-optimizer-7bd60268","name":"Strategy Optimizer","description":"Grid-search up to 50 parameter combos of a backtest strategy; ranks by worst-half (H1/H2) return with neighbourhood smoothing, flags overfitting, and recommends the most robust parameters rather than the best-fit ones.","url":"https://grok-backtest-api.fly.dev/optimize?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"end":{"anyOf":[{"type":"string"},{"type":"null"}]},"fee":{"type":"number","maximum":0.05,"minimum":0},"grid":{"type":"object","additionalProperties":{"type":"array","items":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"string"},{"type":"null"}]}}},"start":{"anyOf":[{"type":"string"},{"type":"null"}]},"rank_by":{"enum":["robust","return"],"type":"string"},"slippage":{"type":"number","maximum":0.05,"minimum":0},"strategy":{"type":"object","required":["type"],"properties":{"type":{"enum":["breakout","momentum","dip","ma_trend"],"type":"string"},"params":{"type":"object","additionalProperties":true}},"additionalProperties":false},"universe":{"type":"object","properties":{"mode":{"enum":["point_in_time","current_top","fixed"],"type":"string"},"coins":{"anyOf":[{"type":"array","items":{"type":"string"},"maxItems":200},{"type":"null"}]},"top_n":{"type":"integer","maximum":200,"minimum":5},"min_age_days":{"type":"integer","maximum":120,"minimum":0},"min_avg_dollar_volume":{"type":"number","minimum":0}},"additionalProperties":false},"initial_capital":{"type":"number","maximum":1000000000,"exclusiveMinimum":0}}},"responseSchema":{"type":"json","example":{"summary":{"pct_profitable":55.6,"median_return_pct":1.2},"truncated":false,"combos_run":18,"recommended":{"params":{"atr_mult":2,"lookback":20,"risk_per_trade":0.05},"return_pct":10.98,"robust_score":-11.97,"h1_return_pct":-6.97,"h2_return_pct":19.88},"combos_total":18,"best_by_return":{"params":{"atr_mult":2,"lookback":10,"risk_per_trade":0.05}},"overfitting_flags":[{"id":"best_return_not_robust","detail":"..."}]}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.5","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.5/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.5","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.5","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_5OM5HFAXtjWJaPUD9i6ym","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.5","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Grid-searches strategy parameter combinations across Coinbase daily candles and returns recommended, overfitting-flagged, and ranked parameter sets for crypto quant strategies.","exampleAgentPrompt":"Run a parameter grid search on a momentum crypto strategy — try lookbacks of 10, 20, and 30 with risk_per_trade values of 0.02 and 0.05 and atr_mult of 1, 2, and 3 — using the point-in-time top 50 coins universe from 2022-01-01 to 2024-12-31, with 0.1% slippage and 0.05% fee, starting with $100,000, and rank by robustness so I can see which combo holds up across both halves without overfitting.","exampleUseCases":[{"title":"Tune momentum strategy before live deployment","prompt":"I want to optimize my momentum crypto strategy before going live — grid search lookbacks of 10, 20, and 40 and risk_per_trade of 0.02, 0.05, and 0.1 on the point-in-time top 100 coins from 2021-01-01 to 2023-12-31, with 0.15% slippage, $50,000 initial capital, and rank results by robustness so I can spot any overfitting."},{"title":"Find best breakout parameters for recent bull market","prompt":"Run a grid search on a breakout strategy using the current top 50 coins from 2023-01-01 to 2024-12-31, trying atr_mult values of 1.5, 2, and 3 and lookbacks of 5, 10, and 20, with 0.2% slippage and 0.05% fee on $25,000, and rank by return so I can see which settings performed best in the recent bull run."},{"title":"Identify robust dip-buying parameters across market cycles","prompt":"I'm building a dip-buying bot — can you optimize it over 2020-01-01 to 2024-12-31 using the point-in-time top 200 coins with a minimum age of 90 days and min dollar volume of $1M, grid-searching lookbacks of 7, 14, and 30 and risk_per_trade of 0.01, 0.03, and 0.05, with 0.1% slippage, ranked by robustness so I know the params hold across both half-periods?"}],"resultDescription":"A JSON object containing the total and executed combo count, a recommended parameter set (ranked by the chosen method), the best-by-return parameters, per-combo return and robust scores, half-period returns for overfitting detection, a summary with percent profitable and median return, and a list of overfitting flags with details.","failureModes":["Invalid strategy type enum value returns 422 validation error","Grid parameter values incompatible with strategy type cause computation errors","Date range with insufficient candle history returns empty or error result","Universe mode 'point_in_time' with no eligible coins returns empty universe error","Slippage or fee values exceeding maximum (0.05) return 422 validation error","Payment not provided or insufficient USDC causes 402 Payment Required response","Very large grids may exceed compute limits and return truncated results"],"whenToPreferThis":"Choose this endpoint when you need to systematically evaluate multiple parameter combinations for a crypto trading strategy and want overfitting protection via half-period return comparison and robust scoring — as opposed to running a single backtest. Prefer this over the Crypto Backtest endpoint when you have uncertainty about optimal parameter values and want a ranked shortlist with regime-stability checks included in one call.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-31T18:34:24.647Z","isFirstParty":false,"canonicalSlug":"strategy-optimizer-7bd60268"}