wait_for_completion. See developer concepts for
the why.
Every metric below is a hypothetical, simulated backtest result — deterministic
math over real historical prices, net of modeled slippage and commission, not
advice. Past performance does not guarantee future results. Always test before
you trade.
Recipe 1 — Create a strategy and backtest it
The most common flow.create_strategy builds the rules and runs a backtest
in one shot (it’s on by default), so you wait once on the build, then read the
finished strategy.
Wait for the build
Poll the
operation_id with task='strategy_op'. On success the result
carries the finished strategy summary, including its backtestResults.Recipe 2 — Backtest an existing strategy
You already have a strategy artifact (maybe created withbacktest=false, or its
backtestStatus is not_tested / failed, or you just want a fresh run).
backtest_existing_strategy re-tests it in place — no new version, no fork.
backtest_results — tradeCount, totalPnl, winRate,
maxDrawdown, sharpeRatio. See the
metrics glossary for what each one means.
Recipe 3 — Run a parameter sweep
Optimization is a two-step async flow: configure the batch, then run it. You need the strategy’s canonical parameter keys first — those come fromlist_strategies.
Get the parameter keys
list_strategies returns each strategy’s canonicalParameters. Use the
key of each parameter you want to sweep.Configure the sweep
setup_optimization with a range (min, max, step) per parameter. It
returns an optimization_id. Nothing runs yet.total_combinations, failed_count, and a
best_result.
Recipe 4 — Cancel a long-running task
A sweep across many combinations can run for a while.cancel_task requests a
stop. It’s idempotent, returns immediately, and behaves differently per task
type.
- Optimization
- Backtest
- Strategy build / update
The session’s single running sweep is resolved automatically — it stops
between combinations and keeps the partial results.
cancel_task
cancel_task returns right away — it requests the stop, it doesn’t block until
the task winds down. If you were waiting, your wait_for_completion loop will
see the task settle on its next poll.Recipe 5 — Look up contract specs
Before you size stops, targets, or position math, get the tick details right. Discover symbols, then pull the specs for the one you’ll trade.Discover what's tradable
list_symbols returns every CME Group symbol with its ticker, name, and
sector.Next steps
MCP tools
The full reference for every tool’s inputs and outputs.
Developer concepts
Sessions, operations, status fields, and the async model.
Optimization
What a sweep does — and how not to overfit.
Is the backtest real?
Why the numbers are reproducible and what they do and don’t model.