fintech-algorithms

Volatility-Control Index

Install and import

bash
npm install fintech-algorithms
ts
import { calculate } from "fintech-algorithms/index-and-benchmark-engineering/strategy-indices/volatility-control-index";

Signature

calculate(data)

Worked example

verified This is the worked example published in the article, replayed by the test suite on every run. The output cannot drift.

Input

data
{
  "returns": [0.004, -0.003, 0.005, 0.002, -0.012, 0.015],
  "lookback": 4,
  "annualization": 252,
  "targetVolatility": 0.1,
  "maxExposure": 1.5,
  "cashReturn": 0.0001,
  "baseLevel": 1000
}

Call

calculate(data)

Returns

object with 4 fields: exposures, strategyReturns, levels, endingLevel

{
  "exposures": [1, 1, 1, 1, 1.5, 0.84685],
  "strategyReturns": [0.004, -0.003, 0.005, 0.002, -0.01805, 0.012718],
  "levels": [1000, 1004, 1000.988, 1005.99294, 1008.004926, 989.810437],
  "endingLevel": 1006.077264
}

Diagrams

Volatility-Control Index — article hero
Volatility-Control Index — failure guard
Volatility-Control Index — worked example

Calculation flow

Volatility-Control Index calculation flow
flowchart LR
    A["Point-in-time inputs"] --> B["Validate units and timing"]
    B --> C{"Contract feasible?"}
    C -->|No| D["Reject with reason"]
    C -->|Yes| E["Calculate Volatility-Control Index"]
    E --> F["Recompute invariants"]
    F --> G{"Checks pass?"}
    G -->|No| D
    G -->|Yes| H["Publish audited output"]
Volatility-Control Index methodology state
stateDiagram-v2
    [*] --> FrozenInputs
    FrozenInputs --> Validated: contract passes
    FrozenInputs --> Rejected: missing or infeasible
    Validated --> Calculated: apply named rule
    Calculated --> Audited: invariants pass
    Calculated --> Rejected: invariant fails
    Audited --> Published: version and timestamp recorded
    Published --> Revised: approved correction
    Revised --> FrozenInputs: rebuild from retained source state

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