Run Bounded Factor Backtest
run_backtestA SMALL, BOUNDED, in-Worker sanity-check backtest — NOT a full-universe backtesting engine. Answers a quick question like 'does this factor actually work on these 5 names over the last year' inline, mid-conversation, without leaving MCP. Composes two existing tools (get_pit_universe + get_pit_valuation_ratios) across up to 10 tickers x 12 rebalance dates (120 cells): for each rebalance date, checks which requested tickers were in the survivorship-free PIT universe on that date (dropping — never erroring on — a ticker not yet listed or already delisted), then pulls each surviving ticker's point-in-time valuation multiples and computes the forward return to the NEXT rebalance date from the raw (unadjusted) close. Returns a flat {rebalance_date, ticker, factor_values, forward_return_pct} grid plus a small factor<->forward-return correlation per requested factor — a quick cross-sectional signal check, NOT a transaction-cost-aware portfolio simulation or a statistically validated backtest result. If the requested grid exceeds 120 cells, this tool does NOT silently truncate — it returns a stream_fallback response (signed Parquet download URLs, same shape as get_compute_ready_stream) and tells you to use those URLs. For a REAL full-universe, multi-date, survivorship-free backtest, use the Python SDK's AlphaEngine (pip install valuein-sdk) looped over as_of dates client-side — this tool is explicitly the small complement to that, not a replacement for it. Available on every plan; coverage follows your plan tier same as the two tools it composes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| factors | No | Which of get_pit_valuation_ratios's own output fields to include as factor_values. One or more of: pe_ratio, ps_ratio, pb_ratio, ev_ebitda, ev_revenue, fcf_yield_pct, gross_margin_pct, operating_margin_pct, net_margin_pct. Omit to include all of them. | |
| tickers | Yes | 1-10 stock ticker symbols, e.g. ["AAPL","MSFT"]. | |
| rebalance_dates | Yes | 1-12 historical dates (YYYY-MM-DD) to snapshot valuation multiples on. Order does not matter — the tool sorts them chronologically. Forward return is computed from each date to the NEXT one in the sorted list. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | Yes | ||
| _meta | Yes | Provenance envelope — data lineage for every MCP response | |
| cells | No | ||
| capped | Yes | ||
| method | Yes | ||
| caveats | Yes | ||
| dropped | Yes | ||
| factors | Yes | ||
| streams | No | ||
| summary | No | ||
| tickers | Yes | ||
| pit_safe | Yes | ||
| next_step | No | ||
| grid_cells | Yes | ||
| cells_computed | Yes | ||
| rebalance_dates | Yes | ||
| source_tools_used | Yes |