Skip to main content

btQuant

btQuant is the Python companion package for Systematic Index Partners (SIP Global) quantitative infrastructure. It provides tools for quantitative finance, econometrics, simulation, portfolio optimization, and risk analytics. This package is intended for professional developers and researchers.

PyPI Downloads

About SIP

Systematic Index Partners (SIP Global) is a quantitative investment and market infrastructure firm focused on alternative and underdeveloped markets. We design and deploy systematic trading strategies, indices, and market infrastructure to enable market making, price discovery, and brokerage in low-liquidity or previously unstructured markets.

Our quantitative systems support structured pricing, standardized contracts, and repeatable trading processes. These systems are deployed alongside physical and digital infrastructure, including trading hubs, delivery points, data pipelines, execution tools, and operational platforms to ensure markets function efficiently.

SIP participates actively in the markets we develop, providing liquidity, facilitating transactions, and supporting both physical and financial trading activity. By combining quantitative strategy, infrastructure, and market participation, SIP enables liquidity, price transparency, and sustainable market development.

Installation

Install btQuant via PyPI:

pip install btQuant

Design Philosophy

  • Pure NumPy implementation for all mathematics
  • Optimized vectorized operations for performance
  • Consistent API with camelCase function names
  • Lightweight outputs using arrays and dictionaries
  • Production-ready code suitable for professional environments

Modules

options.py

Option pricing and Greeks calculation

  • blackScholes() Black-Scholes European options with cost of carry
  • binomial() Binomial tree (European/American)
  • trinomial() Trinomial tree (European/American)
  • asian() Asian options (geometric averaging)
  • binary() Binary/digital options
  • spread() Two-asset spread options
  • barrier() Barrier options with rebate
  • simulate() Monte Carlo simulation wrapper
  • impliedVol() Implied volatility calculation
  • buildForwardCurve() Forward curve construction
  • bootstrapCurve() Bootstrap convenience yields from futures

econometrics.py

Econometric analysis and hypothesis testing

  • ols() Ordinary least squares with robust standard errors
  • whiteTest() White's heteroskedasticity test
  • breuschPaganTest() Breusch-Pagan test
  • durbinWatson() Durbin-Watson autocorrelation statistic
  • ljungBox() Ljung-Box autocorrelation test
  • adfTest() Augmented Dickey-Fuller unit root test
  • kpssTest() KPSS stationarity test
  • grangerCausality() Granger causality testing

ml.py

Machine learning algorithms

  • regressionTree() / decisionTree() Tree-based models
  • predictTree() Tree prediction
  • isolationForest() / anomalyScore() Anomaly detection
  • kmeans() K-means clustering
  • knn() K-nearest neighbors
  • naiveBayes() Gaussian naive Bayes
  • randomForest() Random forest regressor
  • gradientBoosting() Gradient boosting regressor
  • pca() / lda() Dimensionality reduction
  • logisticRegression() Logistic regression classifier

portfolio.py

Portfolio optimization and allocation

  • blackLitterman() Black-Litterman model
  • meanVariance() Mean-variance optimization
  • minVariance() Minimum variance portfolio
  • riskParity() Risk parity allocation
  • equalWeight() Equal weight portfolio
  • maxDiversification() Maximum diversification
  • tangency() / maxSharpe() Tangency/maximum Sharpe portfolio
  • efficientFrontier() Efficient frontier computation
  • hierarchicalRiskParity() HRP allocation
  • minCvar() Minimum CVaR portfolio

risk.py

Risk metrics and measures

  • parametricVar() / historicalVar() Value at Risk
  • parametricCvar() / historicalCvar() Conditional VaR
  • expectedShortfall() Expected shortfall
  • drawdown() / maxDrawdownDuration() Drawdown analysis
  • calmarRatio() / sharpeRatio() / sortinoRatio() Performance ratios
  • omegaRatio() / treynorRatio() / informationRatio() Additional ratios
  • modifiedVar() / hillTailIndex() Advanced risk measures
  • beta() Systematic risk
  • downsideDeviation() / ulcerIndex() / painIndex() Downside risk
  • tailRatio() / capturRatio() / stabilityRatio() Additional metrics

sim.py

Time series simulation

  • gbm() Geometric Brownian Motion
  • ou() Ornstein-Uhlenbeck process
  • levyOu() Lévy OU (OU with jumps)
  • ar1() / arma() ARMA processes
  • markovSwitching() Regime switching models
  • arch() / garch() Volatility models
  • heston() Heston stochastic volatility
  • cir() / vasicek() Interest rate models
  • poisson() / compoundPoisson() Jump processes
  • simulate() General dispatcher function

bootstrap.py

Curve and surface bootstrapping

  • curve() 1D curve interpolation (linear/cubic/pchip)
  • surface() 2D surface interpolation
  • zeroRateCurve() Zero rate curve from bond prices
  • forwardCurve() Forward rate derivation
  • discountCurve() Discount factor curve
  • yieldCurve() Yield curve bootstrapping
  • volSurface() Implied volatility surface
  • creditCurve() CDS curve bootstrapping
  • fxForwardCurve() FX forward curve
  • inflationCurve() Inflation curve from breakevens

