quantitivecalc
Version:
A TypeScript library providing advanced quantitative finance functions for risk analysis, performance metrics, and technical indicators. (Currently in development)
16 lines • 1.24 kB
TypeScript
/**
* Calculates the rolling alpha for an asset relative to a benchmark using a specified window size.
* Alpha is computed as the intercept of the linear regression of asset excess returns against benchmark excess returns,
* annualized over the window.
*
* @param data - Array of data objects containing asset and benchmark returns.
* @param assetReturnsColumn - The key in each data object for the asset's returns.
* @param benchmarkReturnsColumn - The key in each data object for the benchmark's returns.
* @param resultColumn - The key to store the calculated alpha in each result object.
* @param windowSize - Number of periods to use for the rolling window (default: 252, typical for daily data over 1 year).
* @param riskFreeRate - Annual risk-free rate used to calculate excess returns (default: 0.02, or 2%).
* @returns A new array of data objects with the calculated alpha stored in the specified result column.
*/
export declare function calculateAlpha(data: Array<Record<string, unknown>>, assetReturnsColumn: string, benchmarkReturnsColumn: string, resultColumn: string, windowSize?: number, // 1 year for daily data
riskFreeRate?: number): Array<Record<string, unknown>>;
//# sourceMappingURL=calculateAlpha.d.ts.map