The finance developer workbenchSearch the reference Development · 0.1.4 · unpublished

Public API / @insiderfinance/totalfinance

@insiderfinance/totalfinance/backtest

import from '@insiderfinance/totalfinance/backtest'

Every public export in this entry point, including type-only declarations. Search by name or concept.

Jump to an export (132)

AgentBenchReport · AgentTranscriptScore · AttributionReport · AttributionRow · BENCHMARK_FIXTURE_VERSION · BacktestAssumptions · BacktestResult · Bar · BarField · BenchmarkComparison · BorrowModel · BrokerConfig · CorporateAction · CostModel · CrossSectionalAssumptions · CrossSectionalAttribution · CrossSectionalBacktestGridRequest · CrossSectionalBacktestGridResult · CrossSectionalBacktestRequest · CrossSectionalBacktestResult · CrossSectionalDataset · CrossSectionalDiagnostics · CrossSectionalOutOfSampleResult · CrossSectionalPurgedFoldsRequest · CrossSectionalSignal · CrossSectionalWalkForwardRequest · EnvelopeSignal · EnvironmentAction · EnvironmentEpisode · EnvironmentEpisodeInput · EnvironmentEpisodeResult · EnvironmentObservation · EnvironmentStepResult · EquityPoint · EventDrivenOptions · ExerciseOptionInput · GridVariation · GridVariationRow · HoldingReason · HoldingRow · ImplementationRisk · Indicator · IndicatorHandle · InstrumentAdapter · InstrumentSpecification · MonteCarloResampleReport · MonteCarloResampleResult · Neutrality · OptionContractSpecification · OptionSettlement · OptionSettlementStyle · Order · OrderRequest · OrderSide · OrderStatus · OrderType · OutOfSampleAssumptions · OutOfSampleDiagnostics · OutOfSampleHygiene · OutOfSampleWindowRow · PortfolioBacktestRequest · PortfolioBacktestResult · PortfolioConstruction · PortfolioStepFrame · PortfolioStepper · PortfolioStepperRequest · Position · RebalanceFrequency · RebalanceGoal · RebalanceRow · RebalanceRule · RebalanceSchedule · ReturnStatistics · ReturnStatisticsReport · SeriesSignal · SessionSpan · ShortSideSelection · SideSelection · SignalContext · SignalRow · SimulatedBroker · SlippageModel · StrategyContext · SymbolAttribution · TearSheet · TearSheetOptions · TimeInForce · Trade · TradeOptions · TradeStatistics · TradingEnvironment · TradingEnvironmentDefinition · VectorizedOptions · WalkForwardOptions · WalkForwardResult · WalkForwardWindow · WalkForwardWindowResult · WeightContext · WeightingMethod · agentBaselines · attribution · borrow · brokers · checkDataAlignment · createPortfolioStepper · createTradingEnvironment · crossOver · crossOverSeries · crossSectionalBacktest · crossSectionalBacktestGrid · crossSectionalPurgedFolds · crossSectionalWalkForward · crossUnder · crossUnderSeries · environmentEpisode · equityToReturns · eventDriven · fees · gtSeries · latchSeries · ltSeries · monteCarloResample · portfolioBacktest · returnStatistics · runAgentBench · runEnvironmentEpisode · scoreAgentTranscript · slippage · tearSheet · toEquityPoints · vectorized · walkForward

interface

TradingEnvironmentDefinition

What an environment simulates: the stepper's request plus the episode bound, the limits, the reward, the features.

/** What an environment simulates: the stepper's request plus the episode bound, the limits, the reward, the features. */
export interface TradingEnvironmentDefinition extends PortfolioStepperRequest {
    /** The most steps an episode takes before `truncated` (default: the instant count; ceiling 100,000). */
    maximumSteps?: number;
    limits?: EnvironmentLimits;
    reward?: RewardComposition;
    features?: FeatureRecipes;
}
Fields, parameters & returned members (147)
Name / typeMeaning & unitOptional / default
accounting
import('@insiderfinance/totalfinance/backtest/portfolio').AccountingPolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
accounting.baseCurrency
string

ISO-4217 currency code
Required / declared member
No @default declared; consult the signature and description.
accounting.initialCash
readonly { currency: string; amount: number; }[]

currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
accounting.lotRelief
import('@insiderfinance/totalfinance/portfolio').LotReliefPolicy
Default `'fifo'`.
unitless by name
Optional
No @default declared; consult the signature and description.
accounting.settlement
Partial<Record<import('@insiderfinance/totalfinance/backtest/portfolio').AssetClass, 'T+0' | 'T+1' | 'T+2'>>
Settlement lag per asset class; default equities/etf/option/bond `'T+1'`, everything else `'T+0'`.
unitless by name
Optional
No @default declared; consult the signature and description.
calendar
string
A calendar name (`'NYSE'`, `'CBOE'`, `'ALWAYS_OPEN'`): sessions and settlement days.
unitless by name
Optional
No @default declared; consult the signature and description.
execution
import('@insiderfinance/totalfinance/backtest/execution').ExecutionPolicy

unitless by name
Optional
No @default declared; consult the signature and description.
execution.ambiguity
import('@insiderfinance/totalfinance/backtest/execution').AmbiguityPolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs
import('@insiderfinance/totalfinance/backtest/execution').ExecutionCosts

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.borrow
import('@insiderfinance/totalfinance/backtest').BorrowModel

unitless by name
Optional
No @default declared; consult the signature and description.
execution.costs.borrow.annualRate
number
Annualized borrow rate (decimal, e.g. `0.005` = 50 bps/yr).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
execution.costs.borrow.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.commission
import('@insiderfinance/totalfinance/backtest').CostModel

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.commission.commission
(input: import('@insiderfinance/totalfinance/backtest/costs').CommissionInput) => number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.commission.commission(input)
import('@insiderfinance/totalfinance/backtest/costs').CommissionInput

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.commission.commission(input).price
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.commission.commission(input).quantity
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.commission.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.latency
import('@insiderfinance/totalfinance/backtest/execution').LatencyModel

unitless by name
Optional
No @default declared; consult the signature and description.
execution.costs.latency.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.latency.sessions
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.marketImpact
import('@insiderfinance/totalfinance/backtest/execution').MarketImpactModel

