# Global Minimum Variance

`D14-F01-A02` · Portfolio Construction → Mean-Risk Optimization · archetype `record-transform` · difficulty 4/5 · verification **contract**

Full page: https://docs.thefintechbuilder.com/portfolio-construction/mean-risk-optimization/global-minimum-variance/
Agent skill: `npx skills add IslamBaraka90/Fintech-Algorithms-Library` — https://docs.thefintechbuilder.com/guides/agent-skill/

## Install and import

```bash
npm install fintech-algorithms
```

```ts
import { globalMinimumVariance } from "fintech-algorithms/portfolio-construction/mean-risk-optimization/global-minimum-variance";
```

## Signature

```ts
globalMinimumVariance(assetIdsInput, covarianceInput, options)
```

Computes the lowest-variance weights obtainable from a covariance matrix alone, with no expected-return input, and shows why clipping a short weight is not optimization.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `assetIdsInput` | `unknown` | yes |  |
| `covarianceInput` | `unknown` | yes |  |
| `options` | `GMVOptions` | no | default: "{}" |

## Worked example

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

`assetIdsInput`:

```json
["A", "B"]
```

`covarianceInput`:

```json
[
  [0.04, 0.01],
  [0.01, 0.09]
]
```

`options`:

```json
{
  "maxIterations": 10000
}
```

### Call

```ts
globalMinimumVariance(assetIdsInput, covarianceInput, options)
```

### Returns

object with 19 fields: assetIds, mu, matrixScale, variant, method, maxIterations, weights, variance, …

```json
{
  "assetIds": ["A", "B"],
  "mu": null,
  "matrixScale": 0.09,
  "variant": "gmv-long-only-fully-invested",
  "method": "projected-gradient-simplex-line-search",
  "maxIterations": 10000,
  "weights": [0.7272727272727273, 0.27272727272727276],
  "variance": 0.03181818181818182,
  "volatility": 0.17837651700316895,
  "expectedReturn": null,
  "budgetResidual": 0,
  "lowerBoundResidual": 0,
  "fwGapS": 0,
  "fwGap": 0
}
```

Showing 14 of 19 fields.

## Verification and provenance

Tier: **contract**.

The module loads, the entry point is callable and its declared signature matches the compiled code. The example below is real captured output, but no independently published figure asserts the numbers.

Both tiers guarantee the signature. Full explanation: https://docs.thefintechbuilder.com/guides/verification/

Generated from the docs.json payload shipped inside fintech-algorithms@0.13.2.
The signature and parameter list are checked against the compiled implementation at build time,
so a description that contradicts the code fails the build rather than reaching this file.

## Links

- Article (how it works, step by step): https://thefintechbuilder.com/portfolio-construction/mean-risk-optimization/global-minimum-variance/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/portfolio-construction/mean-risk-optimization/global-minimum-variance/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/portfolio-construction/llms.txt
