Minimal, self-contained CLI tools and library for quantitative finance.
- corr: Compute correlation matrices over time from returns.
- costs: Calculate Sharpe Ratio (SR) costs for instruments based on spread and fees.
- estimators: Volatility and Forecast Scalar estimators — contains
robust_vol_calcandmixed_vol_calcfor daily volatility estimation, andforecast_scalarfor scaling forecasts. - accounts: P&L calculation framework — contains
account_forecastfor generating P&L curves from forecasts and prices.
From the repo root:
cd quantlibpython -m pip install -e .
This installs the quantlib command.
uv sync --extra dev
Pull a published image from GitHub Container Registry:
docker pull ghcr.io/rodionlim/quantlib-st:latest
Run a quick correlation query by piping a CSV into the container (one-liner):
cat sample_data/returns_10x4.csv | docker run --rm -i ghcr.io/rodionlim/quantlib-st:latest corr --min-periods 3 --ew-lookback 10
When publishing the image the Makefile also tags and pushes :latest in addition to the versioned tag.
import pandas as pd
import numpy as np
from quantlib_st import correlation
# Sample data
data = pd.DataFrame(
np.random.randn(100, 3),
columns=['Asset_A', 'Asset_B', 'Asset_C'],
index=pd.date_range(start='2020-01-01', periods=100, freq='D') # daily dates
)
# Compute correlation matrix
corr_matrix = correlation.correlation_over_time(
data,
is_price_series=False,
frequency='D', # resampling purpose
interval_frequency='7D',
date_method='expanding',
ew_lookback=50,
min_periods=10
)
print(corr_matrix.as_("jsonable"))
print(corr_matrix.as_("long"))