unitless by name
Optional
No @default declared; consult the signature and description.
execution.costs.marketImpact.impact
(input: { quantity: number; referencePrice: number; averageDailyVolume?: number; }) => number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.marketImpact.impact(input)
{ averageDailyVolume?: number; quantity: number; referencePrice: number; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.marketImpact.impact(input).averageDailyVolume
number

unitless by name
Optional
No @default declared; consult the signature and description.
execution.costs.marketImpact.impact(input).quantity
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.marketImpact.impact(input).referencePrice
number

currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
execution.costs.marketImpact.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.participation
number
Fraction of the observation's volume one fill may take.
unitless by name
Optional
No @default declared; consult the signature and description.
execution.costs.slippage
import('@insiderfinance/totalfinance/backtest').SlippageModel

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.slippage.fill
(input: import('@insiderfinance/totalfinance/backtest/costs').SlippageFillInput) => number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.slippage.fill(input)
import('@insiderfinance/totalfinance/backtest/costs').SlippageFillInput

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.slippage.fill(input).quantity
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.slippage.fill(input).referencePrice
number

currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
execution.costs.slippage.fill(input).side
OrderSide

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.slippage.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.spread
import('@insiderfinance/totalfinance/backtest/execution').SpreadModel

unitless by name
Optional
No @default declared; consult the signature and description.
execution.costs.spread.halfSpread
(input: { referencePrice: number; side: OrderSide; }) => number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.spread.halfSpread(input)
{ referencePrice: number; side: OrderSide; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.spread.halfSpread(input).referencePrice
number

currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
execution.costs.spread.halfSpread(input).side
OrderSide

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.costs.spread.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.fill
import('@insiderfinance/totalfinance/backtest/execution').FillModel

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.fill.fill
(request: import('@insiderfinance/totalfinance/backtest/execution').FillRequest) => import('@insiderfinance/totalfinance/backtest/execution').FillDecision

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.fill.fill().return.clampedToPriceLimit
boolean
The fill price was clamped into a session price-limit band.
unitless by name
Optional
No @default declared; consult the signature and description.
execution.fill.fill().return.detail
string

unitless by name
Optional
No @default declared; consult the signature and description.
execution.fill.fill().return.levelsConsumed
number
Order-book fills: how many levels the quantity consumed.
unitless by name
Optional
No @default declared; consult the signature and description.
execution.fill.fill().return.outcome
('filled') | ('unfilled')

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.fill.fill().return.partial
boolean
Less than the requested quantity (participation, depth, size caps).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.fill.fill().return.pricePerUnit
number

currency per unit
Required / declared member
No @default declared; consult the signature and description.
execution.fill.fill().return.quantity
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.fill.fill().return.reason
import('@insiderfinance/totalfinance/backtest/execution').UnfilledReason

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.fill.fill().return.reference
string
Which price the fill referenced — `bar.open`, `bar.touch:limit`, `quote.ask`, `book.levels`, …
unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.fill.fill(request)
import('@insiderfinance/totalfinance/backtest/execution').FillRequest

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.fill.fill(request).context
import('@insiderfinance/totalfinance/backtest/execution').FillContext

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.fill.fill(request).observation
import('@insiderfinance/totalfinance/backtest/execution').MarketObservation

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.fill.fill(request).order
import('@insiderfinance/totalfinance/backtest/execution').OrderIntent

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.fill.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.fill.observation
'quote' | 'bar' | 'trade' | 'order-book'

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.fill.version
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.label
string
Echoed in every result's assumptions.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.lockedCrossed
import('@insiderfinance/totalfinance/backtest/execution').LockedCrossedPolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.margin
import('@insiderfinance/totalfinance/backtest/execution').MarginPolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.margin.buyingPowerMultiplier
number
Gross notional an account may hold per unit of equity (1 = cash account).
decimal fraction / multiple
Required / declared member
No @default declared; consult the signature and description.
execution.margin.forcedLiquidation
import('@insiderfinance/totalfinance/backtest/execution').ForcedLiquidationPolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.margin.initialMarginRate
number
Fraction of a new position's notional that must be equity at entry.
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
execution.margin.maintenanceMarginRate
number
Fraction of gross notional that must remain equity after every fold.
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
execution.observation
'quote' | 'bar' | 'trade' | 'order-book'

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.partialFills
import('@insiderfinance/totalfinance/backtest/execution').PartialFillPolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.queue
{ model: import('@insiderfinance/totalfinance/backtest/execution').QueueModel; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.queue.model
import('@insiderfinance/totalfinance/backtest/execution').QueueModel

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.realism
'simplified' | 'declared'
`simplified` is the default and says so; `declared` means the caller named every member.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.sessions
import('@insiderfinance/totalfinance/backtest/execution').SessionRules

unitless by name
Optional
No @default declared; consult the signature and description.
execution.sessions.auction
'ignore' | 'open-close-only'
How auction-only order types are treated by a model that has no auction: declared, never assumed.
unitless by name
Optional
No @default declared; consult the signature and description.
execution.sessions.halts
readonly import('@insiderfinance/totalfinance/backtest/execution').HaltWindow[]

unitless by name
Optional
No @default declared; consult the signature and description.
execution.sessions.priceLimits
readonly import('@insiderfinance/totalfinance/backtest/execution').PriceLimitWindow[]

unitless by name
Optional
No @default declared; consult the signature and description.
execution.staleQuotes
import('@insiderfinance/totalfinance/backtest/execution').StaleQuotePolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.staleQuotes.behavior
'reject' | 'fill-at-last'
`reject` refuses the run (`backtest.stale_quote`); `fill-at-last` fills at the stale quote and reports it.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.staleQuotes.maximumAgeMs
number | null
A quote older than this at the decision instant is stale; `null` = never stale.
milliseconds
Required / declared member
No @default declared; consult the signature and description.
execution.timeInForce
{ default: TimeInForce; expireAtSessionClose: boolean; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.timeInForce.default
TimeInForce

unitless by name
Required / declared member
No @default declared; consult the signature and description.
execution.timeInForce.expireAtSessionClose
boolean

unitless by name
Required / declared member
No @default declared; consult the signature and description.
externalFlows
readonly import('@insiderfinance/totalfinance/backtest/portfolio').ExternalFlowRecord[]

unitless by name
Optional
No @default declared; consult the signature and description.
features
FeatureRecipes

unitless by name
Optional
No @default declared; consult the signature and description.
features.drawdown
boolean
1 − close ÷ running peak close, per instrument.
unitless by name
Optional
No @default declared; consult the signature and description.
features.lookbackReturns
readonly number[]
Close-to-close returns over each lookback in bars.
unitless by name
Optional
No @default declared; consult the signature and description.
features.realizedVolatility
{ annualization: number; lookbacks: readonly number[]; }
Standard deviation of log returns over each lookback in bars, scaled by √annualization — the bars per year (252 daily, 52 weekly, 12 monthly) or `1` for the per-bar σ. Required: the environment never assumes the bar frequency.
unitless by name
Optional
No @default declared; consult the signature and description.
features.realizedVolatility.annualization
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
features.realizedVolatility.lookbacks
readonly number[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
instruments
Readonly<Record<string, InstrumentSpecification>>

unitless by name
Required / declared member
No @default declared; consult the signature and description.
limits
EnvironmentLimits

unitless by name
Optional
No @default declared; consult the signature and description.
limits.allowUndefinedRiskOptions
boolean
Default false: a sell that leaves an option position net short (and, for a call, uncovered) is disallowed.
unitless by name
Optional
No @default declared; consult the signature and description.
limits.maximumDailyLoss
number
Maximum one-evaluation NAV loss (decimal of the prior NAV).
unitless by name
Optional
No @default declared; consult the signature and description.
limits.maximumDaysToLiquidate
number
Maximum days to liquidate any position at the supplied participation rate.
unitless by name
Optional
No @default declared; consult the signature and description.
limits.maximumDrawdown
number
Maximum peak-to-trough drawdown of NAV (decimal).
unitless by name
Optional
No @default declared; consult the signature and description.
limits.maximumGrossLeverage
number
Maximum gross exposure ÷ NAV (1 = unlevered).
unitless by name
Optional
No @default declared; consult the signature and description.
limits.maximumGroupWeights
import('@insiderfinance/totalfinance/portfolio').GroupWeightLimit[]

unitless by name
Optional
No @default declared; consult the signature and description.
limits.maximumPositionNotional
number
Base currency, per instrument: the largest absolute position value an order may project.
currency amount (the field or record currency)
Optional
No @default declared; consult the signature and description.
limits.maximumPositionWeight
number
Maximum absolute weight of any single instrument (decimal of NAV).
decimal fraction / multiple
Optional
No @default declared; consult the signature and description.
limits.minimumSettledCash
number
Minimum settled cash in base currency (a margin/buying-power floor; may be negative).
currency amount (the field or record currency)
Optional
No @default declared; consult the signature and description.
limits.onBreach
'terminate' | 'reject-and-continue'
What a post-trade breach does: end the episode (default) or record it and continue.
unitless by name
Optional
No @default declared; consult the signature and description.
marketData
import('@insiderfinance/totalfinance/backtest/portfolio').PortfolioMarketData

unitless by name
Required / declared member
No @default declared; consult the signature and description.
marketData.bars
readonly import('@insiderfinance/totalfinance/core').Bar[]

unitless by name
Optional
No @default declared; consult the signature and description.
marketData.corporateActions
readonly import('@insiderfinance/totalfinance/core').CorporateAction[]

unitless by name
Optional
No @default declared; consult the signature and description.
marketData.coupons
readonly import('@insiderfinance/totalfinance/backtest/portfolio').CouponRecord[]

unitless by name
Optional
No @default declared; consult the signature and description.
marketData.dividends
readonly import('@insiderfinance/totalfinance/backtest/portfolio').DividendRecord[]

unitless by name
Optional
No @default declared; consult the signature and description.
marketData.forwardRates
readonly import('@insiderfinance/totalfinance/backtest/portfolio').ForwardRateRecord[]
Forward-rate series per fx-forward instrument.
unitless by name
Optional
No @default declared; consult the signature and description.
marketData.fundingRates
readonly import('@insiderfinance/totalfinance/backtest/portfolio').FundingRateRecord[]

unitless by name
Optional
No @default declared; consult the signature and description.
marketData.fxRates
readonly import('@insiderfinance/totalfinance/backtest/portfolio').DatedCurrencyPairQuote[]
Dated quotes to the base currency; REQUIRED when any instrument's currency ≠ baseCurrency.
unitless by name
Optional
No @default declared; consult the signature and description.
marketData.optionChains
readonly import('@insiderfinance/totalfinance/backtest/options').ChainSnapshot[]

unitless by name
Optional
No @default declared; consult the signature and description.
marketData.orderBooks
readonly import('@insiderfinance/totalfinance/core').OrderBook[]

unitless by name
Optional
No @default declared; consult the signature and description.
marketData.quotes
readonly import('@insiderfinance/totalfinance/core').Quote[]

unitless by name
Optional
No @default declared; consult the signature and description.
marketData.trades
readonly import('@insiderfinance/totalfinance/core').Trade[]

unitless by name
Optional
No @default declared; consult the signature and description.
maximumSteps
number
The most steps an episode takes before `truncated` (default: the instant count; ceiling 100,000).
unitless by name
Optional
No @default declared; consult the signature and description.
periodsPerYear
number

per year (count)
Optional
No @default declared; consult the signature and description.
reward
RewardComposition

unitless by name
Optional
No @default declared; consult the signature and description.
reward.benchmark
{ instrumentId: string; weight: number; }
On the step return minus the named instrument's bar return over the step.
unitless by name
Optional
No @default declared; consult the signature and description.
reward.benchmark.instrumentId
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
reward.benchmark.weight
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
reward.concentration
number
On the largest absolute position weight after the step.
unitless by name
Optional
No @default declared; consult the signature and description.
reward.cost
number
On commissions, fees, and slippage ÷ NAV before the step.
unitless by name
Optional
No @default declared; consult the signature and description.
reward.drawdown
number
On the INCREASE in drawdown from the episode's running peak (a recovery pays 0).
unitless by name
Optional
No @default declared; consult the signature and description.
reward.goal
(frame: RewardFrame) => Record<string, number>
Extra named terms (weight 1 each); a callback, so the definition is not replayable.
unitless by name
Optional
No @default declared; consult the signature and description.
reward.goal(frame)
RewardFrame

unitless by name
Required / declared member
No @default declared; consult the signature and description.
reward.goal(frame).asOf
number

an instant: epoch milliseconds or a YYYY-MM-DD / zoned ISO string (the resolveAsOf convention)
Required / declared member
No @default declared; consult the signature and description.
reward.goal(frame).benchmarkReturn
number | null
The benchmark instrument's bar-close return over the step, or null without two closes.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
reward.goal(frame).costs
number
Σ commission + fees + slippage adjustment of the step's fills, base currency.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
reward.goal(frame).drawdownAfter
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
reward.goal(frame).drawdownBefore
number
1 − NAV ÷ running peak, before and after the step.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
reward.goal(frame).fills
readonly NormalizedFill[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
reward.goal(frame).grossExposure
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
reward.goal(frame).largestPositionWeight
number

decimal fraction / multiple
Required / declared member
No @default declared; consult the signature and description.
reward.goal(frame).netAssetValueAfter
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
reward.goal(frame).netAssetValueBefore
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
reward.goal(frame).positions
readonly SessionPosition[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
reward.goal(frame).step
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
reward.goal(frame).stepReturn
number
Δ NAV ÷ NAV before the step (0 when the NAV before was not positive).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
reward.goal(frame).tradedNotional
number
Σ |quantity × price × multiplier| of the step's fills, base currency.
currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
reward.goal(frame).violations
number
Limit breaches plus disallowed orders in the step.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
reward.leverage
number
On gross exposure ÷ NAV after the step.
unitless by name
Optional
No @default declared; consult the signature and description.
reward.pnl
number
On the step's net return, Δ NAV ÷ NAV before the step.
unitless by name
Optional
No @default declared; consult the signature and description.
reward.riskViolation
number
On the count of limit breaches and disallowed orders in the step.
unitless by name
Optional
No @default declared; consult the signature and description.
reward.turnover
number
On traded notional ÷ NAV before the step.
unitless by name
Optional
No @default declared; consult the signature and description.
seed
number
Seeds only the bootstrap confidence intervals.
unitless by name
Optional
No @default declared; consult the signature and description.
window
{ fromTimestampMs?: EpochMs; toTimestampMs?: EpochMs; }

unitless by name
Optional
No @default declared; consult the signature and description.
window.fromTimestampMs
number

epoch milliseconds (UTC instant)
Optional
No @default declared; consult the signature and description.
window.toTimestampMs
number

epoch milliseconds (UTC instant)
Optional
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

VectorizedOptions

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export interface VectorizedOptions {
    /** Price bars in ascending time order. */
    data: Bar[];
    /**
     * Target exposure per bar, aligned to `data`. A boolean is long (`1`) / flat (`0`); a number is a
     * target weight (fraction of equity; negative = short), clamped to `maxLeverage`.
     *
     * Accepts a warmup-aware {@link SeriesSignal} (`{ value, warmup }`, e.g. a `technicalAnalysis.*.explain(...)`
     * result) so an indicator's leading warmup NaNs are treated as flat (position 0) instead of
     * throwing. A bare `number[]`/`Float64Array` has an implicit `warmup` of 0, so any NaN in it still
     * throws (a genuine mid-series NaN is a real error, not warmup).
     */
    signal: ArrayLike<number | boolean> | SeriesSignal | EnvelopeSignal;
    /** Rebalance calendar (default `everyBar`). */
    rebalance?: RebalanceRule;
    /** Commission model (default `fees.none()`). */
    fees?: CostModel;
    /** Slippage model (default `slippage.none()`). */
    slippage?: SlippageModel;
    /** Short borrow-fee model (default `borrow.none()`). */
    borrow?: BorrowModel;
    /** Opening capital (default 1). */
    initialCapital?: number;
    /** Bars per year, for annualized metrics (default 252). */
    periodsPerYear?: number;
    /** Per-asset gross weight cap applied to the signal (default 1). */
    maxLeverage?: number;
    /** Bars between observing the signal and trading on it; ≥ 1 avoids look-ahead (default 1). */
    executionLag?: number;
    /** Annualized risk-free rate for Sharpe/Sortino (default 0). */
    riskFreeRate?: number;
}
Fields, parameters & returned members (28)
Name / typeMeaning & unitOptional / default
borrow
BorrowModel
Short borrow-fee model (default `borrow.none()`).
unitless by name
Optional
No @default declared; consult the signature and description.
borrow.annualRate
number
Annualized borrow rate (decimal, e.g. `0.005` = 50 bps/yr).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
borrow.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
data
Bar[]
Price bars in ascending time order.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
executionLag
number
Bars between observing the signal and trading on it; ≥ 1 avoids look-ahead (default 1).
unitless by name
Optional
No @default declared; consult the signature and description.
fees
CostModel
Commission model (default `fees.none()`).
unitless by name
Optional
No @default declared; consult the signature and description.
fees.commission
(input: import('@insiderfinance/totalfinance/backtest/costs').CommissionInput) => number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
fees.commission(input)
import('@insiderfinance/totalfinance/backtest/costs').CommissionInput

unitless by name
Required / declared member
No @default declared; consult the signature and description.
fees.commission(input).price
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
fees.commission(input).quantity
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
fees.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
initialCapital
number
Opening capital (default 1).
unitless by name
Optional
No @default declared; consult the signature and description.
maxLeverage
number
Per-asset gross weight cap applied to the signal (default 1).
unitless by name
Optional
No @default declared; consult the signature and description.
periodsPerYear
number
Bars per year, for annualized metrics (default 252).
per year (count)
Optional
No @default declared; consult the signature and description.
rebalance
RebalanceRule
Rebalance calendar (default `everyBar`).
unitless by name
Optional
No @default declared; consult the signature and description.
riskFreeRate
number
Annualized risk-free rate for Sharpe/Sortino (default 0).
decimal rate (0.05 = 5%)
Optional
No @default declared; consult the signature and description.
signal
ArrayLike<number | boolean> | SeriesSignal | EnvelopeSignal
Target exposure per bar, aligned to `data`. A boolean is long (`1`) / flat (`0`); a number is a target weight (fraction of equity; negative = short), clamped to `maxLeverage`. Accepts a warmup-aware {@link SeriesSignal} (`{ value, warmup }`, e.g. a `technicalAnalysis.*.explain(...)` result) so an indicator's leading warmup NaNs are treated as flat (position 0) instead of throwing. A bare `number[]`/`Float64Array` has an implicit `warmup` of 0, so any NaN in it still throws (a genuine mid-series NaN is a real error, not warmup).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
signal.diagnostics
{ warmup: number; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
signal.diagnostics.warmup
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
signal.value
ArrayLike<number>
Per-bar signal values, aligned to the price bars.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
signal.warmup
number
Count of leading bars that may be non-finite by design (the indicator's warmup).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
slippage
SlippageModel
Slippage model (default `slippage.none()`).
unitless by name
Optional
No @default declared; consult the signature and description.
slippage.fill
(input: import('@insiderfinance/totalfinance/backtest/costs').SlippageFillInput) => number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
slippage.fill(input)
import('@insiderfinance/totalfinance/backtest/costs').SlippageFillInput

unitless by name
Required / declared member
No @default declared; consult the signature and description.
slippage.fill(input).quantity
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
slippage.fill(input).referencePrice
number

currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
slippage.fill(input).side
import('@insiderfinance/totalfinance/core').OrderSide

unitless by name
Required / declared member
No @default declared; consult the signature and description.
slippage.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

WalkForwardOptions

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export interface WalkForwardOptions {
    /** Bars in ascending time order (one symbol, or a pre-sorted multi-symbol stream). */
    data: Bar[];
    /** Training window length in bars. */
    trainSize: number;
    /** Test (out-of-sample) window length in bars. */
    testSize: number;
    /** Step between successive windows (default `testSize`, i.e. non-overlapping test windows). */
    step?: number;
    /** `rolling` (sliding train window) or `anchored` (train grows from the start). Default `rolling`. */
    mode?: 'rolling' | 'anchored';
    /** Run a backtest over a window; return its out-of-sample result. */
    run: (window: WalkForwardWindow) => BacktestResult;
    /** Bars per year for the stitched performance (default 252). */
    periodsPerYear?: number;
}
Fields, parameters & returned members (19)
Name / typeMeaning & unitOptional / default
data
Bar[]
Bars in ascending time order (one symbol, or a pre-sorted multi-symbol stream).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
mode
'rolling' | 'anchored'
`rolling` (sliding train window) or `anchored` (train grows from the start). Default `rolling`.
unitless by name
Optional
No @default declared; consult the signature and description.
periodsPerYear
number
Bars per year for the stitched performance (default 252).
per year (count)
Optional
No @default declared; consult the signature and description.
run
(window: WalkForwardWindow) => BacktestResult
Run a backtest over a window; return its out-of-sample result.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
run().return.assumptions
BacktestAssumptions
The modelling assumptions this run made — capital, fills, costs, calendar, margin (dx §2.5).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
run().return.diagnostics
import('@insiderfinance/totalfinance/backtest').ImplementationRisk
Implementation-risk diagnostics: warnings + benchmark fixture version (spec §16.3).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
run().return.finalValue
number
Final portfolio value.
currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
run().return.performance
PerformanceSummary
Performance metrics of the equity curve (`@insiderfinance/totalfinance/performance`).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
run().return.points
import('@insiderfinance/totalfinance/backtest').EquityPoint[]
The equity curve as an explicit `(ts, equity)` series (length = number of bars + 1). `points[0]` is the opening capital stamped at the first bar's timestamp; see {@link EquityPoint}.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
run().return.returns
number[]
Per-bar simple returns of the equity curve.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
run().return.settlements
import('@insiderfinance/totalfinance/backtest').OptionSettlement[]
Option positions settled at expiry (exercise / assignment / worthless), if any.
unitless by name
Optional
No @default declared; consult the signature and description.
run().return.trades
import('@insiderfinance/totalfinance/backtest').Trade[]
Every filled trade, in order.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
run().return.turnover
number
Sum of |traded notional| ÷ average equity — a turnover proxy.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
run(window)
WalkForwardWindow

unitless by name
Required / declared member
No @default declared; consult the signature and description.
run(window).test
Bar[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
run(window).train
Bar[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
step
number
Step between successive windows (default `testSize`, i.e. non-overlapping test windows).
unitless by name
Optional
No @default declared; consult the signature and description.
testSize
number
Test (out-of-sample) window length in bars.
count (integer)
Required / declared member
No @default declared; consult the signature and description.
trainSize
number
Training window length in bars.
count (integer)
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

WalkForwardResult

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export interface WalkForwardResult {
    /** The per-window out-of-sample results, in order, each tagged with its train/test ranges. */
    windows: WalkForwardWindowResult[];
    /** Out-of-sample equity stitched across all test windows (starts at 1). */
    equityCurve: number[];
    /** Performance of the stitched out-of-sample curve. */
    performance: PerformanceSummary;
    /**
     * The echoed modelling assumptions, identical across windows (same engine/config) — taken from the
     * first window, so the walk-forward artifact carries the same honesty story as a single backtest
     * (WS2.8 / dx §2.5).
     */
    assumptions: BacktestAssumptions;
    /** Core diagnostics: the union of every window's warnings, deduped by code + message (WS2.8). */
    diagnostics: Diagnostics;
}
Fields, parameters & returned members (61)
Name / typeMeaning & unitOptional / default
assumptions
BacktestAssumptions
The echoed modelling assumptions, identical across windows (same engine/config) — taken from the first window, so the walk-forward artifact carries the same honesty story as a single backtest (WS2.8 / dx §2.5).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.assignment
string
American early exercise/assignment policy: `model` or `none` (WS7.4). Absent where inapplicable.
unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.calendar
string
Rebalancing/trading calendar, e.g. `every-bar`, `monthly`, `signal-driven`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.cashSettlement
string
Cash settlement assumption, e.g. `immediate` (T+0).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.conventionsVersion
string
Version of the library's default conventions (core `CONVENTIONS_VERSION`).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.corporateAction
string
Corporate-action handling, e.g. `dividends-as-cash`, `splits-adjusted`, `none`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.cost
string
Commission model applied, e.g. `bps(1)`, `per-share(0.005)`, `none`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.fill
string
When/at what price orders fill, e.g. `next-open`, `close`, `trigger-price`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.initialCapital
number
Opening capital the run started from.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.margin
string
Leverage/margin regime: `unconstrained` (no cap; unfunded fills allowed) or `maxLeverage`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.oco
string
How an OCO group resolves a bar that touches BOTH legs. One bar cannot say which trigger came first, and the engine's answer — the take-profit, because a bracket submits it before the stop-loss and orders fill in submission order — is optimistic. It is disclosed here rather than left as an undocumented mechanic (`take-profit-first-on-ambiguous-bar`). Absent for engines with no order book (the vectorized loop).
unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.slippage
string
Slippage model applied, e.g. `bps(2)`, `spread`, `none`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics
Diagnostics
Core diagnostics: the union of every window's warnings, deduped by code + message (WS2.8).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.autoReason
string
When a meta-engine (e.g. `engines.auto()`) selected a delegate, this is a one-sentence, human-readable explanation of WHY that delegate was chosen (`engine` then names the delegate). Absent when no auto-selection took place.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.converged
boolean
Whether an iterative procedure converged. `false` means the value is not trustworthy.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.decomposition
Record<string, number>
Named intermediate quantities the value decomposes into — a par spread's protection leg and risky annuity, a forward variance's near/far legs. The H-series explain paths disclose their arithmetic here so a caller can audit the ratio, not just receive it (3B.3).
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.engine
string
Pricing/solver engine name, e.g. `black-scholes-merton`.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.finiteDifferenceBumps
Record<string, number>
Finite-difference engines: the ACTUAL bump sizes used for FD Greeks (spec P2.3) — adaptive near the vol/time boundaries, so the caller can see exactly what was differenced. Keys: `spotStep`, `volatilityStep`, `timeStepYears`, `rateStep`, and — extended Greeks only — `dividendYieldStep`. Each is the actual step differenced, in the unit of the coordinate it bumps. (This doc named the retired `hS`/`hSig`/`hT`/`hR`/`hQ` keys for one release after the emit sites had moved to the semantic names, so a caller following it read `undefined`.)
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.iterations
number
Iteration count for iterative methods.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.method
string
Numerical method, e.g. `closed-form`, `brent`, `finite-difference`.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.selection
import('@insiderfinance/totalfinance/core/pricing').SelectionReport
The structured engine-selection report (Gate C, `@insiderfinance/totalfinance/core/pricing`): who was selected, why, and — for automatic selection — every candidate considered with its verdict. This is the machine-readable superset of `engine` + `autoReason` (which remain for compatibility); `selected.name` always agrees with `engine` when both are present.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.selection.candidates
readonly import('@insiderfinance/totalfinance/core/pricing').SelectionCandidate[]
Candidates an automatic selection considered; absent for explicit mode.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.selection.mode
'explicit' | 'automatic'

unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.selection.reason
string
Why the selected engine answers this request.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.selection.selected
{ name: string; version?: string; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.selection.selected.name
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.selection.selected.version
string

unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.timingMs
number
Wall-clock timing in milliseconds, when measured.
milliseconds
Optional
No @default declared; consult the signature and description.
diagnostics.warmup
number
Series facades: number of leading output slots that are warmup sentinels (null/NaN) while the computation seeds. Equals the input length when the indicator never emitted.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.warnings
QuantWarning[]
Structured warnings; always present (possibly empty).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
equityCurve
number[]
Out-of-sample equity stitched across all test windows (starts at 1).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance
PerformanceSummary
Performance of the stitched out-of-sample curve.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.alpha
number | null
Annualized Jensen's alpha (only when `options.benchmark` is supplied).
unitless by name
Optional
No @default declared; consult the signature and description.
performance.annualizedReturn
number | null
`null` when compounding overflowed (disclosed via `performance.non_finite_metric`).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.annualizedVolatility
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.assumptions
{ benchmarkLength?: number; periodsPerYear: number; riskFreeRate: number; }
The conventions actually applied — a serialized summary is self-interpreting (spec §7.4).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.assumptions.benchmarkLength
number
Length of the benchmark return series, present only when a benchmark was supplied.
count (integer)
Optional
No @default declared; consult the signature and description.
performance.assumptions.periodsPerYear
number
Annualization factor used for all annualized metrics.
per year (count)
Required / declared member
No @default declared; consult the signature and description.
performance.assumptions.riskFreeRate
number
Per-period risk-free rate used for Sharpe/Sortino/alpha/Treynor (0 when unspecified).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
performance.beta
number | null
Beta to the benchmark (only when `options.benchmark` is supplied).
unitless by name
Optional
No @default declared; consult the signature and description.
performance.calmar
number | null
`null` when the metric is undefined for this input (disclosed via warnings).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.drawdown
import('@insiderfinance/totalfinance/performance').DrawdownResult

unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.drawdown.longestDurationPeriods
number
Longest underwater stretch, in periods.
periods
Required / declared member
No @default declared; consult the signature and description.
performance.drawdown.maxDrawdown
number
Maximum drawdown as a positive fraction (0.2 = a 20% peak-to-trough decline).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.drawdown.peakIndex
number
Index of the peak preceding the worst drawdown.
count (integer)
Required / declared member
No @default declared; consult the signature and description.
performance.drawdown.recoveryIndex
number
Index at which equity first regained the pre-drawdown peak after the worst trough (WS3.3c). Absent when the curve never recovered by the end of the series (still underwater).
count (integer)
Optional
No @default declared; consult the signature and description.
performance.drawdown.troughIndex
number
Index of the trough of the worst drawdown.
count (integer)
Required / declared member
No @default declared; consult the signature and description.
performance.expectancy
number | null
Mean per-period return (expectancy); `null` on an empty series or overflow (disclosed).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.hitRate
number | null
`null` when the metric is undefined for this input (disclosed via warnings).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
performance.informationRatio
number | null
Information ratio (only when `options.benchmark` is supplied).
decimal fraction / multiple
Optional
No @default declared; consult the signature and description.
performance.maxDrawdown
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.omega
number | null
`null` when the metric is undefined for this input (disclosed via warnings).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.periods
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.profitFactor
number | null
`null` when the metric is undefined for this input (disclosed via warnings).
decimal fraction / multiple
Required / declared member
No @default declared; consult the signature and description.
performance.sharpe
number | null
`null` when the metric is undefined for this input (disclosed via warnings).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.sortino
number | null
`null` when the metric is undefined for this input (disclosed via warnings).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.totalReturn
number | null
`null` when compounding overflowed (disclosed via `performance.non_finite_metric`).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.trackingError
number | null
Annualized tracking error (only when `options.benchmark` is supplied).
unitless by name
Optional
No @default declared; consult the signature and description.
performance.treynor
number | null
Treynor ratio (only when `options.benchmark` is supplied).
unitless by name
Optional
No @default declared; consult the signature and description.
performance.warnings
QuantWarning[]
Diagnostics — e.g. `performance.suspicious_equity_input` when an equity curve looks like returns.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
windows
WalkForwardWindowResult[]
The per-window out-of-sample results, in order, each tagged with its train/test ranges.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

WalkForwardWindow

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export interface WalkForwardWindow {
    train: Bar[];
    test: Bar[];
}
Fields, parameters & returned members (2)
Name / typeMeaning & unitOptional / default
test
Bar[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
train
Bar[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

WalkForwardWindowResult

A per-window out-of-sample result, tagged with the train/test time ranges it covered (WS2.8).

/** A per-window out-of-sample result, tagged with the train/test time ranges it covered (WS2.8). */
export interface WalkForwardWindowResult extends BacktestResult {
    /** `[firstTrainBarTs, lastTrainBarTs]`. */
    trainRange: [
        EpochMs,
        EpochMs
    ];
    /** `[firstTestBarTs, lastTestBarTs]`. */
    testRange: [
        EpochMs,
        EpochMs
    ];
}
Fields, parameters & returned members (68)
Name / typeMeaning & unitOptional / default
assumptions
BacktestAssumptions
The modelling assumptions this run made — capital, fills, costs, calendar, margin (dx §2.5).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.assignment
string
American early exercise/assignment policy: `model` or `none` (WS7.4). Absent where inapplicable.
unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.calendar
string
Rebalancing/trading calendar, e.g. `every-bar`, `monthly`, `signal-driven`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.cashSettlement
string
Cash settlement assumption, e.g. `immediate` (T+0).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.conventionsVersion
string
Version of the library's default conventions (core `CONVENTIONS_VERSION`).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.corporateAction
string
Corporate-action handling, e.g. `dividends-as-cash`, `splits-adjusted`, `none`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.cost
string
Commission model applied, e.g. `bps(1)`, `per-share(0.005)`, `none`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.fill
string
When/at what price orders fill, e.g. `next-open`, `close`, `trigger-price`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.initialCapital
number
Opening capital the run started from.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.margin
string
Leverage/margin regime: `unconstrained` (no cap; unfunded fills allowed) or `maxLeverage`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.oco
string
How an OCO group resolves a bar that touches BOTH legs. One bar cannot say which trigger came first, and the engine's answer — the take-profit, because a bracket submits it before the stop-loss and orders fill in submission order — is optimistic. It is disclosed here rather than left as an undocumented mechanic (`take-profit-first-on-ambiguous-bar`). Absent for engines with no order book (the vectorized loop).
unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.slippage
string
Slippage model applied, e.g. `bps(2)`, `spread`, `none`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics
import('@insiderfinance/totalfinance/backtest').ImplementationRisk
Implementation-risk diagnostics: warnings + benchmark fixture version (spec §16.3).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.autoReason
string
When a meta-engine (e.g. `engines.auto()`) selected a delegate, this is a one-sentence, human-readable explanation of WHY that delegate was chosen (`engine` then names the delegate). Absent when no auto-selection took place.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.benchmarkFixtureVersion
string
The benchmark fixture version this engine was validated against.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.converged
boolean
Whether an iterative procedure converged. `false` means the value is not trustworthy.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.decomposition
Record<string, number>
Named intermediate quantities the value decomposes into — a par spread's protection leg and risky annuity, a forward variance's near/far legs. The H-series explain paths disclose their arithmetic here so a caller can audit the ratio, not just receive it (3B.3).
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.engine
string
Pricing/solver engine name, e.g. `black-scholes-merton`.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.finiteDifferenceBumps
Record<string, number>
Finite-difference engines: the ACTUAL bump sizes used for FD Greeks (spec P2.3) — adaptive near the vol/time boundaries, so the caller can see exactly what was differenced. Keys: `spotStep`, `volatilityStep`, `timeStepYears`, `rateStep`, and — extended Greeks only — `dividendYieldStep`. Each is the actual step differenced, in the unit of the coordinate it bumps. (This doc named the retired `hS`/`hSig`/`hT`/`hR`/`hQ` keys for one release after the emit sites had moved to the semantic names, so a caller following it read `undefined`.)
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.iterations
number
Iteration count for iterative methods.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.method
string
Numerical method, e.g. `closed-form`, `brent`, `finite-difference`.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.selection
import('@insiderfinance/totalfinance/core/pricing').SelectionReport
The structured engine-selection report (Gate C, `@insiderfinance/totalfinance/core/pricing`): who was selected, why, and — for automatic selection — every candidate considered with its verdict. This is the machine-readable superset of `engine` + `autoReason` (which remain for compatibility); `selected.name` always agrees with `engine` when both are present.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.selection.candidates
readonly import('@insiderfinance/totalfinance/core/pricing').SelectionCandidate[]
Candidates an automatic selection considered; absent for explicit mode.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.selection.mode
'explicit' | 'automatic'

unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.selection.reason
string
Why the selected engine answers this request.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.selection.selected
{ name: string; version?: string; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.selection.selected.name
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.selection.selected.version
string

unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.timingMs
number
Wall-clock timing in milliseconds, when measured.
milliseconds
Optional
No @default declared; consult the signature and description.
diagnostics.warmup
number
Series facades: number of leading output slots that are warmup sentinels (null/NaN) while the computation seeds. Equals the input length when the indicator never emitted.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.warnings
QuantWarning[]
Structured warnings; always present (possibly empty).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
finalValue
number
Final portfolio value.
currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
performance
PerformanceSummary
Performance metrics of the equity curve (`@insiderfinance/totalfinance/performance`).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.alpha
number | null
Annualized Jensen's alpha (only when `options.benchmark` is supplied).
unitless by name
Optional
No @default declared; consult the signature and description.
performance.annualizedReturn
number | null
`null` when compounding overflowed (disclosed via `performance.non_finite_metric`).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.annualizedVolatility
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.assumptions
{ benchmarkLength?: number; periodsPerYear: number; riskFreeRate: number; }
The conventions actually applied — a serialized summary is self-interpreting (spec §7.4).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.assumptions.benchmarkLength
number
Length of the benchmark return series, present only when a benchmark was supplied.
count (integer)
Optional
No @default declared; consult the signature and description.
performance.assumptions.periodsPerYear
number
Annualization factor used for all annualized metrics.
per year (count)
Required / declared member
No @default declared; consult the signature and description.
performance.assumptions.riskFreeRate
number
Per-period risk-free rate used for Sharpe/Sortino/alpha/Treynor (0 when unspecified).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
performance.beta
number | null
Beta to the benchmark (only when `options.benchmark` is supplied).
unitless by name
Optional
No @default declared; consult the signature and description.
performance.calmar
number | null
`null` when the metric is undefined for this input (disclosed via warnings).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.drawdown
import('@insiderfinance/totalfinance/performance').DrawdownResult

unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.drawdown.longestDurationPeriods
number
Longest underwater stretch, in periods.
periods
Required / declared member
No @default declared; consult the signature and description.
performance.drawdown.maxDrawdown
number
Maximum drawdown as a positive fraction (0.2 = a 20% peak-to-trough decline).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.drawdown.peakIndex
number
Index of the peak preceding the worst drawdown.
count (integer)
Required / declared member
No @default declared; consult the signature and description.
performance.drawdown.recoveryIndex
number
Index at which equity first regained the pre-drawdown peak after the worst trough (WS3.3c). Absent when the curve never recovered by the end of the series (still underwater).
count (integer)
Optional
No @default declared; consult the signature and description.
performance.drawdown.troughIndex
number
Index of the trough of the worst drawdown.
count (integer)
Required / declared member
No @default declared; consult the signature and description.
performance.expectancy
number | null
Mean per-period return (expectancy); `null` on an empty series or overflow (disclosed).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.hitRate
number | null
`null` when the metric is undefined for this input (disclosed via warnings).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
performance.informationRatio
number | null
Information ratio (only when `options.benchmark` is supplied).
decimal fraction / multiple
Optional
No @default declared; consult the signature and description.
performance.maxDrawdown
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.omega
number | null
`null` when the metric is undefined for this input (disclosed via warnings).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.periods
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.profitFactor
number | null
`null` when the metric is undefined for this input (disclosed via warnings).
decimal fraction / multiple
Required / declared member
No @default declared; consult the signature and description.
performance.sharpe
number | null
`null` when the metric is undefined for this input (disclosed via warnings).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.sortino
number | null
`null` when the metric is undefined for this input (disclosed via warnings).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.totalReturn
number | null
`null` when compounding overflowed (disclosed via `performance.non_finite_metric`).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
performance.trackingError
number | null
Annualized tracking error (only when `options.benchmark` is supplied).
unitless by name
Optional
No @default declared; consult the signature and description.
performance.treynor
number | null
Treynor ratio (only when `options.benchmark` is supplied).
unitless by name
Optional
No @default declared; consult the signature and description.
performance.warnings
QuantWarning[]
Diagnostics — e.g. `performance.suspicious_equity_input` when an equity curve looks like returns.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
points
import('@insiderfinance/totalfinance/backtest').EquityPoint[]
The equity curve as an explicit `(ts, equity)` series (length = number of bars + 1). `points[0]` is the opening capital stamped at the first bar's timestamp; see {@link EquityPoint}.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
returns
number[]
Per-bar simple returns of the equity curve.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
settlements
import('@insiderfinance/totalfinance/backtest').OptionSettlement[]
Option positions settled at expiry (exercise / assignment / worthless), if any.
unitless by name
Optional
No @default declared; consult the signature and description.
testRange
[number, number]
`[firstTestBarTs, lastTestBarTs]`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
trades
import('@insiderfinance/totalfinance/backtest').Trade[]
Every filled trade, in order.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
trainRange
[number, number]
`[firstTrainBarTs, lastTrainBarTs]`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
turnover
number
Sum of |traded notional| ÷ average equity — a turnover proxy.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

WeightContext

What a supplied-weights callback sees.

/** What a supplied-weights callback sees. */
export interface WeightContext {
    asOf: EpochMs;
    sessionDate: string;
    long: readonly SignalRow[];
    short: readonly SignalRow[];
    /** Trailing per-session returns per selected name, oldest first (as many as available). */
    trailingReturns: Readonly<Record<string, readonly number[]>>;
}
Fields, parameters & returned members (5)
Name / typeMeaning & unitOptional / default
asOf
number

an instant: epoch milliseconds or a YYYY-MM-DD / zoned ISO string (the resolveAsOf convention)
Required / declared member
No @default declared; consult the signature and description.
long
readonly SignalRow[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
sessionDate
string

calendar date (YYYY-MM-DD)
Required / declared member
No @default declared; consult the signature and description.
short
readonly SignalRow[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
trailingReturns
Readonly<Record<string, readonly number[]>>
Trailing per-session returns per selected name, oldest first (as many as available).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

type

WeightingMethod

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export type WeightingMethod = 'equal-weight' | 'score-weight' | 'inverse-volatility' | 'risk-budget' | 'supplied-weights';
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

value

agentBaselines

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export declare const agentBaselines: Readonly<{ holdCash: () => BaselinePolicy; buyAndHold: (input?: { weights?: Readonly<Record<string, number>>; }) => BaselinePolicy; periodicRebalance: (input: { everySessions: number; weights?: Readonly<Record<string, number>>; }) => BaselinePolicy; randomValidAction: (seed: number) => BaselinePolicy; riskParity: (input: { lookback: number; everySessions?: number; }) => BaselinePolicy; momentumCrossover: (input: { fast: number; slow: number; }) => BaselinePolicy; }>;
Fields, parameters & returned members (66)
Name / typeMeaning & unitOptional / default
buyAndHold
(input?: { weights?: Readonly<Record<string, number>>; }) => BaselinePolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
buyAndHold().return.decide
TradingPolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
buyAndHold().return.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
buyAndHold().return.requires
FeatureRecipes | null
Feature recipes the policy reads; merged into every definition the bench runs it on.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
buyAndHold().return.requires.drawdown
boolean
1 − close ÷ running peak close, per instrument.
unitless by name
Optional
No @default declared; consult the signature and description.
buyAndHold().return.requires.lookbackReturns
readonly number[]
Close-to-close returns over each lookback in bars.
unitless by name
Optional
No @default declared; consult the signature and description.
buyAndHold().return.requires.realizedVolatility
{ annualization: number; lookbacks: readonly number[]; }
Standard deviation of log returns over each lookback in bars, scaled by √annualization — the bars per year (252 daily, 52 weekly, 12 monthly) or `1` for the per-bar σ. Required: the environment never assumes the bar frequency.
unitless by name
Optional
No @default declared; consult the signature and description.
buyAndHold().return.requires.realizedVolatility.annualization
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
buyAndHold().return.requires.realizedVolatility.lookbacks
readonly number[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
buyAndHold(input)
{ weights?: Readonly<Record<string, number>>; } | undefined

unitless by name
Optional
No @default declared; consult the signature and description.
buyAndHold(input).weights
Readonly<Record<string, number>>

unitless by name
Optional
No @default declared; consult the signature and description.
holdCash
() => BaselinePolicy

currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
holdCash().return.decide
TradingPolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
holdCash().return.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
holdCash().return.requires
FeatureRecipes | null
Feature recipes the policy reads; merged into every definition the bench runs it on.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
holdCash().return.requires.drawdown
boolean
1 − close ÷ running peak close, per instrument.
unitless by name
Optional
No @default declared; consult the signature and description.
holdCash().return.requires.lookbackReturns
readonly number[]
Close-to-close returns over each lookback in bars.
unitless by name
Optional
No @default declared; consult the signature and description.
holdCash().return.requires.realizedVolatility
{ annualization: number; lookbacks: readonly number[]; }
Standard deviation of log returns over each lookback in bars, scaled by √annualization — the bars per year (252 daily, 52 weekly, 12 monthly) or `1` for the per-bar σ. Required: the environment never assumes the bar frequency.
unitless by name
Optional
No @default declared; consult the signature and description.
holdCash().return.requires.realizedVolatility.annualization
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
holdCash().return.requires.realizedVolatility.lookbacks
readonly number[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
momentumCrossover
(input: { fast: number; slow: number; }) => BaselinePolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
momentumCrossover().return.decide
TradingPolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
momentumCrossover().return.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
momentumCrossover().return.requires
FeatureRecipes | null
Feature recipes the policy reads; merged into every definition the bench runs it on.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
momentumCrossover().return.requires.drawdown
boolean
1 − close ÷ running peak close, per instrument.
unitless by name
Optional
No @default declared; consult the signature and description.
momentumCrossover().return.requires.lookbackReturns
readonly number[]
Close-to-close returns over each lookback in bars.
unitless by name
Optional
No @default declared; consult the signature and description.
momentumCrossover().return.requires.realizedVolatility
{ annualization: number; lookbacks: readonly number[]; }
Standard deviation of log returns over each lookback in bars, scaled by √annualization — the bars per year (252 daily, 52 weekly, 12 monthly) or `1` for the per-bar σ. Required: the environment never assumes the bar frequency.
unitless by name
Optional
No @default declared; consult the signature and description.
momentumCrossover().return.requires.realizedVolatility.annualization
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
momentumCrossover().return.requires.realizedVolatility.lookbacks
readonly number[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
momentumCrossover(input)
{ fast: number; slow: number; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
momentumCrossover(input).fast
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
momentumCrossover(input).slow
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
periodicRebalance
(input: { everySessions: number; weights?: Readonly<Record<string, number>>; }) => BaselinePolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
periodicRebalance().return.decide
TradingPolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
periodicRebalance().return.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
periodicRebalance().return.requires
FeatureRecipes | null
Feature recipes the policy reads; merged into every definition the bench runs it on.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
periodicRebalance().return.requires.drawdown
boolean
1 − close ÷ running peak close, per instrument.
unitless by name
Optional
No @default declared; consult the signature and description.
periodicRebalance().return.requires.lookbackReturns
readonly number[]
Close-to-close returns over each lookback in bars.
unitless by name
Optional
No @default declared; consult the signature and description.
periodicRebalance().return.requires.realizedVolatility
{ annualization: number; lookbacks: readonly number[]; }
Standard deviation of log returns over each lookback in bars, scaled by √annualization — the bars per year (252 daily, 52 weekly, 12 monthly) or `1` for the per-bar σ. Required: the environment never assumes the bar frequency.
unitless by name
Optional
No @default declared; consult the signature and description.
periodicRebalance().return.requires.realizedVolatility.annualization
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
periodicRebalance().return.requires.realizedVolatility.lookbacks
readonly number[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
periodicRebalance(input)
{ everySessions: number; weights?: Readonly<Record<string, number>>; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
periodicRebalance(input).everySessions
number

trading sessions
Required / declared member
No @default declared; consult the signature and description.
periodicRebalance(input).weights
Readonly<Record<string, number>>

unitless by name
Optional
No @default declared; consult the signature and description.
randomValidAction
(seed: number) => BaselinePolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
randomValidAction().return.decide
TradingPolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
randomValidAction().return.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
randomValidAction().return.requires
FeatureRecipes | null
Feature recipes the policy reads; merged into every definition the bench runs it on.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
randomValidAction().return.requires.drawdown
boolean
1 − close ÷ running peak close, per instrument.
unitless by name
Optional
No @default declared; consult the signature and description.
randomValidAction().return.requires.lookbackReturns
readonly number[]
Close-to-close returns over each lookback in bars.
unitless by name
Optional
No @default declared; consult the signature and description.
randomValidAction().return.requires.realizedVolatility
{ annualization: number; lookbacks: readonly number[]; }
Standard deviation of log returns over each lookback in bars, scaled by √annualization — the bars per year (252 daily, 52 weekly, 12 monthly) or `1` for the per-bar σ. Required: the environment never assumes the bar frequency.
unitless by name
Optional
No @default declared; consult the signature and description.
randomValidAction().return.requires.realizedVolatility.annualization
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
randomValidAction().return.requires.realizedVolatility.lookbacks
readonly number[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
randomValidAction(seed)
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
riskParity
(input: { lookback: number; everySessions?: number; }) => BaselinePolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
riskParity().return.decide
TradingPolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
riskParity().return.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
riskParity().return.requires
FeatureRecipes | null
Feature recipes the policy reads; merged into every definition the bench runs it on.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
riskParity().return.requires.drawdown
boolean
1 − close ÷ running peak close, per instrument.
unitless by name
Optional
No @default declared; consult the signature and description.
riskParity().return.requires.lookbackReturns
readonly number[]
Close-to-close returns over each lookback in bars.
unitless by name
Optional
No @default declared; consult the signature and description.
riskParity().return.requires.realizedVolatility
{ annualization: number; lookbacks: readonly number[]; }
Standard deviation of log returns over each lookback in bars, scaled by √annualization — the bars per year (252 daily, 52 weekly, 12 monthly) or `1` for the per-bar σ. Required: the environment never assumes the bar frequency.
unitless by name
Optional
No @default declared; consult the signature and description.
riskParity().return.requires.realizedVolatility.annualization
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
riskParity().return.requires.realizedVolatility.lookbacks
readonly number[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
riskParity(input)
{ everySessions?: number; lookback: number; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
riskParity(input).everySessions
number

trading sessions
Optional
No @default declared; consult the signature and description.
riskParity(input).lookback
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

function

attribution

Per-symbol realized P&L attribution (average-cost matched) from a trade blotter (report-shaped).

export declare function attribution(trades: Trade[]): AttributionReport;
Fields, parameters & returned members (6)
Name / typeMeaning & unitOptional / default
(trades)
Trade[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions
{ [k: string]: unknown; conventionsVersion: string; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions.conventionsVersion
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.bySymbol
SymbolAttribution[]
Realized P&L per symbol (average-cost matched), in first-trade order.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.diagnostics
{ warnings: QuantWarning[]; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.diagnostics.warnings
QuantWarning[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

value

borrow

Borrow-fee models for shorts.

export declare const borrow: { readonly annualRate: (annualRate: number) => BorrowModel; readonly none: () => BorrowModel; };
Fields, parameters & returned members (7)
Name / typeMeaning & unitOptional / default
annualRate
(annualRate: number) => BorrowModel
A flat annualized borrow rate charged on the short market value.
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
annualRate().return.annualRate
number
Annualized borrow rate (decimal, e.g. `0.005` = 50 bps/yr).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
annualRate().return.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
annualRate(annualRate)
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
none
() => BorrowModel
No borrow fee.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
none().return.annualRate
number
Annualized borrow rate (decimal, e.g. `0.005` = 50 bps/yr).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
none().return.label
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

value

brokers

Broker factory (spec §16.2: `brokers.simulated({ cash, commission, slippage })`).

export declare const brokers: { readonly simulated: (config: BrokerConfig) => SimulatedBroker; };
Fields, parameters & returned members (28)
Name / typeMeaning & unitOptional / default
simulated
(config: BrokerConfig) => SimulatedBroker
Construct a simulated broker.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated().return.cancel
(id: string) => void
Cancel a pending order (and its OCO group).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated().return.cash
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated().return.equity
(marks: Map<SymbolId, number>) => number
Portfolio equity = cash + Σ position market value at the supplied marks (option positions ×multiplier).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated().return.exerciseOption
(input: ExerciseOptionInput) => OptionSettlement
Manually exercise a LONG American option early (WS7.4) — the `context.exercise` hook. `quantity` is the number of contracts (≤ the current long position). Requires the `assignment: 'model'` policy.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated().return.orders
readonly Order[]
All orders ever submitted (live view, readonly).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated().return.policies
() => { cost: string; slippage: string; margin: string; assignment: string; oco: string; }
The policy labels for the implementation-risk diagnostics.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated().return.position
(symbol: SymbolId) => Position

unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated().return.positions
Map<string, Position>

unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated().return.processBar
(bar: Bar, action?: CorporateAction) => Trade[]
Advance the broker by one bar: apply corporate actions, accrue borrow on shorts, then try to fill every working order for this bar's symbol. Returns this bar's fills.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated().return.registerOption
(symbol: SymbolId, specification: OptionContractSpecification) => void
Register an option symbol so the broker marks it by its contract multiplier and settles it at expiry (spec §16.2). Required before trading or settling an option position.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated().return.settleExpiries
(asOfTimestampMs: EpochMs, underlierMarks?: Map<SymbolId, number>) => OptionSettlement[]
Settle every registered option whose expiry is at or before `asOfTimestampMs`. ITM long positions are exercised and ITM shorts assigned (physical: the underlier position is adjusted at the strike; cash: the intrinsic is paid/received); OTM positions expire worthless. Returns the new settlements. The underlier settlement price comes from `underlierMarks` or the broker's last seen mark.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated().return.settlements
readonly OptionSettlement[]
Option positions settled at expiry — exercise / assignment / worthless (live view, readonly).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated().return.submit
(request: OrderRequest) => string
Submit an order; returns its id. Validates the request.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated().return.trades
readonly Trade[]
All fills (live view, readonly).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated().return.warnings
readonly QuantWarning[]
Structured warnings raised during simulation (live view, readonly).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated(config)
BrokerConfig

unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated(config).assignment
'none' | 'model'
American early exercise/assignment policy (WS7.4). `'none'` (default) settles options only at expiry — every European-style golden is byte-identical. `'model'` options in to modeling early assignment of American short options at ex-dividend dates (short calls) and deep-ITM thresholds (short puts), plus manual `exerciseOption`/`context.exercise` for American longs.
unitless by name
Optional
No @default declared; consult the signature and description.
simulated(config).assignmentThreshold
number
Short-put early-assignment buffer as a FRACTION of strike (default `0.02`): a short put is assigned early when the interest CARRY benefit of exercising now exceeds the remaining extrinsic (time value) by more than `threshold·strike`. Only used when `assignment: 'model'`.
unitless by name
Optional
No @default declared; consult the signature and description.
simulated(config).borrow
BorrowModel

unitless by name
Optional
No @default declared; consult the signature and description.
simulated(config).cash
number
Opening cash.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
simulated(config).commission
CostModel

unitless by name
Optional
No @default declared; consult the signature and description.
simulated(config).maxLeverage
number
Max gross leverage `Σ|positionNotional| / equity` allowed at fill (default `Infinity`).
unitless by name
Optional
No @default declared; consult the signature and description.
simulated(config).maxVolumeParticipation
number
Cap a single bar's fill to this fraction of bar volume (partial fills); default `Infinity`.
unitless by name
Optional
No @default declared; consult the signature and description.
simulated(config).noShort
boolean
Disallow short positions (default `false`).
unitless by name
Optional
No @default declared; consult the signature and description.
simulated(config).periodsPerYear
number
Bars per year, for borrow accrual (default 252).
per year (count)
Optional
No @default declared; consult the signature and description.
simulated(config).riskFreeRate
number
Continuously-compounded risk-free rate (decimal, default `0`) used ONLY for the short-put early-assignment carry economics — early put exercise is driven by the interest earned on the strike over the option's remaining life. With rate `0` there is no carry incentive, so a short put is never assigned early on arbitrage-free prices. Only used when `assignment: 'model'`.
decimal rate (0.05 = 5%)
Optional
No @default declared; consult the signature and description.
simulated(config).slippage
SlippageModel

unitless by name
Optional
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

function

checkDataAlignment

Check that each symbol's bars are strictly time-ascending with finite positive prices. Returns structured warnings for out-of-order timestamps, duplicate timestamps, and non-finite/non-positive closes — the silent corruptions that make a backtest quietly wrong.

export declare function checkDataAlignment(bars: Bar[]): QuantWarning[];
Fields, parameters & returned members (1)
Name / typeMeaning & unitOptional / default
(bars)
Bar[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

function

createPortfolioStepper

The engine's seam (Stage 7B.1, Decision 2): the same per-instant loop `portfolioBacktest` runs, driven from outside. `open(index)` stamps the clock, folds pre-open entitlements and external flows, and returns a pre-execution context valued at opening or last-completed marks (the mark source identifies carried prices). `close(index, orders)` executes the caller's orders through the execution policy, settles close-derived derivative lifecycle, runs the margin check, records the valuation mark and the equity, and returns the rows the step appended; `finish()` assembles the same result `portfolioBacktest` returns over the instants closed so far. Calls must alternate `open(0)`, `close(0)`, `open(1)`, … — an out-of-order call refuses and changes nothing; `finish()` may be called again and returns the same result. The orders come from the caller, so the result records `strategy: { kind: 'external', replayable: false }`; a trading environment saves its own action trace to make an episode replayable.

export declare function createPortfolioStepper(request: PortfolioStepperRequest): PortfolioStepper;
Fields, parameters & returned members (19)
Name / typeMeaning & unitOptional / default
(request)
PortfolioStepperRequest

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(request).accounting
import('@insiderfinance/totalfinance/backtest/portfolio').AccountingPolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(request).calendar
string
A calendar name (`'NYSE'`, `'CBOE'`, `'ALWAYS_OPEN'`): sessions and settlement days.
unitless by name
Optional
No @default declared; consult the signature and description.
(request).execution
ExecutionPolicy

unitless by name
Optional
No @default declared; consult the signature and description.
(request).externalFlows
readonly import('@insiderfinance/totalfinance/backtest/portfolio').ExternalFlowRecord[]

unitless by name
Optional
No @default declared; consult the signature and description.
(request).instruments
Readonly<Record<string, InstrumentSpecification>>

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(request).marketData
import('@insiderfinance/totalfinance/backtest/portfolio').PortfolioMarketData

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(request).periodsPerYear
number

per year (count)
Optional
No @default declared; consult the signature and description.
(request).seed
number
Seeds only the bootstrap confidence intervals.
unitless by name
Optional
No @default declared; consult the signature and description.
(request).window
{ fromTimestampMs?: EpochMs; toTimestampMs?: EpochMs; }

unitless by name
Optional
No @default declared; consult the signature and description.
(request).window.fromTimestampMs
number

epoch milliseconds (UTC instant)
Optional
No @default declared; consult the signature and description.
(request).window.toTimestampMs
number

epoch milliseconds (UTC instant)
Optional
No @default declared; consult the signature and description.
return.close
(index: number, orders: readonly OrderIntent[]) => PortfolioStepFrame
The orders through the execution policy, the margin check, the valuation mark, the equity.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.context
() => SessionContext
The session context at the last closed instant — the state after its orders, margin, and mark.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.finish
() => PortfolioBacktestResult
The same result `portfolioBacktest` returns, over the instants closed so far.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.instants
readonly number[]
The decision instants, ascending — the same instants `portfolioBacktest` would step.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.open
(index: number) => SessionContext
Lifecycle facts and external flows due at the instant, then the session context.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.runId
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.valuation
() => PortfolioValuationInputs
The ledger state, the market snapshot, the conversions, and the valued snapshot at the last closed instant.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

function

createTradingEnvironment

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export declare function createTradingEnvironment(definition: TradingEnvironmentDefinition): TradingEnvironment;
Fields, parameters & returned members (21)
Name / typeMeaning & unitOptional / default
(definition)
TradingEnvironmentDefinition

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(definition).accounting
import('@insiderfinance/totalfinance/backtest/portfolio').AccountingPolicy

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(definition).calendar
string
A calendar name (`'NYSE'`, `'CBOE'`, `'ALWAYS_OPEN'`): sessions and settlement days.
unitless by name
Optional
No @default declared; consult the signature and description.
(definition).execution
ExecutionPolicy

unitless by name
Optional
No @default declared; consult the signature and description.
(definition).externalFlows
readonly import('@insiderfinance/totalfinance/backtest/portfolio').ExternalFlowRecord[]

unitless by name
Optional
No @default declared; consult the signature and description.
(definition).features
import('@insiderfinance/totalfinance/backtest/environment').FeatureRecipes

unitless by name
Optional
No @default declared; consult the signature and description.
(definition).instruments
Readonly<Record<string, import('@insiderfinance/totalfinance/backtest').InstrumentSpecification>>

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(definition).limits
import('@insiderfinance/totalfinance/backtest/environment').EnvironmentLimits

unitless by name
Optional
No @default declared; consult the signature and description.
(definition).marketData
import('@insiderfinance/totalfinance/backtest/portfolio').PortfolioMarketData

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(definition).maximumSteps
number
The most steps an episode takes before `truncated` (default: the instant count; ceiling 100,000).
unitless by name
Optional
No @default declared; consult the signature and description.
(definition).periodsPerYear
number

per year (count)
Optional
No @default declared; consult the signature and description.
(definition).reward
import('@insiderfinance/totalfinance/backtest/environment').RewardComposition

unitless by name
Optional
No @default declared; consult the signature and description.
(definition).seed
number
Seeds only the bootstrap confidence intervals.
unitless by name
Optional
No @default declared; consult the signature and description.
(definition).window
{ fromTimestampMs?: EpochMs; toTimestampMs?: EpochMs; }

unitless by name
Optional
No @default declared; consult the signature and description.
(definition).window.fromTimestampMs
number

epoch milliseconds (UTC instant)
Optional
No @default declared; consult the signature and description.
(definition).window.toTimestampMs
number

epoch milliseconds (UTC instant)
Optional
No @default declared; consult the signature and description.
return.definitionHash
string
The definition's identity, seed excluded.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.finish
() => PortfolioBacktestResult
The engine's own result over the episode so far — the same shape `portfolioBacktest` returns; ends the episode.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.instantCount
number
The decision instants an episode steps through.
count (integer)
Required / declared member
No @default declared; consult the signature and description.
return.reset
(options?: EnvironmentResetOptions) => EnvironmentResetResult

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.step
(action: EnvironmentAction) => EnvironmentStepResult

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

function

crossOver

True when series `a` crosses from at-or-below `b` to above it on the latest bar.

export declare function crossOver(first: IndicatorHandle<number>, second: IndicatorHandle<number>): boolean;
Fields, parameters & returned members (6)
Name / typeMeaning & unitOptional / default
(first)
IndicatorHandle<number>

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(first).previous
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(first).value
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(second)
IndicatorHandle<number>

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(second).previous
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(second).value
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

function

crossOverSeries

`1` on the bar where `a` crosses from at-or-below `b` to above it (`a[i-1] ≤ b[i-1] && a[i] > b[i]`), else `0`. `NaN` where any of the four inputs (`a`/`b` at `i` or `i-1`) is `NaN`, and at index `0` — a crossing needs a prior bar to compare against. `b` may be a scalar level or an aligned series.

export declare function crossOverSeries(first: ArrayLike<number>, second: number | ArrayLike<number>): Float64Array;
Fields, parameters & returned members (2)
Name / typeMeaning & unitOptional / default
(first)
ArrayLike<number>

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(second)
number | ArrayLike<number>

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

function

crossSectionalBacktest

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export declare function crossSectionalBacktest(request: CrossSectionalBacktestRequest): CrossSectionalBacktestResult;
Fields, parameters & returned members (46)
Name / typeMeaning & unitOptional / default
(request)
CrossSectionalBacktestRequest

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(request).baseCurrency
string
Default `'USD'`.
ISO-4217 currency code
Optional
No @default declared; consult the signature and description.
(request).dataset
import('@insiderfinance/totalfinance/backtest').CrossSectionalDataset

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(request).execution
ExecutionPolicy
Decision 7's policy; omitted = `execution.simplified()`, and the result says so.
unitless by name
Optional
No @default declared; consult the signature and description.
(request).initialCapital
number
Default 1,000,000 in `baseCurrency`.
unitless by name
Optional
No @default declared; consult the signature and description.
(request).periodsPerYear
number
Default 252.
per year (count)
Optional
No @default declared; consult the signature and description.
(request).portfolioConstruction
import('@insiderfinance/totalfinance/backtest').PortfolioConstruction

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(request).rebalanceSchedule
import('@insiderfinance/totalfinance/backtest').RebalanceSchedule

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(request).riskFreeRate
number

decimal rate (0.05 = 5%)
Optional
No @default declared; consult the signature and description.
(request).seed
number
Seeds the bootstrap confidence intervals of the performance block; absent = none.
unitless by name
Optional
No @default declared; consult the signature and description.
(request).signal
import('@insiderfinance/totalfinance/backtest').CrossSectionalSignal

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(request).transactionCostModel
{ commission?: CostModel; slippage?: SlippageModel; }
Cost models applied to every fill; omitted = the policy's (none for the simplified policy).
unitless by name
Optional
No @default declared; consult the signature and description.
(request).transactionCostModel.commission
CostModel

unitless by name
Optional
No @default declared; consult the signature and description.
(request).transactionCostModel.slippage
SlippageModel

unitless by name
Optional
No @default declared; consult the signature and description.
(request).universeHistory
import('@insiderfinance/totalfinance/research').UniverseHistory

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(request).window
{ fromTimestampMs?: EpochMs; toTimestampMs?: EpochMs; }
Restrict the run to sessions inside the window (inclusive instants).
unitless by name
Optional
No @default declared; consult the signature and description.
(request).window.fromTimestampMs
number

epoch milliseconds (UTC instant)
Optional
No @default declared; consult the signature and description.
(request).window.toTimestampMs
number

epoch milliseconds (UTC instant)
Optional
No @default declared; consult the signature and description.
return.assumptions
CrossSectionalAssumptions

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.attribution
import('@insiderfinance/totalfinance/backtest').CrossSectionalAttribution

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.benchmark
BenchmarkComparison | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.benchmark.activeReturn
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.benchmark.alpha
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.benchmark.beta
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.benchmark.informationRatio
number | null

decimal fraction / multiple
Required / declared member
No @default declared; consult the signature and description.
return.benchmark.instrumentId
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.benchmark.returns
number[]
The benchmark's per-session simple returns aligned to the run's sessions.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.benchmark.trackingError
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.diagnostics
CrossSectionalDiagnostics

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.fills
NormalizedFill[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.finalValue
number

currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
return.holdings
HoldingRow[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.ledger
import('@insiderfinance/totalfinance/portfolio').PortfolioLedgerSnapshot

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.performance
import('@insiderfinance/totalfinance/performance').PerformanceSummary

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.performanceConfidence
{ confidenceInterval95: [number, number]; iterations: number; meanTotalReturn: number; seed: number; standardDeviation: number; } | null
Bootstrap confidence intervals of the performance block when a seed was given.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.performanceConfidence.confidenceInterval95
[number, number]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.performanceConfidence.iterations
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.performanceConfidence.meanTotalReturn
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.performanceConfidence.seed
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.performanceConfidence.standardDeviation
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.points
EquityPoint[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.rebalances
RebalanceRow[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.returns
number[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.runId
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.timeline
import('@insiderfinance/totalfinance/portfolio').PortfolioTimelineResult

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.trades
Trade[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.