quantitivecalc
Version:
A TypeScript library providing advanced quantitative finance functions for risk analysis, performance metrics, and technical indicators. (Currently in development)
21 lines (20 loc) • 1.11 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = findExtremesInColumnPerKey;
const all_1 = require("./../ListUtils/all");
const applyFunction_1 = __importDefault(require("./applyFunction"));
/**
* Finds the minimum and maximum values in a specified column for each key in a dictionary of lists.
*
* @template T - The type of objects contained in the lists.
* @template K - The key of the column to find extremes for, must be a key of T.
* @param dict - A dictionary where each key maps to an array of objects of type T.
* @param columnName - The name of the column (property of T) to find the min and max values for.
* @returns A dictionary mapping each key to an object containing the minimum and maximum values found in the specified column.
*/
function findExtremesInColumnPerKey(dict, columnName) {
return (0, applyFunction_1.default)(dict, list => all_1.listUtils.findExtremesInColumn(list, columnName));
}