dimension.py

Dimensionality reduction techniques

  • pca() Principal Component Analysis
  • lda() Linear Discriminant Analysis
  • tsne() t-SNE
  • ica() Independent Component Analysis
  • nmf() Non-negative Matrix Factorization
  • kernelPca() Kernel PCA (RBF/poly/linear)
  • mds() Multidimensional Scaling
  • isomap() Isomap

distributions.py

Distribution fitting and testing

  • fitNormal() / fitLognormal() / fitExponential() Parametric fitting
  • fitGamma() / fitBeta() / fitT() Additional distributions
  • fitMixture() Gaussian mixture models (EM algorithm)
  • moments() Calculate distribution moments
  • ksTest() Kolmogorov-Smirnov test
  • adTest() Anderson-Darling test
  • klDivergence() / jsDivergence() Distribution divergence
  • quantile() Quantile calculation
  • qqPlot() Q-Q plot data generation

factor.py

Factor models and analysis

  • famaFrench3() Fama-French 3-factor model
  • carhart4() Carhart 4-factor model
  • apt() Arbitrage Pricing Theory
  • capm() Capital Asset Pricing Model
  • estimateBeta() Beta estimation
  • estimateFactorLoading() Factor loading estimation
  • rollingBeta() Rolling beta calculation
  • pcaFactors() PCA factor extraction
  • factorMimicking() Factor-mimicking portfolios (SMB/HML)
  • jensenAlpha() Jensen's alpha
  • treynorMazuy() Market timing model
  • multifactor() Multi-factor regression

fit.py

Time series model fitting

  • fitGbm() Fit GBM to prices
  • fitOu() Fit OU process
  • fitLevyOU() Fit Levy OU process (OU with jumps)
  • fitAr1() / fitArma() ARMA model fitting
  • fitGarch() GARCH model fitting
  • fitHeston() Heston model fitting
  • fitCir() / fitVasicek() Interest rate model fitting
  • fitJumpDiffusion() Jump-diffusion model fitting
  • fitCopula() Gaussian copula fitting
  • fitDistributions() Multi-distribution fitting with AIC ranking
  • aic() / bic() Information criteria

Usage Examples

import numpy as np
from options import blackScholes
from risk import sharpeRatio
from sim import gbm
from portfolio import riskParity

# Option pricing
result = blackScholes(S=100, K=100, T=1, r=0.05, sigma=0.2, optType='call')
print(f"Call price: {result['price']:.2f}, Delta: {result['delta']:.3f}")

# Risk calculation
returns = np.random.normal(0.001, 0.02, 252)
sharpe = sharpeRatio(returns, riskFreeRate=0.0001)
print(f"Sharpe ratio: {sharpe:.3f}")

# Simulation
paths = gbm(mu=0.1, sigma=0.2, nSteps=252, nSims=1000, s0=100)
print(f"Simulated paths shape: {paths.shape}")

# Portfolio optimization
covMatrix = np.array([[0.04, 0.01], [0.01, 0.09]])
weights = riskParity(covMatrix)
print(f"Risk parity weights: {weights}")

Documentation

Full documentation will be available at btQuant Documentation.

Converting to Pandas or Polars

All functions return NumPy arrays or dicts. Convert to DataFrames as needed:

import pandas as pd
import polars as pl

paths = gbm(mu=0.1, sigma=0.2, nSteps=252, nSims=100)
df_pandas = pd.DataFrame(paths.T, columns=[f'sim_{i}' for i in range(100)])
df_polars = pl.DataFrame(paths.T)

License

This project is licensed under GPL-3.0.

Contact

For inquiries regarding btQuant, contact:

Metadata

Release files for btQuant 1.0.3

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

Source distribution (sdist)

Source distribution for btQuant 1.0.3
File Size Uploaded
btquant-1.0.3.tar.gz 51.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for btQuant 1.0.3
File Interpreter ABI Platform
btquant-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 104.4 kB

Release files / btquant-1.0.3.tar.gz

Download URL btquant-1.0.3.tar.gz
Size 51.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9bb068123d0e5a93367e644b18ace22e57c6fda95f31f24f4a14efaa764fd630
BLAKE2b-256 checksum
How to use checksums
112ba9295e00a521ec57b2d972019e39bdc613fd57db6e32edb0a6a569cf784a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / btquant-1.0.3-py3-none-any.whl

Download URL btquant-1.0.3-py3-none-any.whl
Size 52.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6afc72f78ff2ced6d12bf9941a48178cef9113597ab9f4befaccdc45833fbaf7
BLAKE2b-256 checksum
How to use checksums
3c3c7a07443871dd3cf74a7b484968ca9c0b4d72ca282498a2998c02a4d55db0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

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