quantitivecalc
Version:
A TypeScript library providing advanced quantitative finance functions for risk analysis, performance metrics, and technical indicators. (Currently in development)
13 lines • 1.12 kB
TypeScript
/**
* Calculates the rolling beta of an asset relative to a benchmark over a specified window size.
* Beta is computed as the covariance of asset and benchmark returns divided by the variance of benchmark returns.
*
* @param data - Array of objects containing asset and benchmark returns.
* @param assetReturnsColumn - The key in each data object for the asset returns.
* @param benchmarkReturnsColumn - The key in each data object for the benchmark returns.
* @param resultColumn - The key in each data object where the calculated beta will be stored.
* @param windowSize - The number of periods to use for the rolling window (default is 252, typically one year of daily data).
* @returns A new array of objects with the calculated beta values in the specified result column. If insufficient data is available for a window, beta is set to `null`.
*/
export declare function calculateBeta(data: Array<Record<string, unknown>>, assetReturnsColumn: string, benchmarkReturnsColumn: string, resultColumn: string, windowSize?: number): Array<Record<string, unknown>>;
//# sourceMappingURL=calculateBeta.d.ts.map