quantitivecalc
Version:
A TypeScript library providing advanced quantitative finance functions for risk analysis, performance metrics, and technical indicators. (Currently in development)
16 lines • 1.09 kB
TypeScript
/**
* Calculates rolling volatility (standard deviation) of returns over a specified window size.
*
* @param data - Array of data objects containing return values.
* @param returnsColumn - The key in each data object representing the return value.
* @param resultColumn - The key to store the calculated volatility in each data object.
* @param windowSize - The number of periods to use for the rolling window (default is 20).
* @param annualize - Whether to annualize the volatility (default is true, assumes 252 trading days per year).
* @returns A new array of data objects with the calculated volatility added under `resultColumn`.
*
* @remarks
* - If there are not enough data points to fill the window, the volatility is set to `null`.
* - Only numeric and non-NaN return values are considered in the calculation.
*/
export declare function calculateVolatility(data: Array<Record<string, unknown>>, returnsColumn: string, resultColumn: string, windowSize?: number, annualize?: boolean): Array<Record<string, unknown>>;
//# sourceMappingURL=calculateVolatility.d.ts.map