---
name: Keyed Dynamic Universe
slug: keyed-dynamic-universe
category: Data
description: Keyed Dynamic Universe maintains online covariance for named series when the set of names changes over time. Use it for streaming inputs as dicts keyed by asset or feature name instead of fixed-length vectors.
github: "https://github.com/microprediction/precise/tree/main/.claude/skills/keyed-dynamic-universe"
language: Python
stars: 333
forks: 58
install: "npx degit https://github.com/microprediction/precise/tree/main/.claude/skills/keyed-dynamic-universe ~/.claude/skills/keyed-dynamic-universe"
installs_to: ~/.claude/skills/keyed-dynamic-universe
source_path: .claude/skills/keyed-dynamic-universe/SKILL.md
collection_size: 6
category_size: 668
collection_url: "https://dirskills.com/collections/microprediction/precise"
added: 2026-08-12T04:43:52.618Z
last_synced: 2026-08-12T04:43:52.618Z
canonical_url: "https://dirskills.com/skills/keyed-dynamic-universe"
---

# Keyed Dynamic Universe

Keyed Dynamic Universe maintains online covariance for named series when the set of names changes over time. Use it for streaming inputs as dicts keyed by asset or feature name instead of fixed-length vectors.

**Install:**

```bash
npx degit https://github.com/microprediction/precise/tree/main/.claude/skills/keyed-dynamic-universe ~/.claude/skills/keyed-dynamic-universe
```

## README

# Keyed covariance over a changing universe

In streaming/finance settings observations are dicts keyed by name, and the set of names changes. `keyed`
decorates *any* positional estimator to consume keyed dicts and emit keyed output.

```bash
pip install precise            # add [pandas] for to_frame()
```

```python
from precise import keyed, EwaCovariance

est = keyed(EwaCovariance(r=0.05), dynamic=True)     # universe may change over time
est.partial_fit({"BTC": 0.01, "ETH": -0.02})         # river-style: also .update / .learn_one
est.partial_fit({"ETH": 0.00, "SOL": 0.03})          # BTC drops out, SOL enters

est.covariance_["ETH"]["SOL"]                         # dict-of-dicts over the live universe
est.to_frame()                                        # pandas DataFrame  (needs [pandas])
```

## Fixed vs dynamic

- `keyed(est)` / `dynamic=False` → **FixedUniverse**: one wrapped estimator; missing keys are imputed.
  Use when the set of names is stable and you just want dict ergonomics.
- `keyed(est, dynamic=True)` → **DynamicUniverse**: tracks multiple live key-sets with staleness /
  longevity eviction and assembles a pairwise matrix. Use when names genuinely enter and leave.

## Notes

- The adapter adds **no covariance math of its own** — it wraps the positional estimator, so any estimator
  from the **estimate-online-covariance** skill works inside it (`LedoitWolfCovariance`, `HuberCovariance`,
  …).
- The assembled matrix is projected to the nearest PSD; expect small adjustments when the live universe
  changes.
- To score/compare keyed estimators, extract the dense `covariance_` (e.g. via `to_frame().values`) and use
  the **score-covariance-estimate** skill.
