Skip to content

@livefolio/sdk / TacticalFeatureSpec

Type Alias: TacticalFeatureSpec

TacticalFeatureSpec = { asset: AssetRef; delay?: number; id: string; kind: "price"; } | { asset: AssetRef; delay?: number; id: string; kind: "sma"; period: number; } | { asset: AssetRef; delay?: number; id: string; kind: "ema"; period: number; } | { asset: AssetRef; delay?: number; id: string; kind: "rsi"; period: number; } | { asset: AssetRef; delay?: number; id: string; kind: "return"; mode?: ReturnMode; period: number; } | { asset: AssetRef; delay?: number; id: string; kind: "volatility"; period: number; } | { asset: AssetRef; delay?: number; id: string; kind: "drawdown"; period: number; }

Defined in: tactical/types.ts:110

A single feature entry in a TacticalSpec. Each variant declares the indicator kind, the asset to compute it on, and the time-series lookup parameters. The id is the name used to reference the computed value in FeatureRef inside the rule tree.

Supported variants:

  • price — most-recent closing price
  • sma — simple moving average over period trading days
  • ema — exponential moving average over period trading days
  • rsi — relative strength index over period trading days
  • return — cumulative or log return over period trading days (see ReturnMode)
  • volatility — annualised rolling standard deviation over period trading days
  • drawdown — peak-to-trough drawdown over period trading days

The optional delay shifts the lookup back by that many bars (0 = current bar, 1 = previous bar, etc.). Useful for avoiding look-ahead bias when using end-of-day prices.

Released under the MIT License.