Skip to content
TotalFinance

Backtesting · @insiderfinance/totalfinance

@insiderfinance/totalfinance/backtest

import { … } from '@insiderfinance/totalfinance/backtest'
stable-by-law (pre-1.0; not a 1.0 stability guarantee)iface 82const 6type 15class 1fn 28JSON ↗

Functions · 28

Values & facades · 6

Classes · 1

Interfaces · 82

Types · 15

iface

AgentBenchReport

#

Operational conformance and strategy quality, reported separately — no single score by design.

Signature
import type { AgentBenchReport } from '@insiderfinance/totalfinance/backtest';

/** Operational conformance and strategy quality, reported separately — no single score by design. */
export interface AgentBenchReport {
    policy: string;
    episodes: AgentBenchEpisodeReport[];
    /** One recorded episode per run, in the order of `episodes`. */
    traces: AgentBenchTrace[];
    operational: {
        passes: boolean;
        failing: string[];
        lookAhead: number;
        duplicateOrders: number;
        maskViolations: number;
        limitBreaches: number;
        externalOrderAttempts: 0;
    };
    strategy: {
        meanTotalReturn: number | null;
        meanSharpe: number | null;
        meanMaxDrawdown: number | null;
        meanTurnover: number | null;
        meanCost: number | null;
        meanGrossExposure: number | null;
        violations: number;
    };
    assumptions: {
        episodes: string[];
        seeds: number[];
        runs: number;
        dimensions: string;
        leakageProbe: string;
        retrySuite: string;
    };
    diagnostics: Diagnostics;
}
Fields, parameters and returned members (44)

Loading 44 members…

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

AgentTranscriptScore

#

Public declaration. Read the signature and member contracts below; no additional behaviour is inferred.

Signature
import type { AgentTranscriptScore } from '@insiderfinance/totalfinance/backtest';

export interface AgentTranscriptScore {
    operationSelection: number;
    firstAttemptValidity: number | null;
    recovery: number | null;
    argumentValidity: number | null;
    parity: boolean | null;
    refusal: boolean | null;
    traceability: number | null;
    calls: number;
    bytes: number;
    withinBudget: boolean | null;
    passes: boolean;
    assumptions: {
        deterministic: true;
        scoring: string;
    };
    diagnostics: Diagnostics;
}
Fields, parameters and returned members (32)

Loading 32 members…

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

AttributionReport

#

attribution as a report: per-symbol rows carrying assumptions + diagnostics inline.

Signature
import type { AttributionReport } from '@insiderfinance/totalfinance/backtest';

/** {@link attribution} as a report: per-symbol rows carrying `assumptions` + `diagnostics` inline. */
export interface AttributionReport {
    /** Realized P&L per symbol (average-cost matched), in first-trade order. */
    bySymbol: SymbolAttribution[];
    assumptions: {
        conventionsVersion: string;
        [k: string]: unknown;
    };
    diagnostics: {
        warnings: QuantWarning[];
    };
}
Fields, parameters and returned members (5)
Name · typeMeaning · unitRequired · default
assumptions{ [k: string]: unknown; conventionsVersion: string; }—unitless by nameRequiredNo @default declared
assumptions.conventionsVersionstring—unitless by nameRequiredNo @default declared
bySymbolSymbolAttribution[]

Realized P&L per symbol (average-cost matched), in first-trade order.

unitless by name
RequiredNo @default declared
diagnostics{ warnings: QuantWarning[]; }—unitless by nameRequiredNo @default declared
diagnostics.warningsQuantWarning[]—unitless by nameRequiredNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

AttributionRow

#

Public declaration. Read the signature and member contracts below; no additional behaviour is inferred.

Signature
import type { AttributionRow } from '@insiderfinance/totalfinance/backtest';

