Skip to content
TotalFinance

backtest · wire operation

Run a portfolio backtest

Backtest a multi-asset portfolio through the ledger: instruments with built-in adapters (equity, etf, option, future, fx-forward, crypto-spot, crypto-perpetual, bond), market data by row set, a model or inline targets on a rebalance schedule, an execution policy with settlement lags, external flows, a calendar, and the margin check with forced liquidation. Every fill, flow, lifecycle fact, and liquidation is a portfolio event; the equity is the ledger's net asset value. The result is portfolioBacktest(...) verbatim. Opt-in (backtestPack): payloads and runtime are heavier than the default set; bulk row sets above the row cap travel by handle.

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

Input schema

FieldTypeMeaning
accountingRequiredobject—
instrumentsRequiredobject—
marketDataRequiredobject—
strategyRequiredobjectThe declarative strategy; an onSession callback is SDK-only
executionOptionalobjectA declared execution policy over session bars (execution.declared): the label is the caller's claim; a caller fill model, session rules, and quote/order-book observations are SDK-only
externalFlowsOptionalobject[]—
calendarOptional"NYSE" | "CBOE" | "ALWAYS_OPEN"—
windowOptionalobject—
periodsPerYearOptionalnumberDefault 252
seedOptionalinteger—
Complete JSON Schema

Loading…

Output schema

FieldTypeMeaning
ledgerRequiredobject—
timelineRequiredobject | null—
pnlRequiredobject | null—
ordersRequiredobject[]—
fillsRequiredobject[]—
rejectionsRequiredobject[]—
liquidationsRequiredobject[]—
eventsRequiredobject[]—
valuationMarksRequiredobject[]—
pointsRequiredobject[]—
returnsRequirednumber[]—
performanceRequiredobjectThe standard performance summary
finalValueRequirednumber—
runIdRequiredstring—
assumptionsRequiredobjectApplied conventions
diagnosticsRequiredobjectEngine, method, warnings
Complete JSON Schema

Loading…