@livefolio/sdk / TacticalSpec
Type Alias: TacticalSpec
TacticalSpec =
object
Defined in: tactical/types.ts:296
A fully self-contained declaration of a tactical allocation strategy. Plain data — no methods, no closures. Pass to fromSpec to obtain a runnable Strategy.
The dialect version distinguishes 'tactical/v0' (deprecated, byte-for-byte equivalent to v1, emits a one-time console warning) from 'tactical/v1' (current).
Example
import type { TacticalSpec } from '@livefolio/sdk';
const spec: TacticalSpec = {
kind: 'tactical/v1',
universe: [
{ id: 'SPY', symbol: 'SPY' },
{ id: 'SHY', symbol: 'SHY' },
],
rebalance: { frequency: 'Monthly' },
features: [
{ id: 'spy_sma200', kind: 'sma', asset: { id: 'SPY', symbol: 'SPY' }, period: 200 },
{ id: 'spy_price', kind: 'price', asset: { id: 'SPY', symbol: 'SPY' } },
],
rules: {
op: 'if',
cond: { op: 'gt', left: { ref: 'spy_price' }, right: { ref: 'spy_sma200' } },
then: { op: 'allocate', weights: { SPY: 1 } },
else: { op: 'allocate', weights: { SHY: 1 } },
},
};Properties
features
features:
TacticalFeatureSpec[]
Defined in: tactical/types.ts:309
Named feature computations referenced by the rule tree.
kind
kind:
"tactical/v0"|"tactical/v1"
Defined in: tactical/types.ts:301
Dialect version. Use 'tactical/v1'. 'tactical/v0' is accepted but deprecated and will emit a one-time warning.
rebalance?
optionalrebalance?:RebalanceConfig
Defined in: tactical/types.ts:307
Rebalance cadence. Defaults to { frequency: 'Daily' } when omitted.
rules
rules:
RuleNode
Defined in: tactical/types.ts:311
Root of the rule tree that maps resolved feature values to target weights.
synthetics?
optionalsynthetics?:SyntheticAsset[]
Defined in: tactical/types.ts:305
Optional synthetic assets whose bar data is derived from an underlying.
universe
universe:
AssetRef[]
Defined in: tactical/types.ts:303
Ordered list of assets eligible for allocation.