export interface AttributionRow {
    rebalanceIndex: number;
    sessionDate: string;
    /** Pearson IC of the signal against the next-period return; null when unmeasurable. */
    informationCoefficient: number | null;
    rankInformationCoefficient: number | null;
    /** Long-leg minus short-leg mean next-period return of the signal's quantiles. */
    spreadReturn: number | null;
    /** Fraction of this rebalance's selection not present in the previous one. */
    selectionTurnover: number | null;
    breadth: number;
    coverage: number;
}
Fields, parameters and returned members (8)
Name · typeMeaning · unitRequired · default
breadthnumber—unitless by nameRequiredNo @default declared
coveragenumber—unitless by nameRequiredNo @default declared
informationCoefficientnumber | null

Pearson IC of the signal against the next-period return; null when unmeasurable.

unitless by name
RequiredNo @default declared
rankInformationCoefficientnumber | null—unitless by nameRequiredNo @default declared
rebalanceIndexnumber—count (integer)RequiredNo @default declared
selectionTurnovernumber | null

Fraction of this rebalance's selection not present in the previous one.

unitless by name
RequiredNo @default declared
sessionDatestring—calendar date (YYYY-MM-DD)RequiredNo @default declared
spreadReturnnumber | null

Long-leg minus short-leg mean next-period return of the signal's quantiles.

unitless by name
RequiredNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

const

BENCHMARK_FIXTURE_VERSION

#

Version tag of the golden benchmark fixtures the engines are validated against (spec §16.3).

Signature
import { BENCHMARK_FIXTURE_VERSION } from '@insiderfinance/totalfinance/backtest';

export declare const BENCHMARK_FIXTURE_VERSION: '0.0.1';

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

BacktestAssumptions

#

The modelling assumptions a backtest makes, echoed on every result's assumptions slot so they are never hidden (spec §16.3 / dx §2.5). Each policy is a short, stable, machine-readable label.

Signature
import type { BacktestAssumptions } from '@insiderfinance/totalfinance/backtest';

/**
 * The modelling assumptions a backtest makes, echoed on every result's `assumptions` slot so they are
 * never hidden (spec §16.3 / dx §2.5). Each policy is a short, stable, machine-readable label.
 */
export interface BacktestAssumptions {
    /** Version of the library's default conventions (core `CONVENTIONS_VERSION`). */
    conventionsVersion: string;
    /** Opening capital the run started from. */
    initialCapital: number;
    /** When/at what price orders fill, e.g. `next-open`, `close`, `trigger-price`. */
    fill: string;
    /** Commission model applied, e.g. `bps(1)`, `per-share(0.005)`, `none`. */
    cost: string;
    /** Slippage model applied, e.g. `bps(2)`, `spread`, `none`. */
    slippage: string;
    /** Cash settlement assumption, e.g. `immediate` (T+0). */
    cashSettlement: string;
    /** Corporate-action handling, e.g. `dividends-as-cash`, `splits-adjusted`, `none`. */
    corporateAction: string;
    /** Rebalancing/trading calendar, e.g. `every-bar`, `monthly`, `signal-driven`. */
    calendar: string;
    /** Leverage/margin regime: `unconstrained` (no cap; unfunded fills allowed) or `maxLeverage`. */
    margin: string;
    /** American early exercise/assignment policy: `model` or `none` (WS7.4). Absent where inapplicable. */
    assignment?: 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).
     */
    oco?: string;
}
Fields, parameters and returned members (11)
Name · typeMeaning · unitRequired · default
assignmentstring

American early exercise/assignment policy: model or none (WS7.4). Absent where inapplicable.

unitless by name
OptionalNo @default declared
calendarstring

Rebalancing/trading calendar, e.g. every-bar, monthly, signal-driven.

unitless by name
RequiredNo @default declared
cashSettlementstring

Cash settlement assumption, e.g. immediate (T+0).

unitless by name
RequiredNo @default declared
conventionsVersionstring

Version of the library's default conventions (core CONVENTIONS_VERSION).

