UNPKG

quantitivecalc

Version:

A TypeScript library providing advanced quantitative finance functions for risk analysis, performance metrics, and technical indicators. (Currently in development)

17 lines 1.28 kB
/** * Calculates compound returns over a dataset and adds the result to each row. * * Iterates through the provided data array, compounding the specified returns column * and storing the result in a new column for each row. The compounding formula used is: * `compoundValue = previousValue * (1 + dailyReturn)`. The result column will contain * `compoundValue - 1 + addValue` for each row. * * @param data - Array of objects representing the dataset. Each object should contain the returns column. * @param returnsColumn - The key in each object representing the daily return value. Defaults to `'dailyReturn'`. * @param resultColumn - The key to store the calculated compound return in each object. * @param initialValue - The initial value to start compounding from. Defaults to `1`. * @param addValue - A constant value to add to the final compound return for each row. Defaults to `1`. * @returns A new array of objects with the compound return added to each row under `resultColumn`. */ export declare function calculateCompoundReturns(data: Array<Record<string, unknown>>, returnsColumn: string | undefined, resultColumn: string, initialValue?: number, addValue?: number): Array<Record<string, unknown>>; //# sourceMappingURL=calculateCompoundReturns.d.ts.map