Sector Diffusion Index
Install and import
npm install fintech-algorithmsimport { calculate } from "fintech-algorithms/market-breadth-and-internals/concentration-and-diffusion/sector-diffusion-index";Signature
calculate(rows, tolerance)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
[
{
"component_id": "Communication",
"signal_change": 0.012,
"ready": true
},
{
"component_id": "Consumer Discretionary",
"signal_change": 0.008,
"ready": true
},
{
"component_id": "Consumer Staples",
"signal_change": 0.006,
"ready": true
}
]Showing 3 of 11 elements.
0.002Call
calculate(rows, tolerance)Returns
object with 6 fields: status, value, improving, unchanged, deteriorating, total
{
"status": "resolved",
"value": 59.09090909090909,
"improving": 5,
"unchanged": 3,
"deteriorating": 3,
"total": 11
}Diagrams
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.
References
- Claim-to-source map
- How to Compute Diffusion Indexes — The Conference Board