hfvol
Realized variance, bipower variation, jump variation, Hawkes intensity and the HAR-RV forecaster, as sktime estimators on top of plain numpy functions.
pip install hfvol # numpy functions only
pip install "hfvol[sktime]" # plus the sktime transformers and forecaster
Why
sktime has a Hurst-exponent transformer but no realized measures and no Hawkes
process. The main Python Hawkes library (tick) needs a C++ build. hfvol fills
both gaps with small numpy code that passes sktime's own
check_estimator suite.
sktime
import numpy as np, pandas as pd
from hfvol import RealizedVariance, BipowerVariation, JumpVariation, HARForecaster
# 5-minute returns, 78 bars per session, DatetimeIndex
idx = pd.date_range("2024-01-02 09:35", periods=78 * 250, freq="5min")
r = pd.Series(np.random.default_rng(0).normal(0, 1e-3, len(idx)), index=idx)
rv = RealizedVariance(freq=78).fit_transform(r) # one value per session
bv = BipowerVariation(freq=78).fit_transform(r) # jump-robust
jv = JumpVariation(freq=78).fit_transform(r) # max(RV - BV, 0)
f = HARForecaster().fit(rv.reset_index(drop=True))
f.predict(fh=[1, 5, 22])
freq is either an integer number of bars per period or a pandas offset alias
("D", "W", ...) that groups a DatetimeIndex by calendar period. Multivariate
frames give one column per asset; Panel and hierarchical data work through
sktime's usual vectorization.
from hfvol import HawkesIntensity
# trade counts per second; the intensity at each second uses only earlier trades
lam = HawkesIntensity(method="mle", time_unit="1s", random_state=0).fit_transform(counts)
numpy
from hfvol import (
realized_variance,
bipower_variation,
jump_variation,
fit_har,
har_forecast,
HawkesParams,
hawkes_simulate,
fit_hawkes_mle,
hawkes_residual_analysis,
)
events = hawkes_simulate(HawkesParams(mu=0.5, alpha=0.8, beta=1.6), T=5000, rng=1)
params, ll = fit_hawkes_mle(events, T=5000, rng=0)
params.branching_ratio # about 0.5
hawkes_residual_analysis(events, 5000, params)["well_fit"]
More
- API reference
- Formulas and references
- Where this came from
- Ecosystem plan (sktime, OpenBB)
- Examples:
examples/
MIT licensed. Carved out of srfm-lab.
Metadata
Release files for hfvol 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| hfvol-0.1.0.tar.gz | 27.4 kB | With provenance | Details for hfvol-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hfvol-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for hfvol-0.1.0-py3-none-any.whl |
Total release size: 47.1 kB
Release files / hfvol-0.1.0.tar.gz
| Download URL | hfvol-0.1.0.tar.gz |
|---|---|
| Size | 27.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c1e5930c600c08f2b35cd57be944c685ac0261ed15a6b3593dd4ebdec8545712
|
|
BLAKE2b-256 checksum How to use checksums |
a9399dddff481f6743402d5d639c893555b664ff032d9a3ef7b0d1b5db8aca0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logRelease files / hfvol-0.1.0-py3-none-any.whl
| Download URL | hfvol-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fdf2ddd1bd03894dd1ba40ba1f48b83f9b3f84a0623d378d62f8e0e87d148cef
|
|
BLAKE2b-256 checksum How to use checksums |
6e282f6bd8d1b3610158f944ff920c8796db840658788e1fb1b0fb252fe4bd61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logSecurity for hfvol 0.1.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for hfvol-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.