Boyko Terminal Quantitative Finance Python Package Companion.
Project description
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.
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 carrybinomial()Binomial tree (European/American)trinomial()Trinomial tree (European/American)asian()Asian options (geometric averaging)binary()Binary/digital optionsspread()Two-asset spread optionsbarrier()Barrier options with rebatesimulate()Monte Carlo simulation wrapperimpliedVol()Implied volatility calculationbuildForwardCurve()Forward curve constructionbootstrapCurve()Bootstrap convenience yields from futures
econometrics.py
Econometric analysis and hypothesis testing
ols()Ordinary least squares with robust standard errorswhiteTest()White's heteroskedasticity testbreuschPaganTest()Breusch-Pagan testdurbinWatson()Durbin-Watson autocorrelation statisticljungBox()Ljung-Box autocorrelation testadfTest()Augmented Dickey-Fuller unit root testkpssTest()KPSS stationarity testgrangerCausality()Granger causality testing
ml.py
Machine learning algorithms
regressionTree()/decisionTree()Tree-based modelspredictTree()Tree predictionisolationForest()/anomalyScore()Anomaly detectionkmeans()K-means clusteringknn()K-nearest neighborsnaiveBayes()Gaussian naive BayesrandomForest()Random forest regressorgradientBoosting()Gradient boosting regressorpca()/lda()Dimensionality reductionlogisticRegression()Logistic regression classifier
portfolio.py
Portfolio optimization and allocation
blackLitterman()Black-Litterman modelmeanVariance()Mean-variance optimizationminVariance()Minimum variance portfolioriskParity()Risk parity allocationequalWeight()Equal weight portfoliomaxDiversification()Maximum diversificationtangency()/maxSharpe()Tangency/maximum Sharpe portfolioefficientFrontier()Efficient frontier computationhierarchicalRiskParity()HRP allocationminCvar()Minimum CVaR portfolio
risk.py
Risk metrics and measures
parametricVar()/historicalVar()Value at RiskparametricCvar()/historicalCvar()Conditional VaRexpectedShortfall()Expected shortfalldrawdown()/maxDrawdownDuration()Drawdown analysiscalmarRatio()/sharpeRatio()/sortinoRatio()Performance ratiosomegaRatio()/treynorRatio()/informationRatio()Additional ratiosmodifiedVar()/hillTailIndex()Advanced risk measuresbeta()Systematic riskdownsideDeviation()/ulcerIndex()/painIndex()Downside risktailRatio()/capturRatio()/stabilityRatio()Additional metrics
sim.py
Time series simulation
gbm()Geometric Brownian Motionou()Ornstein-Uhlenbeck processlevyOu()Lévy OU (OU with jumps)ar1()/arma()ARMA processesmarkovSwitching()Regime switching modelsarch()/garch()Volatility modelsheston()Heston stochastic volatilitycir()/vasicek()Interest rate modelspoisson()/compoundPoisson()Jump processessimulate()General dispatcher function
bootstrap.py
Curve and surface bootstrapping
curve()1D curve interpolation (linear/cubic/pchip)surface()2D surface interpolationzeroRateCurve()Zero rate curve from bond pricesforwardCurve()Forward rate derivationdiscountCurve()Discount factor curveyieldCurve()Yield curve bootstrappingvolSurface()Implied volatility surfacecreditCurve()CDS curve bootstrappingfxForwardCurve()FX forward curveinflationCurve()Inflation curve from breakevens
dimension.py
Dimensionality reduction techniques
pca()Principal Component Analysislda()Linear Discriminant Analysistsne()t-SNEica()Independent Component Analysisnmf()Non-negative Matrix FactorizationkernelPca()Kernel PCA (RBF/poly/linear)mds()Multidimensional Scalingisomap()Isomap
distributions.py
Distribution fitting and testing
fitNormal()/fitLognormal()/fitExponential()Parametric fittingfitGamma()/fitBeta()/fitT()Additional distributionsfitMixture()Gaussian mixture models (EM algorithm)moments()Calculate distribution momentsksTest()Kolmogorov-Smirnov testadTest()Anderson-Darling testklDivergence()/jsDivergence()Distribution divergencequantile()Quantile calculationqqPlot()Q-Q plot data generation
factor.py
Factor models and analysis
famaFrench3()Fama-French 3-factor modelcarhart4()Carhart 4-factor modelapt()Arbitrage Pricing Theorycapm()Capital Asset Pricing ModelestimateBeta()Beta estimationestimateFactorLoading()Factor loading estimationrollingBeta()Rolling beta calculationpcaFactors()PCA factor extractionfactorMimicking()Factor-mimicking portfolios (SMB/HML)jensenAlpha()Jensen's alphatreynorMazuy()Market timing modelmultifactor()Multi-factor regression
fit.py
Time series model fitting
fitGbm()Fit GBM to pricesfitOu()Fit OU processfitLevyOU()Fit Levy OU process (OU with jumps)fitAr1()/fitArma()ARMA model fittingfitGarch()GARCH model fittingfitHeston()Heston model fittingfitCir()/fitVasicek()Interest rate model fittingfitJumpDiffusion()Jump-diffusion model fittingfitCopula()Gaussian copula fittingfitDistributions()Multi-distribution fitting with AIC rankingaic()/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:
- Brayden Boyko (brayden@sipglobally.com)
Project details
Release history Release notifications | RSS feed
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 btquant-1.0.3.tar.gz.
File metadata
- Download URL: btquant-1.0.3.tar.gz
- Upload date:
- Size: 51.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bb068123d0e5a93367e644b18ace22e57c6fda95f31f24f4a14efaa764fd630
|
|
| MD5 |
75857b02366acb8ef3b4b371a1016869
|
|
| BLAKE2b-256 |
112ba9295e00a521ec57b2d972019e39bdc613fd57db6e32edb0a6a569cf784a
|
File details
Details for the file btquant-1.0.3-py3-none-any.whl.
File metadata
- Download URL: btquant-1.0.3-py3-none-any.whl
- Upload date:
- Size: 52.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6afc72f78ff2ced6d12bf9941a48178cef9113597ab9f4befaccdc45833fbaf7
|
|
| MD5 |
1da8f99d6a7f87e8f5e0672c46faa53a
|
|
| BLAKE2b-256 |
3c3c7a07443871dd3cf74a7b484968ca9c0b4d72ca282498a2998c02a4d55db0
|