mfe — Financial Econometrics for Python
Python port of Kevin Sheppard's Oxford MFE Toolbox, optimised for HFT data.
Complements arch — covering everything arch is missing.
What's inside
| Module | Contents |
|---|---|
mfe.realized |
RV, BPV, MedRV, realized kernel, TSRV, MSRV, Hayashi-Yoshida, multivariate kernel, BNS jump test |
mfe.multivariate |
DCC, CCC, BEKK, O-GARCH, GO-GARCH, RCC |
mfe.univariate |
HAR-RV (standard / MODIFIED / matrix intervals / HAR-J), HEAVY |
mfe.timeseries |
VAR (4 VCV options), Granger causality, IRF, Beveridge-Nelson |
mfe.bootstrap |
Wild bootstrap, SPA test (Hansen 2005), StepM (Romano-Wolf 2005) |
mfe.crosssection |
Fama-MacBeth, OLS/OLSNW, PCA |
mfe.tests_stat |
ARCH-LM, Ljung-Box, HAC LM, Diebold-Mariano, Mincer-Zarnowitz |
mfe.distributions |
Skew-t (analytic score), GED, multivariate normal log-likelihood |
Installation
pip install mfe
Cython extensions (optional, recommended for production)
Cython compilation gives 10–800× speedups on hot paths (realized kernel inner loop, Hayashi-Yoshida sweep, DCC/BEKK recursions):
pip install cython numpy setuptools
python setup_cython.py build_ext --inplace
Quick start
from mfe.realized import price_filter, returns_from_prices, realized_kernel, bns_jump_test
from mfe.realized._types import SamplingType
prices_5m, times_5m = price_filter(
tick_prices, tick_times,
sampling_type=SamplingType.CALENDAR_TIME,
sampling_interval=300,
)
r = returns_from_prices(prices_5m)
rk = realized_kernel(r)
jmp = bns_jump_test(r)
from mfe.multivariate import DCC, RCC
dcc = DCC().fit(returns) # (T, K) → (T, K, K) sigma_t
rcc = RCC().fit(returns) # covariance targeting by construction
from mfe.univariate import HEAVY
heavy = HEAVY().fit(daily_returns, realized_variances)
Development
uv sync --all-groups
PYTHONPATH=src pytest tests/ # 246 tests
mkdocs serve # documentation
Relationship to MATLAB MFE Toolbox
This package ports bashtage/mfe-toolbox to Python, fixing several bugs present in the MATLAB source (memory leaks, silent non-convergence, O(N²) algorithms replaced with O(N log N) Cython implementations).
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mfe_toolbox-0.1.0.tar.gz.
File metadata
- Download URL: mfe_toolbox-0.1.0.tar.gz
- Upload date:
- Size: 322.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a98d02bacca40228f6d6c7495207c1815de76fa6692c293d56a07a6f558467f8
|
|
| MD5 |
0b3871ba6fa82c6f32475292d2f8bcb9
|
|
| BLAKE2b-256 |
c7da799771c1deb8ba754441190acd7cb91b9e3d87bd5e1e643de8c93ae774a2
|
Provenance
The following attestation bundles were made for mfe_toolbox-0.1.0.tar.gz:
Publisher:
publish.yml on GabinTB/mfe-toolbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mfe_toolbox-0.1.0.tar.gz -
Subject digest:
a98d02bacca40228f6d6c7495207c1815de76fa6692c293d56a07a6f558467f8 - Sigstore transparency entry: 2704166423
- Sigstore integration time:
-
Permalink:
GabinTB/mfe-toolbox@49811ec11580485109903609248cfd8457c028ec -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/GabinTB
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@49811ec11580485109903609248cfd8457c028ec -
Trigger Event:
push
-
Statement type:
File details
Details for the file mfe_toolbox-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mfe_toolbox-0.1.0-py3-none-any.whl
- Upload date:
- Size: 147.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ce785ffd48ee3842fac14081b123e02da64ac60741db4f65a935d743135ac78
|
|
| MD5 |
0b3bb6d565ab9f14d6e9cbb1e998659e
|
|
| BLAKE2b-256 |
73810fae082176684eb7c94ad23bb9519a9efda8536c9094189aa3bef5ee6788
|
Provenance
The following attestation bundles were made for mfe_toolbox-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on GabinTB/mfe-toolbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mfe_toolbox-0.1.0-py3-none-any.whl -
Subject digest:
7ce785ffd48ee3842fac14081b123e02da64ac60741db4f65a935d743135ac78 - Sigstore transparency entry: 2704166515
- Sigstore integration time:
-
Permalink:
GabinTB/mfe-toolbox@49811ec11580485109903609248cfd8457c028ec -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/GabinTB
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@49811ec11580485109903609248cfd8457c028ec -
Trigger Event:
push
-
Statement type: