pymlfinance
Python bindings for mlfinance — a Rust implementation of concepts from Advances in Financial Machine Learning by Marcos López de Prado.
Installation
pip install pymlfinance
With Polars plugin support:
pip install pymlfinance[polars]
Quick Start
import numpy as np
import pymlfinance as ml
# EWMA smoothing
prices = np.array([100.0, 101.5, 99.8, 102.3, 101.0])
smoothed = ml.core.ewma(prices, 3)
# CUSUM event filter
events = ml.data.cusum_filter(prices, 1.5)
# Triple-barrier labeling
from pymlfinance import TripleBarrierConfig
config = TripleBarrierConfig(upper_barrier=0.02, lower_barrier=0.02, max_holding_period=10)
# Fractional differentiation
stationary = ml.sampling.frac_diff_ffd(prices, 0.5, 1e-4)
# HRP portfolio allocation
returns = np.random.randn(100, 5) * 0.02
weights = ml.features.hrp_weights(returns)
# Sharpe ratio
ret = np.random.randn(252) * 0.01
sr = ml.backtesting.sharpe_ratio(ret)
Modules
| Module | Description |
|---|---|
pymlfinance.core |
EWMA, cumsum, returns, matrix utilities |
pymlfinance.data |
Bar generation (tick, volume, dollar, information-driven), CUSUM filter |
pymlfinance.labeling |
Triple-barrier, meta-labeling, trend-scanning |
pymlfinance.sampling |
Sequential bootstrapping, sample weights, fractional differentiation |
pymlfinance.features |
Structural breaks, entropy, microstructure, HRP, denoising |
pymlfinance.modeling |
Bet sizing, cross-validation, feature importance |
pymlfinance.backtesting |
Backtest statistics, overfitting detection, strategy risk |
Polars Plugin
import polars as pl
import pymlfinance # registers .ml namespace
df = pl.DataFrame({"price": [100.0, 101.5, 99.8, 102.3, 101.0]})
df.with_columns(pl.col("price").ml.ewma(span=3).alias("smoothed"))
Documentation
Disclaimer
This software is provided for educational and research purposes only. It does not constitute financial advice. Use of this code for trading or investment decisions is entirely at your own risk. The authors accept no liability for any financial losses incurred.
License
BUSL-1.1 — see LICENSE.
Metadata
Release files for pymlfinance 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pymlfinance-0.1.1.tar.gz | 11.0 MB | Without provenance | Details |
Built distributions (wheels)
Total release size: 114.0 MB
Release files / pymlfinance-0.1.1.tar.gz
| Download URL | pymlfinance-0.1.1.tar.gz |
|---|---|
| Size | 11.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e66b25e3141683ff9dd9f89eadeb5dbb6d62c1a8906bdfbe9faf9c12628438c9
|
|
BLAKE2b-256 checksum How to use checksums |
63e20778a321659debb9cc4abdc9eea50e4c1813e475ce870ed8daf561efb64f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pymlfinance-0.1.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 5.8 MB |
| Tags | Linux glibc 2.17+ x86-64 PyPy 3.11 PyPy 3.11 7.3 |
|
SHA-256 checksum How to use checksums |
8f538399a988b11228de9f67fae0ed2ab0a1ed47eece72c2c5e04cea7615c94a
|
|
BLAKE2b-256 checksum How to use checksums |
49424582a7daa0fdabe52ca46313093895c3d1d3c81954df0faeca8c18b6d3d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pymlfinance-0.1.1-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | Linux glibc 2.17+ ARM64 PyPy 3.11 PyPy 3.11 7.3 |
|
SHA-256 checksum How to use checksums |
57387b048abb3566f3e6864af5fcbe2edd8f22ac9c39865c924782241f0cc6cb
|
|
BLAKE2b-256 checksum How to use checksums |
796ac36c4469b4d679b896e1b08147eb6958bc742e35f366b6fed99fed2fd4a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pymlfinance-0.1.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
67b0c26fca4b8a31aa35060f5bffc88e90db7e1ecd940513f2edb9c0bb574e17
|
|
BLAKE2b-256 checksum How to use checksums |
41b266193a5118cac2a21ba46a2fb066780f307a05063e9cfd1da4424529b85d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pymlfinance-0.1.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 5.8 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
b374ecbcf1dac281d1e90d61299459e97c7e83de610b6881e71066c4dc6326cf
|
|
BLAKE2b-256 checksum How to use checksums |
b020e0ccc43a82022cb587c3abaaa900da5a2a6616e2f955fe64fe7d9f8571d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pymlfinance-0.1.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
ddcf801fd443187bda1791f80a8952bcdb96fb1d6d976d009a82532a326d85c4
|
|
BLAKE2b-256 checksum How to use checksums |
27b1fcb63b9ab9fdb45f326188abc08cb9054a641dfeeda1f46cf847df08851a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pymlfinance-0.1.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.13 CPython 3.13 free-threading Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
06146d6b8d251fb81fb0aaef8495fc85c18bd8345c03160bb196a6bd9bab0749
|
|
BLAKE2b-256 checksum How to use checksums |
5eed450a228603e374bab63c5e5f6b6b3d9220b47ab1852ced416751fbbab9e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pymlfinance-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 5.8 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
da0c6024250ff19013d255e6024490d5b0e216733f37ed150277d244c8e03fdb
|
|
BLAKE2b-256 checksum How to use checksums |
88572e8dcea8f6074fe122161c01002c2d4336efed914a98e259b170351172ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pymlfinance-0.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
3f821da19973ddadece7a20376de9c02f96f58d716af82a0ae98ab995d498f0f
|
|
BLAKE2b-256 checksum How to use checksums |
6d23b2898dfbd5cd3c396b2a316dc6b7a08c9b597b0e0370ebd06460499bc260
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp312-cp312-win_amd64.whl
| Download URL | pymlfinance-0.1.1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
7ecbea0e8cd12759966467325522954157b8e82fa4785719c22131d3a2b72ed9
|
|
BLAKE2b-256 checksum How to use checksums |
ddf5ba438071da1a49a8dd8500be96b8002ceb2f2850f82ad6ae97e0f90e2a6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pymlfinance-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 5.8 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
85206ddb06a9bdc1e4ed0af20693148286ffc2575264e329b92a154d20c47c26
|
|
BLAKE2b-256 checksum How to use checksums |
ac0fda92ac26ea82611efb83b57923beb14ad82f8186c377863a001fc1b26a2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pymlfinance-0.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
1b564498c4bc72c3b540848a442368506374c14678912451db3caa2b2aa8d257
|
|
BLAKE2b-256 checksum How to use checksums |
8bd06f80ec219a90d6616f86bf6c2cfa74a05884a8eb009f8f7ea578147f9777
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | pymlfinance-0.1.1-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 4.8 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
2cd5e19e044a4b8507e1fff74ad8ea4cd906261656e480d3f406360a13508236
|
|
BLAKE2b-256 checksum How to use checksums |
658936ee0c658badf3d23707a207873bef6de649da6c5792a149657b2104445e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl
| Download URL | pymlfinance-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.12 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
ffa4f2e4e34a4d5e5879df9cb777d9733b61d67f84dfade5d21923a9a2aa19ff
|
|
BLAKE2b-256 checksum How to use checksums |
dd7a2a6e3eb1bfd8aa0bca88367a211152eae909ccafb2b77ce6a4ce7817a271
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pymlfinance-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 5.8 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
267c4dba87167c6a6d26d766d864a0fc77a62cbc5da55628daadd0994eeb6053
|
|
BLAKE2b-256 checksum How to use checksums |
b6449a20fc8984b77e6a6a230b563e9614ba3d6ab83bd7eb0304fc99fb456cf6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pymlfinance-0.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
df635f61455d35775ce320c07a6ca6548b253ef2607f9088d838fd1f20c2ebf8
|
|
BLAKE2b-256 checksum How to use checksums |
a8f3006a544e45e648575372bbd5fe065605cbc592b405d3b704469bf0a78bb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pymlfinance-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 5.8 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
5de200f9798e16a4959a2e5d1bf68ab2264a276bf8fba868204a47d80bac3970
|
|
BLAKE2b-256 checksum How to use checksums |
e87f1920dffb7b8508d0f09fbb869f24f04707b1c5ca69bd755d6e6e27e0bafc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pymlfinance-0.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
313b779ae4220b6d006f45e39fb8d8ee29ebc657235d29232ba3ccbaec883216
|
|
BLAKE2b-256 checksum How to use checksums |
bb469fc8baf6f6570bf4365f35fb18e6cbadeb2fda6fe06b70ccdcd29f5329f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pymlfinance-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 5.8 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
8a4aa0fb6700165e49fbf88e05b1e452384f324656f3e7968b03c2334931fc05
|
|
BLAKE2b-256 checksum How to use checksums |
0f98bb309d7471eca3e466d73b4e8b291e92bcf3a47f6ca884bc1a593f13d58d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pymlfinance-0.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pymlfinance-0.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
573889e2193c7628c1a0447bfb7253f8008e413fc1b2e914b25538262b5f7c57
|
|
BLAKE2b-256 checksum How to use checksums |
09c3f15d7222b291a167103e17a00235eafc84d7170f83bb9776946fd3c1c041
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for pymlfinance 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.