@livefolio/sdk / getFeatureCompute
Function: getFeatureCompute()
getFeatureCompute(
kind):ComputeFn
Defined in: features/spec.ts:110
Retrieves the registered compute function for a given feature kind.
Throws Error if the kind has not been registered. In normal usage the built-in defineFeature calls at the bottom of this module pre-populate the registry, so this function only throws for custom kinds that were never registered.
Parameters
| Parameter | Type | Description |
|---|---|---|
kind | "price" | "sma" | "ema" | "rsi" | "return" | "volatility" | "drawdown" | The FeatureKind string to look up. |
Returns
The ComputeFn registered for kind.
Example
ts
import { getFeatureCompute } from '@livefolio/sdk';
const computeSma = getFeatureCompute('sma');
const result = computeSma(priceSeries, { kind: 'sma', period: 20 });