@livefolio/sdk / FeatureRuntimeOptions
Type Alias: FeatureRuntimeOptions
FeatureRuntimeOptions = {
dataFeed:DataFeed;featureCache:FeatureCache;field?:BarField;freq:Frequency;mode?:"historical";range:DateRange; } | {dataFeed?:DataFeed;featureCache:FeatureCache;field?:BarField;freq:Frequency;initialBars?:ReadonlyMap<AssetId,ReadonlyArray<Bar>>;mode:"streaming"; }
Defined in: features/runtime.ts:35
Configuration for a FeatureRuntime instance.
Accepts two shapes — select via the mode discriminant:
'historical'(default,modemay be omitted): range-bounded backtest mode. Bars are fetched fromDataFeedonce per asset and cached in memory.'streaming': open-ended live mode. No fixedrange; bars are pushed in viaappendBar. Indicator computation reads from the growing in-process buffer instead of callingDataFeed.bars.
The historical variant is backward-compatible — existing callers that omit mode compile and behave identically to before.
Union Members
Type Literal
{ dataFeed: DataFeed; featureCache: FeatureCache; field?: BarField; freq: Frequency; mode?: "historical"; range: DateRange; }
| Name | Type | Description | Defined in |
|---|---|---|---|
dataFeed | DataFeed | The market-data source used to fetch OHLCV bars. | features/runtime.ts:41 |
featureCache | FeatureCache | Persistent indicator cache. Use MemoryFeatureCache for a single backtest run, or supply a cross-process cache implementation to share results across multiple runs or processes. | features/runtime.ts:47 |
field? | BarField | Which OHLCV field to use as the scalar price series. Defaults to 'close'. All indicators within a single FeatureRuntime instance share the same field. | features/runtime.ts:65 |
freq | Frequency | Bar frequency forwarded to DataFeed.bars and embedded in cache keys. Must match the granularity expected by the indicators (e.g. '1d' for daily SMA/EMA). | features/runtime.ts:60 |
mode? | "historical" | Selects historical (range-bounded) mode. May be omitted; defaults to 'historical'. | features/runtime.ts:39 |
range | DateRange | The date range over which bars are fetched. This should span at least the backtest range plus any indicator warmup period (e.g. period - 1 extra bars for SMA/EMA). FeatureRuntime does not automatically extend the range for warmup — the caller is responsible for providing enough history. | features/runtime.ts:54 |
Type Literal
{ dataFeed?: DataFeed; featureCache: FeatureCache; field?: BarField; freq: Frequency; initialBars?: ReadonlyMap<AssetId, ReadonlyArray<Bar>>; mode: "streaming"; }
| Name | Type | Description | Defined in |
|---|---|---|---|
dataFeed? | DataFeed | Optional — not called in streaming mode. Omit in streaming-only usages. If provided it is stored but never invoked; supply only when sharing an options object that also carries a DataFeed for other purposes. | features/runtime.ts:73 |
featureCache | FeatureCache | Persistent indicator cache. In streaming mode the cache is bypassed entirely — every compute call recomputes from the in-memory bar buffer. The instance is still required so that a shared cache object can be passed without special-casing at the call site. | features/runtime.ts:80 |
field? | BarField | Which OHLCV field to use as the scalar price series. Defaults to 'close'. | features/runtime.ts:89 |
freq | Frequency | Bar frequency embedded in cache keys. Must match the granularity of the bars pushed via appendBar. | features/runtime.ts:85 |
initialBars? | ReadonlyMap<AssetId, ReadonlyArray<Bar>> | Optional seed bars per asset (keyed by AssetId), used to bootstrap the streaming buffer from a prior historical run's BacktestResult. Bars must already be in ascending t order per asset. | features/runtime.ts:95 |
mode | "streaming" | Selects streaming (open-ended live) mode. Required. | features/runtime.ts:69 |