fintech-algorithms

Herfindahl Constituent Concentration

Install and import

bash
npm install fintech-algorithms
ts
import { calculate } from "fintech-algorithms/market-breadth-and-internals/concentration-and-diffusion/herfindahl-constituent-concentration";

Signature

calculate(rows)

Worked example

executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.

Input

rows
[
  {
    "security_id": "S01",
    "weight": 0.17821782178217824,
    "return": 0.065,
    "sector": "Tech",
    "ready": true
  },
  {
    "security_id": "S02",
    "weight": 0.13861386138613863,
    "return": 0.041,
    "sector": "Financials",
    "ready": true
  },
  {
    "security_id": "S03",
    "weight": 0.10891089108910892,
    "return": 0.028,
    "sector": "Industrials",
    "ready": true
  }
]

Showing 3 of 24 elements.

Call

calculate(rows)

Returns

object with 3 fields: status, hhi, hhi_points

{
  "status": "resolved",
  "hhi": 0.0898088422703657,
  "hhi_points": 898.088422703657
}

Diagrams

Herfindahl Constituent Concentration — decision boundary
Herfindahl Constituent Concentration — family map

How it works

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References