norn
A small framework for market-data strategies (OHLCV → signal) and
interpreters (signal → target position). norn owns the contracts, a name
registry, a typed error hierarchy and structured logging. Market data is the
caller's to supply — e.g. straight from
heimdall.
import heimdall
from norn.strategies import SMACrossoverStrategy
from norn.interpreter import BuyAndHoldInterpreter
result = heimdall.fetch("yfinance", "AAPL", interval="1d")
ohlcv = result.frame.rename({"timestamp": "date", "symbol": "ticker"})
signals = SMACrossoverStrategy({"fast": 10, "slow": 30}).run(ohlcv)
targets = BuyAndHoldInterpreter().run(signals)
Don't know the class ahead of time? Look it up by name in the registry:
from norn.strategies import STRATEGY_REGISTRY
signals = STRATEGY_REGISTRY.get("sma_crossover")({"fast": 10, "slow": 30}).run(ohlcv)
Concepts
| contract | input → output | |
|---|---|---|
| Strategy | norn.strategies.BaseStrategy |
OHLCV frame → date, ticker, signal (signal ∈ [-1, 1]) |
| Interpreter | norn.interpreter.BaseInterpreter |
signal frame → same frame + target_position (∈ [-1, 1]) |
Canonical column names live in norn.schema (OHLCV, SIGNAL) — the OHLCV
frame you hand in must use them. Every frame is a Polars
DataFrame.
Built-ins: strategies sma_crossover, rsi_mean_reversion; interpreters
signal_following, buy_and_hold.
sandbox/
A dev playground — not part of the package. sandbox/run_sma.py is a worked
example of the OHLCV → signals → positions path (fetches through heimdall, so
it needs network access):
uv run python sandbox/run_sma.py
Extending
Add a strategy or interpreter in your own package and expose it through an entry
point so pip install is all a user needs. See CONTRIBUTING.md.
Development
uv sync
uv run pytest
uv run ruff check . && uv run ruff format --check .
uv run mypy
Metadata
Release files for norn-mimird 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| norn_mimird-0.2.0.tar.gz | 150.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| norn_mimird-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 169.4 kB
Release files / norn_mimird-0.2.0.tar.gz
| Download URL | norn_mimird-0.2.0.tar.gz |
|---|---|
| Size | 150.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f24893a6d07e0523b90a5fba7d3d88f3c35c98948d73bce2b8ecdc4f4b8ad0b
|
|
BLAKE2b-256 checksum How to use checksums |
069d270191d2cd041f70e391b0a9a7d457e0f96ae3090280cc6809e8ccfbce46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Omarchy","version":"4.0.2","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / norn_mimird-0.2.0-py3-none-any.whl
| Download URL | norn_mimird-0.2.0-py3-none-any.whl |
|---|---|
| Size | 18.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33b38c233fbbebeebc30162a06ed90d3e1db43b38836b2bfffedaf70fbfa2de7
|
|
BLAKE2b-256 checksum How to use checksums |
61feaa6e882c8eacdfed466b39fd82e122d9788cf19dc3dc50cfa834366d6519
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Omarchy","version":"4.0.2","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|