@livefolio/sdk / RunBacktestOptions
Type Alias: RunBacktestOptions<F, S>
RunBacktestOptions<
F,S> =object
Defined in: strategy/run-backtest.ts:33
All inputs required to run a historical backtest.
Callers must provide a concrete Strategy, a DateRange, and the four pluggable runtime layers (dataFeed, executor, calendar, featureCache). The reference implementations (MemoryFeatureCache, BacktestExecutor, NYSEExchangeCalendar) satisfy all four without network dependencies.
Type Parameters
| Type Parameter | Default type |
|---|---|
F extends Features | Features |
S | unknown |
Properties
calendar
calendar:
Calendar
Defined in: strategy/run-backtest.ts:61
Trading-day calendar. Used to enumerate sessions within range and to determine rebalance day boundaries via next.
dataFeed
dataFeed:
DataFeed
Defined in: strategy/run-backtest.ts:50
Source of OHLCV bar data and optionally fundamentals / corporate events. FeatureRuntime uses this to hydrate price series before computing indicators.
executor
executor:
Executor
Defined in: strategy/run-backtest.ts:56
Order router responsible for converting Order objects into Fill records. Use BacktestExecutor for historical simulations or swap in a live broker implementation for paper/live trading.
featureCache?
optionalfeatureCache?:FeatureCache
Defined in: strategy/run-backtest.ts:67
Optional persistent indicator cache. When omitted, each runBacktest call recomputes all indicators from scratch. Provide MemoryFeatureCache (or a cross-process cache) to memoize results across multiple runs.
featureRuntime?
optionalfeatureRuntime?:FeatureRuntime
Defined in: strategy/run-backtest.ts:78
Optional FeatureRuntime instance. When provided, its accumulated bar buffer is exported on BacktestResult.bars for use by runLive (lets the streaming runtime seed its buffer from the historical bars without refetching).
freq?
optionalfreq?:Frequency
Defined in: strategy/run-backtest.ts:72
Bar frequency forwarded to DataFeed.bars. Defaults to '1d' when omitted. Must match the granularity expected by the strategy's indicator specs.
initialPortfolio
initialPortfolio:
Portfolio
Defined in: strategy/run-backtest.ts:45
Starting portfolio state. Cash and positions are carried forward through the simulation as orders are filled. This value is never mutated.
range
range:
DateRange
Defined in: strategy/run-backtest.ts:40
Inclusive date range over which to iterate. The calendar resolves this range into the actual sequence of trading sessions.
strategy
strategy:
Strategy<F,S>
Defined in: strategy/run-backtest.ts:35
The strategy under test. Must implement universe, features, and build.