UNPKG

@cranberry-money/shared-utils

Version:

Shared utility functions for Blueberry platform

11 lines 417 B
export const calculateHoldingAllocations = (holdings) => { const totalQuantity = holdings.reduce((sum, holding) => sum + holding.quantity, 0); if (totalQuantity === 0) return {}; const allocations = {}; holdings.forEach(holding => { allocations[holding.instrument.uuid] = (holding.quantity / totalQuantity) * 100; }); return allocations; }; //# sourceMappingURL=holdings.js.map