unitless by name
RequiredNo @default declared
corporateActionstring

Corporate-action handling, e.g. dividends-as-cash, splits-adjusted, none.

unitless by name
RequiredNo @default declared
coststring

Commission model applied, e.g. bps(1), per-share(0.005), none.

unitless by name
RequiredNo @default declared
fillstring

When/at what price orders fill, e.g. next-open, close, trigger-price.

unitless by name
RequiredNo @default declared
initialCapitalnumber

Opening capital the run started from.

unitless by name
RequiredNo @default declared
marginstring

Leverage/margin regime: unconstrained (no cap; unfunded fills allowed) or maxLeverage.

unitless by name
RequiredNo @default declared
ocostring

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
OptionalNo @default declared
slippagestring

Slippage model applied, e.g. bps(2), spread, none.

unitless by name
RequiredNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

BacktestResult

#

The common result shape returned by both engines.

Signature
import type { BacktestResult } from '@insiderfinance/totalfinance/backtest';

/** The common result shape returned by both engines. */
export interface BacktestResult {
    /**
     * 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}.
     */
    points: EquityPoint[];
    /** Per-bar simple returns of the equity curve. */
    returns: number[];
    /** Every filled trade, in order. */
    trades: Trade[];
    /** Final portfolio value. */
    finalValue: number;
    /** Sum of |traded notional| ÷ average equity — a turnover proxy. */
    turnover: number;
    /** Performance metrics of the equity curve (`@insiderfinance/totalfinance/performance`). */
    performance: PerformanceSummary;
    /** The modelling assumptions this run made — capital, fills, costs, calendar, margin (dx §2.5). */
    assumptions: BacktestAssumptions;
    /** Implementation-risk diagnostics: warnings + benchmark fixture version (spec §16.3). */
    diagnostics: ImplementationRisk;
    /** Option positions settled at expiry (exercise / assignment / worthless), if any. */
    settlements?: OptionSettlement[];
}
Fields, parameters and returned members (66)

Loading 66 members…

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

Bar

#

Public declaration. Read the signature and member contracts below; no additional behaviour is inferred.

Signature
import type { Bar } from '@insiderfinance/totalfinance/backtest';

export interface Bar {
    symbol: SymbolId;
    timestampMs: EpochMs;
    open: number;
    high: number;
    low: number;
    close: number;
    volume?: number;
    vwap?: number;
    adjusted?: boolean;
}
Fields, parameters and returned members (9)
Name · typeMeaning · unitRequired · default
adjustedboolean—unitless by nameOptionalNo @default declared
closenumber—unitless by nameRequiredNo @default declared
highnumber—unitless by nameRequiredNo @default declared
lownumber—unitless by nameRequiredNo @default declared
opennumber—unitless by nameRequiredNo @default declared
symbolstring—unitless by nameRequiredNo @default declared
timestampMsnumber—millisecondsRequiredNo @default declared
volumenumber—unitless by nameOptionalNo @default declared
vwapnumber—unitless by nameOptionalNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

type

BarField

#

Field of a bar to feed an indicator, or a custom extractor.

Signature
import type { BarField } from '@insiderfinance/totalfinance/backtest';

/** Field of a bar to feed an indicator, or a custom extractor. */
export type BarField = 'open' | 'high' | 'low' | 'close' | 'volume';

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

BenchmarkComparison

#

Public declaration. Read the signature and member contracts below; no additional behaviour is inferred.

Signature
import type { BenchmarkComparison } from '@insiderfinance/totalfinance/backtest';

export interface BenchmarkComparison {
    instrumentId: string;
    /** The benchmark's per-session simple returns aligned to the run's sessions. */
    returns: number[];
    activeReturn: number | null;
    trackingError: number | null;
    informationRatio: number | null;
    beta: number | null;
    alpha: number | null;
}
Fields, parameters and returned members (7)
Name · typeMeaning · unitRequired · default
activeReturnnumber | null—unitless by nameRequiredNo @default declared
alphanumber | null—unitless by nameRequiredNo @default declared
betanumber | null—unitless by nameRequiredNo @default declared
informationRationumber | null—decimal fraction / multipleRequiredNo @default declared
instrumentIdstring—unitless by nameRequiredNo @default declared
returnsnumber[]

