Skip to content
TotalFinance

backtest · wire operation

Run a vectorized backtest

Run a single-asset vectorized backtest: signal-following fills at close, optional bps fees. Returns final value, turnover, and the performance summary; every hidden policy the run assumed (fill timing, costs, slippage, settlement, calendar, margin) is echoed in `assumptions`, and the implementation-risk warnings (look-ahead, data alignment) ride `diagnostics`. Deliberately opt-in (backtestPack) — payloads and runtime are heavier than the default tools. executionLag shifts signal lookup before rebalance sampling; a month-end target can miss the next monthly sample. Use the SDK researchProtocol and selection-hygiene workflow before comparing candidates; see docs/guides/dogfood-journeys.md.

totalfinance.backtest.vectorized_run
MCP tool name
totalfinance_backtest_vectorized_run
Pack / profiles
backtest / backtesting, full
Default discovery
Opt-in (select its pack or profile)
Required capabilities
None
Effects / authorization
none / none
Cost / cancellation
small / Do not assume inline interruption
Handle-eligible inputs
None
Idempotency
not-applicable

Input schema

FieldTypeMeaning
dataRequiredobject[]OHLC bars, chronological
signalRequirednumber[]Target position per bar (1 long, 0 flat, -1 short; fractional = sized), aligned to data
initialCapitalOptionalnumberOpening capital (default 1)
feeBpsOptionalnumberPer-trade fee in basis points of traded notional
slippageBpsOptionalnumberExisting slippage.bps model; basis points, zero means no slippage
executionLagOptionalintegerSignal-to-fill lag in bars (SDK default 1); 0 carries a look-ahead warning
rebalanceOptional"everyBar" | "daily" | "weekly" | "monthly" | integerExisting SDK sampling schedule; samples signal[i - executionLag] only on rebalance bars
periodsPerYearOptionalnumberBars per year for metrics (SDK default 252)
riskFreeRateOptionalnumberAnnual risk-free rate as a decimal (SDK default 0)
maxLeverageOptionalnumberExisting per-asset gross weight cap (SDK default 1)
Complete JSON Schema

Loading…

Output schema

FieldTypeMeaning
finalValueRequirednumber—
turnoverRequirednumberTraded notional ÷ average equity over the run
performanceRequiredobjectThe standard performance summary
assumptionsRequiredobjectThe modelling policies the run assumed: initialCapital, fill, cost, slippage, cashSettlement, corporateAction, calendar, margin, conventionsVersion
diagnosticsRequiredobjectImplementation-risk warnings (look-ahead / data alignment) + benchmarkFixtureVersion
Complete JSON Schema

Loading…