Skip to main content

Heimdall

A host-agnostic data-provider SDK. Finance data first (Yahoo Finance OHLCV, FRED economic series), built so that any data source - yours or the community's - can plug in behind one small contract.

A provider takes a FetchRequest and returns a FetchResult: a Polars frame, a SchemaSpec that describes and validates it, and some metadata. That's the whole surface. Nothing in the core is finance-specific; OHLCV bars and economic observations are just two predefined schemas.

Install

pip install heimdall-mimird[fred,yfinance,sp500]   # or: heimdall-mimird[all]

The core depends only on polars (plus a small logging shim). Each provider pulls its own client library through an extra, so you install only what you use.

Quick start

import heimdall

# string shorthand -> FetchRequest(resource="DGS10")
result = heimdall.fetch("fred", "DGS10")
result.schema.validate(result.frame)  # raises SchemaError if it doesn't conform
print(result.frame.head())

bars = heimdall.fetch("yfinance", "AAPL", interval="1d")
print(bars.frame.tail())
print(bars.metadata)  # {"ticker": "AAPL", "interval": "1d", "rows": ...}

sp500 = heimdall.fetch("sp500", "constituents")
print(sp500.frame.select("symbol", "security", "gics_sector").head())

# a list of resources -> BatchResult(.ok / .failed keyed by resource, + combined .frame)
batch = heimdall.fetch("yfinance", ["AAPL", "MSFT", "NVDA"], interval="1d")
print(batch.frame.height, list(batch.failed))

# afetch() is the async mirror of both forms
result = await heimdall.afetch("fred", ["DGS10", "GDP"])

heimdall.list_providers() shows what's registered. Providers are registered automatically when their extra is installed; register your own with heimdall.register(MyProvider) (pass a constructed instance, heimdall.register(MyProvider(timeout=10)), to override its __init__ defaults). Asking heimdall.fetch(...) for a provider whose extra is missing raises ProviderNotFound telling you which extra to install, rather than failing blank.

Writing a provider

Subclass heimdall.Provider, set id + capabilities, implement _fetch (one resource - batch, async, and failure collection come for free). See docs/writing-a-provider.md for a full worked example, and run heimdall.testing.assert_provider_conformance(...) to check it against the contract.

Status

Early. The provider contract and the two bundled providers are usable today. The ingestion/storage layer, entry-point plugin discovery, and retry/rate-limit middleware are on the roadmap.

Metadata

Release files for heimdall-mimird 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for heimdall-mimird 0.5.0
File Size Uploaded
heimdall_mimird-0.5.0.tar.gz 151.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for heimdall-mimird 0.5.0
File Interpreter ABI Platform
heimdall_mimird-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 173.3 kB

Release files / heimdall_mimird-0.5.0.tar.gz

Download URL heimdall_mimird-0.5.0.tar.gz
Size 151.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f3ed876e619b25de893285d8dfc892d2b83da5e5f3a0ebe30e7fe01788ccc31b
BLAKE2b-256 checksum
How to use checksums
dbdd1c2ab50e2d5aaca8950995baccabe1f5fc7af84b9e43281e5a1f7ac1f48c
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 / heimdall_mimird-0.5.0-py3-none-any.whl

Download URL heimdall_mimird-0.5.0-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd5e8245d1f998a672a670b82060bd01ecab2ebed83426aac79347274dde2138
BLAKE2b-256 checksum
How to use checksums
6a80a91726cfa5c77355946fa405741aaa072785ec3a25c477e6b94c497498de
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 history Release notifications | RSS feed

0.5.1

2 release files

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page