The benchmark's per-session simple returns aligned to the run's sessions.

unitless by name
RequiredNo @default declared
trackingErrornumber | null—unitless by nameRequiredNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

BorrowModel

#

A borrow-fee model for short positions: an annualized financing rate on the short market value.

Signature
import type { BorrowModel } from '@insiderfinance/totalfinance/backtest';

/** A borrow-fee model for short positions: an annualized financing rate on the short market value. */
export interface BorrowModel {
    readonly label: string;
    /** Annualized borrow rate (decimal, e.g. `0.005` = 50 bps/yr). */
    readonly annualRate: number;
}
Fields, parameters and returned members (2)
Name · typeMeaning · unitRequired · default
annualRatenumber

Annualized borrow rate (decimal, e.g. 0.005 = 50 bps/yr).

decimal rate (0.05 = 5%)
RequiredNo @default declared
labelstring—unitless by nameRequiredNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

BrokerConfig

#

Public declaration. Read the signature and member contracts below; no additional behaviour is inferred.

Signature
import type { BrokerConfig } from '@insiderfinance/totalfinance/backtest';

export interface BrokerConfig {
    /** Opening cash. */
    cash: number;
    commission?: CostModel;
    slippage?: SlippageModel;
    borrow?: BorrowModel;
    /** Bars per year, for borrow accrual (default 252). */
    periodsPerYear?: number;
    /** Max gross leverage `Σ|positionNotional| / equity` allowed at fill (default `Infinity`). */
    maxLeverage?: number;
    /** Disallow short positions (default `false`). */
    noShort?: boolean;
    /** Cap a single bar's fill to this fraction of bar volume (partial fills); default `Infinity`. */
    maxVolumeParticipation?: number;
    /**
     * 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.
     */
    assignment?: 'model' | 'none';
    /**
     * 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'`.
     */
    assignmentThreshold?: 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'`.
     */
    riskFreeRate?: number;
}
Fields, parameters and returned members (24)

Loading 24 members…

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

CorporateAction

#

A corporate action effective on a bar.

Signature
import type { CorporateAction } from '@insiderfinance/totalfinance/backtest';

/** A corporate action effective on a bar. */
export interface CorporateAction {
    /** Cash dividend per share (long receives, short pays). */
    dividend?: number;
    /** Split ratio `R` (`2` = 2-for-1: quantities ×R, prices ÷R). */
    split?: number;
}
Fields, parameters and returned members (2)
Name · typeMeaning · unitRequired · default
dividendnumber

Cash dividend per share (long receives, short pays).

unitless by name
OptionalNo @default declared
splitnumber

Split ratio R (2 = 2-for-1: quantities ×R, prices ÷R).

unitless by name
OptionalNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

CostModel

#

Public declaration. Read the signature and member contracts below; no additional behaviour is inferred.

Signature
import type { CostModel } from '@insiderfinance/totalfinance/backtest';

export interface CostModel {
    readonly label: string;
    commission(input: CommissionInput): number;
}
Fields, parameters and returned members (5)
Name · typeMeaning · unitRequired · default
commission(input: CommissionInput) => number—unitless by nameRequiredNo @default declared
commission(input)CommissionInput—unitless by nameRequiredNo @default declared
commission(input).pricenumber—unitless by nameRequiredNo @default declared
commission(input).quantitynumber—unitless by nameRequiredNo @default declared
labelstring—unitless by nameRequiredNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

CrossSectionalAssumptions

#

Public declaration. Read the signature and member contracts below; no additional behaviour is inferred.

