Skip to content
TotalFinance

backtest · wire operation

Run an options backtest

Backtest a declarative options strategy over chain snapshots: structure selection by delta and DTE, exit and roll triggers, optional delta hedging, declarative commission and slippage, American assignment modelling, and the marking policy (current-quote or entry volatility; what a missing mark does). Several rules may hold several trades at once (book), pre-trade limits reject entries with rows, combo or legged fills, quote freshness, split lineage, dividend evidence, the surface summary, and the portfolio ledger the equity reconciles to. Equity points, trades with per-leg attribution and mark counts, settlements, and the standard performance summary. The result is optionsBacktest(...) verbatim. Opt-in (backtestPack): payloads and runtime are heavier than the default set.

totalfinance.backtest.options_run
MCP tool name
totalfinance_backtest_options_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
None
Idempotency
not-applicable

Input schema

FieldTypeMeaning
chainsRequiredobject[]Chain snapshots (any order; the engine sorts)
markingOptionalobjectDefault: re-mark from the current quote; refuse a missing mark
initialCapitalOptionalnumberDefault 100,000
riskFreeRateRequirednumberContinuously-compounded risk-free rate (decimal, e.g. 0.045) pricing every mark — REQUIRED; the engine never assumes a rate
dividendYieldOptionalnumberDefault 0
entryOptionalobject | object | object | object | object | object | objectThe declarative entry structures; a `build` callback is SDK-only
rulesOptionalobject | object | object | object | object | object | object[]Several rules, each a member of the book; exactly one of entry and rules
exitRequiredobjectA `when` predicate is SDK-only
rollOptionalobject—
hedgeOptionalobject—
commissionOptionalobject | object | object | objectA declarative commission model (fees.none / bps / perShare / fixed)
slippageOptionalobject | object | object | objectA declarative slippage model (slippage.none / bps / fixed / spread)
assignmentOptional"model" | "none"—
periodsPerYearOptionalnumberDefault 252
bookOptionalobjectDefault: one open trade
limitsOptionalobjectPre-trade limits on the post-trade book; a breach is a limitRejections row
fillPolicyOptionalobject—
quoteFreshnessOptionalobject—
corporateActionsOptionalobject[]—
dividendsOptionalobject[]—
baseCurrencyOptionalstringDefault 'USD'
Complete JSON Schema

Loading…

Output schema

FieldTypeMeaning
pointsRequiredobject[]—
returnsRequirednumber[]—
tradesRequiredobject[]—
settlementsRequiredobject[]—
finalValueRequirednumber—
performanceRequiredobjectThe standard performance summary
limitRejectionsRequiredobject[]—
fillRejectionsRequiredobject[]—
surfaceRequiredobject[]—
ledgerRequiredobjectThe portfolio ledger snapshot (events)
timelineRequiredobject | nullThe ledger timeline (null under two marks)
runIdRequiredstring—
assumptionsRequiredobjectApplied conventions
diagnosticsRequiredobjectEngine, method, warnings
Complete JSON Schema

Loading…