quantitivecalc
Version:
A TypeScript library providing advanced quantitative finance functions for risk analysis, performance metrics, and technical indicators. (Currently in development)
18 lines • 1.24 kB
TypeScript
/**
* Calculates the Relative Strength Index (RSI) for a given dataset.
*
* The RSI is a momentum oscillator that measures the speed and change of price movements.
* It is typically used in technical analysis to identify overbought or oversold conditions.
*
* @param data - An array of objects representing the dataset. Each object should contain the source column.
* @param sourceColumn - The key in each data object that contains the numeric value to calculate RSI from.
* @param resultColumn - The key to store the calculated RSI value in each result object. Defaults to `'rsi'`.
* @param windowSize - The number of periods to use for the RSI calculation. Defaults to `14`.
* @returns A new array of objects with the RSI value added under the specified result column.
*
* @remarks
* - If there is insufficient data to calculate RSI for a given row (i.e., fewer than `windowSize` periods), the result will be `null` for that row.
* - If the average loss is zero, the RSI will be set to `100` for that row.
*/
export declare function calculateRSI(data: Array<Record<string, unknown>>, sourceColumn: string, resultColumn?: string, windowSize?: number): Array<Record<string, unknown>>;
//# sourceMappingURL=calculateRSI.d.ts.map