Signature
import type { CrossSectionalAssumptions } from '@insiderfinance/totalfinance/backtest';

export interface CrossSectionalAssumptions {
    conventionsVersion: string;
    universeId: string;
    signal: {
        kind: 'factor-recipe';
        recipeName: string;
        recipeVersion: number;
        direction: string;
        lagTradingSessions: number;
        neutralization: string;
    } | {
        kind: 'score';
        components: number;
        missingValuePolicy: string;
    } | {
        kind: 'screen';
        orderBy: string[];
        missingValuePolicy: string;
    } | {
        kind: 'callback';
        replayable: false;
    };
    rebalanceSchedule: {
        frequency: RebalanceFrequency;
        session: 'open' | 'close';
        bufferBand: number | null;
    };
    sessionInstantConvention: string;
    pricing: string;
    portfolioConstruction: {
        method: WeightingMethod;
        long: SideSelection;
        short: ShortSideSelection | null;
        neutrality: Neutrality;
        maximumPositions: number | null;
        maximumPositionWeight: number | null;
        minimumPositionWeight: number | null;
        maximumTurnover: number | null;
        maximumParticipation: number | null;
        volatilityLookbackSessions: number;
        shortBookSizing: string;
    };
    execution: ExecutionPolicyDescription;
    costs: {
        commission: string;
        slippage: string;
    };
    initialCapital: number;
    baseCurrency: string;
    periodsPerYear: number;
    riskFreeRate: number;
    seed: number | null;
    window: {
        fromTimestampMs: EpochMs | null;
        toTimestampMs: EpochMs | null;
    };
    ledger: {
        sourceId: string;
        accountId: string;
        lotRelief: string;
    };
    replayable: boolean;
}
Fields, parameters and returned members (87)

Loading 87 members…

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

CrossSectionalAttribution

#

Public declaration. Read the signature and member contracts below; no additional behaviour is inferred.

Signature
import type { CrossSectionalAttribution } from '@insiderfinance/totalfinance/backtest';

export interface CrossSectionalAttribution {
    perRebalance: AttributionRow[];
    /** Mean rank information coefficient per horizon (in rebalances), across rebalances. */
    decay: Array<{
        horizonRebalances: number;
        meanRankInformationCoefficient: number | null;
        samples: number;
    }>;
    meanInformationCoefficient: number | null;
    meanRankInformationCoefficient: number | null;
    meanSpreadReturn: number | null;
}
Fields, parameters and returned members (5)
Name · typeMeaning · unitRequired · default
decay{ horizonRebalances: number; meanRankInformationCoefficient: number | null; samples: number; }[]

Mean rank information coefficient per horizon (in rebalances), across rebalances.

unitless by name
RequiredNo @default declared
meanInformationCoefficientnumber | null—unitless by nameRequiredNo @default declared
meanRankInformationCoefficientnumber | null—unitless by nameRequiredNo @default declared
meanSpreadReturnnumber | null—unitless by nameRequiredNo @default declared
perRebalanceAttributionRow[]—unitless by nameRequiredNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

CrossSectionalBacktestGridRequest

#

Public declaration. Read the signature and member contracts below; no additional behaviour is inferred.

Signature
import type { CrossSectionalBacktestGridRequest } from '@insiderfinance/totalfinance/backtest';

export interface CrossSectionalBacktestGridRequest {
    /** The base request every variation is applied to; validated once, never mutated. */
    request: CrossSectionalBacktestRequest;
    /** The axes; the cartesian product is run with the last axis varying fastest. */
    variations: readonly GridVariation[];
    /** Variations the sweep may run (default 256, at most 4,096). */
    maximumVariations?: number;
    /** The metric that picks the best trial (default `'sharpe'`); ties resolve to the lower index. */
    selectionMetric?: GridSelectionMetric;
    hygiene?: {
        /** CSCV blocks for `probabilityOfBacktestOverfitting` (even, 4–16). Default: 16, or the largest even count the run's periods allow. */
        splits?: number;
        /** `researchProtocol`'s confidence in (0, 1); default 0.95. */
        confidence?: number;
    };
}
Fields, parameters and returned members (183)

