fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Risk Allocation

5 algorithms in Portfolio Construction.

In this family#

  1. Inverse-Volatility Weighting contract

    Assigns capital in inverse proportion to each asset standalone volatility and normalizes the scores, with a covariance diagnostic showing what the rule leaves out.

    inverseVolatilityWeights(assetIds, standaloneVolatilities)
  2. Equal Risk Contribution contract

    Solves for the weights that give every asset the same contribution to portfolio volatility, which equal capital weights do not.

    equalRiskContributionWeights(assetIds, covariance)
  3. Risk Budgeting contract

    Solves for weights whose risk contributions match a declared budget per asset, generalizing equal risk contribution to unequal targets.

    riskBudgetingWeights(assetIds, covariance, riskBudgets)
  4. Hierarchical Risk Parity contract

    Allocates capital by clustering assets on a correlation-derived profile distance, then splitting capital down the tree by branch variance, without inverting the covariance matrix.

    hierarchicalRiskParityWeights(assetIds, covariance)
  5. Hierarchical Equal Risk Contribution contract

    Combines hierarchical clustering with equal risk contribution, and makes the cluster-count stopping decision explicit instead of leaving it implicit.

    hierarchicalEqualRiskContributionWeights(assetIds, covariance, clusterCount)

What they share#

Every topic here is a record-transform, so once you have called one the rest follow the same shape. Import paths differ only in the final segment:

ts
import { inverseVolatilityWeights } from "fintech-algorithms/portfolio-construction/risk-allocation/inverse-volatility-weighting";
import { equalRiskContributionWeights } from "fintech-algorithms/portfolio-construction/risk-allocation/equal-risk-contribution";

Read them in the order above — the sequence is pedagogical, not alphabetical.

Where this sits#

Portfolio Construction collects 20 algorithms across 4 families. For the concept behind this family rather than the call signatures, see the concept guides.