start_stochastic_backtest
Run a Stochastic Methods backtest (OU, Kalman and the like).
No setting has to be settled before it runs: what the request leaves open (the stock or pair, the
method, the entry and exit z-scores, the lookback, the history) runs with sensible defaults, which the
result names in one short line; a change is a new run. `question` titles its report. The call waits for
the run while it is likely to finish inside it, then answers with the result; the run's card in the chat
shows the result or, for a longer run, how far it is, and fills in by itself, with the next steps as
choices. A run started here needs no `show_report_card`.
A grid, a sweep, "the best setting" or "try these values and apply the best" is ONE call with `sweep`
(two of the method's settings, each from min to max in up to 10 steps), never many single runs: the
sweep is one task and one run of the person's allowance, and its answer carries the grid and the best
cell's backtest as the run of record, so applying the best needs no second call.
Unlike `start_backtest` (indicator rules), this engine
fits a stochastic model to the price series and trades from its
parameters. `primary_method` is `{"id": ..., "params": {...}}` with
the id ou_zscore (OU mean-reversion z-score), kalman_mr (Kalman
adaptive OU), kalman_trend (Kalman trend-following) or ou_pairs
(cointegration-based pairs, with `ticker_b`); everyday names such as
"ou", "kalman" or "pairs" are read too, and a setting the method does
not have is refused by name.
Every account runs it within a daily allowance; a refused call does not count, and get_started and
every run's answer give today's count.
A run takes about 30 seconds to 2 minutes. The call returns `{task_id,
status, kind, dashboard_url}`; `get_stochastic_backtest_progress`
reports progress and, when the run has finished, carries `result`:
the verdict and, for a run of a year or longer, a few rounded figures
(the run's return next to simply holding the stock, Sharpe, worst
drop, trades). With `oos_pct` above 0 the run tests only the earlier
part of the history and its result says the held-back part was never
tested; the same run again with `oos_pct` 0 tests the whole history.
When the run has finished, its progress answer also carries `report_url`: the run written up as a
QuanterLab report (the model against simply holding the stock, or for a pair holding both stocks and
SPY, the model's own checks, the trades), which opens without a login.
Use `list_stochastic_methods()` to discover valid `primary_method.id`
values and parameter shapes.
Args:
question: Optional. One sentence restating what the run should answer, not the person's
message: the title of the report the finished run becomes, and kept only as that.
sweep: Optional. A grid of two of the method's number settings,
`{"x": {"name": "z_entry", "min": 1.0, "max": 3.0, "steps": 7},
"y": {"name": "lookback", "min": 20, "max": 140, "steps": 7},
"objective": "sharpe"}`: each from min to max in 2 to 10 steps,
the best cell picked by Sharpe (the default) or by "return". It
runs as one task and counts as one run; its answer carries the
grid (every cell's Sharpe, the best cell) and the best cell's
backtest as the run of record.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sweep | No | ||
| ticker | Yes | ||
| oos_pct | No | ||
| duration | No | 2y | |
| leverage | No | ||
| question | No | ||
| ticker_b | No | ||
| direction | No | long | |
| timeframe | No | 1d | |
| spread_bps | No | ||
| regime_filter | No | ||
| risk_budget_k | No | ||
| signal_params | No | ||
| stop_loss_pct | No | ||
| primary_method | Yes | ||
| initial_capital | No | ||
| position_sizing | No | full_equity | |
| take_profit_pct | No | ||
| max_holding_days | No | ||
| risk_per_trade_pct | No | ||
| commission_per_trade | No | ||
| position_sizing_mode | No | fixed |