Loading 183 members…

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

CrossSectionalBacktestGridResult

#

Public declaration. Read the signature and member contracts below; no additional behaviour is inferred.

Signature
import type { CrossSectionalBacktestGridResult } from '@insiderfinance/totalfinance/backtest';

export interface CrossSectionalBacktestGridResult {
    /** The parent sweep hash: the content hash of the axes and every child run hash. */
    sweepId: string;
    variations: GridVariationRow[];
    /** Every child run, index-aligned with `variations` — the same function, called once per point. */
    runs: CrossSectionalBacktestResult[];
    /** The best trial by the selection metric, or `null` when no variation carries the metric. */
    best: {
        index: number;
        runId: string;
        metric: GridSelectionMetric;
        value: number;
    } | null;
    hygiene: GridHygiene;
    assumptions: GridAssumptions;
    diagnostics: GridDiagnostics;
}
Fields, parameters and returned members (101)

Loading 101 members…

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

CrossSectionalBacktestRequest

#

Public declaration. Read the signature and member contracts below; no additional behaviour is inferred.

Signature
import type { CrossSectionalBacktestRequest } from '@insiderfinance/totalfinance/backtest';

// ---------------------------------------------------------------------------------------------------
// Request
// ---------------------------------------------------------------------------------------------------
export interface CrossSectionalBacktestRequest {
    dataset: CrossSectionalDataset;
    universeHistory: UniverseHistory;
    signal: CrossSectionalSignal;
    rebalanceSchedule: RebalanceSchedule;
    portfolioConstruction: PortfolioConstruction;
    /** Decision 7's policy; omitted = `execution.simplified()`, and the result says so. */
    execution?: ExecutionPolicy;
    /** Cost models applied to every fill; omitted = the policy's (none for the simplified policy). */
    transactionCostModel?: {
        commission?: CostModel;
        slippage?: SlippageModel;
    };
    /** Default 1,000,000 in `baseCurrency`. */
    initialCapital?: number;
    /** Default `'USD'`. */
    baseCurrency?: string;
    /** Restrict the run to sessions inside the window (inclusive instants). */
    window?: {
        fromTimestampMs?: EpochMs;
        toTimestampMs?: EpochMs;
    };
    /** Default 252. */
    periodsPerYear?: number;
    riskFreeRate?: number;
    /** Seeds the bootstrap confidence intervals of the performance block; absent = none. */
    seed?: number;
}
Fields, parameters and returned members (176)

Loading 176 members…

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

CrossSectionalBacktestResult

#

Public declaration. Read the signature and member contracts below; no additional behaviour is inferred.

Signature
import type { CrossSectionalBacktestResult } from '@insiderfinance/totalfinance/backtest';

export interface CrossSectionalBacktestResult {
    rebalances: RebalanceRow[];
    holdings: HoldingRow[];
    points: EquityPoint[];
    returns: number[];
    trades: Trade[];
    fills: NormalizedFill[];
    ledger: PortfolioLedgerSnapshot;
    timeline: PortfolioTimelineResult;
    attribution: CrossSectionalAttribution;
    benchmark: BenchmarkComparison | null;
    performance: PerformanceSummary;
    /** Bootstrap confidence intervals of the performance block when a seed was given. */
    performanceConfidence: {
        iterations: number;
        seed: number;
        meanTotalReturn: number;
        standardDeviation: number;
        confidenceInterval95: [
            number,
            number
        ];
    } | null;
    finalValue: number;
    runId: string;
    assumptions: CrossSectionalAssumptions;
    diagnostics: CrossSectionalDiagnostics;
}
Fields, parameters and returned members (213)

Loading 213 members…

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.