Skip to main content

FinceptQuantLib

PyPI Python CI License: MIT

Quantitative finance library from Fincept Corporation: pricing, risk and analytics for fixed income, derivatives and portfolios. Pure Python on top of SciPy, typed, and validated against SciPy and closed-form references.

Installation

pip install finceptquantlib

Requires Python 3.11+.

Quick start

from datetime import date
import finceptquantlib as fql

# Curves, swaps and bonds
curve = fql.ZeroCurve(date(2025, 1, 15), [0.5, 1, 2, 5, 10], [0.040, 0.041, 0.042, 0.043, 0.045])
swap = fql.InterestRateSwap(10_000_000, date(2025, 1, 15), date(2030, 1, 15), fixed_rate=0.042)
swap.par_rate(date(2025, 1, 15), curve)                                  # 0.04378

bond = fql.FixedRateBond(date(2025, 1, 15), date(2035, 1, 15), coupon_rate=0.045)
bond.price_from_yield(0.05, settlement_date=date(2025, 1, 15))           # 96.1027

# Options
call = fql.bs_call(S=100, K=105, r=0.03, q=0.01, sigma=0.25, T=1.0)      # 8.6124
fql.bs_implied_vol(call, S=100, K=105, r=0.03, q=0.01, T=1.0,
                   option_type=fql.OptionType.CALL)                      # 0.25

heston = fql.HestonModel(
    fql.HestonParameters(v0=0.04, kappa=1.5, theta=0.05, sigma=0.5, rho=-0.7),
    spot=100, rate=0.03, dividend=0.01,
)
heston.european_call_price(105, 1.0)                                     # 5.9313

# Portfolios and risk
cov = [[0.040, 0.006, 0.010], [0.006, 0.090, 0.012], [0.010, 0.012, 0.0625]]
weights = fql.max_sharpe_portfolio([0.08, 0.12, 0.10], cov, rf_rate=0.02).weights
fql.calculate_var(weights, cov, confidence=0.95, portfolio_value=1_000_000)  # 267,522

Every public name is available from the top-level package and from its subpackage (fql.ZeroCurve is finceptquantlib.curves.ZeroCurve).

Modules

Module Provides
core Forward-mode automatic differentiation (Dual, HyperDual, gradients, Hessians), Rate, Money, Tenor, Currency, coupon periods and legs
scheduling ISDA day counts, US / UK / TARGET / Japan calendars, business-day rules, schedule generation
curves Discount, zero and forward curves, Nelson-Siegel(-Svensson), inflation and multi-curve frameworks, curve shifts
instruments Fixed, floating, zero-coupon and inflation-linked bonds; IRS, OIS, basis, cross-currency and inflation swaps; FRAs, futures, caps/floors, swaptions; FX forwards and options; CDS; equity, commodity, convertible and exotic options
pricing Black-Scholes, Black-76, Bachelier, Kirk and Margrabe formulas, Greeks, implied volatility, binomial trees
models Heston, SABR, Merton, Kou and Variance Gamma, Dupire / SVI local volatility, Vasicek, CIR, Hull-White, Black-Karasinski
volatility Volatility surfaces and cubes, SABR calibration, local volatility
solver Curve bootstrapping, root finding, yield / spread / duration analytics
risk Historical, parametric and Monte Carlo VaR / ES, backtesting, sensitivities, stress tests, XVA, copulas, extreme value theory
portfolio Mean-variance optimisation, efficient frontier, Black-Litterman, risk parity, hierarchical risk parity
regulatory Basel III/IV capital, SA-CCR, FRTB standardised approach, IFRS 9 ECL, LCR / NSFR, stress testing
analysis Financial statement ratios, DuPont, earnings quality, DCF and residual income valuation, bank / insurer / REIT / utility analysis
stochastic Brownian, mean-reverting, jump and Lévy processes; Euler-Maruyama, Milstein, exact and multilevel Monte Carlo simulation
statistics Continuous and discrete distributions, ARIMA, GARCH, EGARCH, GJR-GARCH
numerical Linear algebra, interpolation, quadrature, root finding, optimisation, FFT, Carr-Madan / Lewis / COS Fourier pricing
ml Credit scorecards (WoE, logistic, calibration), model validation, regime and changepoint detection, ML curve and portfolio models
economics Utility functions, normal-form games and auctions, general equilibrium
physics Information theory (entropy, transfer entropy), statistical mechanics, thermodynamics

Development

git clone https://github.com/Fincept-Corporation/finceptquantlib.git
cd finceptquantlib
pip install -e ".[dev]"
pytest            # unit tests and docstring examples
ruff check src tests

See CONTRIBUTING.md for guidelines and CHANGELOG.md for release notes.

License

MIT. See LICENSE.

FinceptQuantLib is provided for research and analytics. It is not investment advice; validate results independently before relying on them for trading, risk or regulatory reporting.

Metadata

Release files for finceptquantlib 1.0.0

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

Source distribution (sdist)

Source distribution for finceptquantlib 1.0.0
File Size Uploaded Provenance Actions
finceptquantlib-1.0.0.tar.gz 691.1 kB Without provenance Details for finceptquantlib-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for finceptquantlib 1.0.0
File Interpreter ABI Platform Actions
finceptquantlib-1.0.0-py3-none-any.whl Python 3 none any Details for finceptquantlib-1.0.0-py3-none-any.whl

Total release size: 1.5 MB

Release files / finceptquantlib-1.0.0.tar.gz

Download URL finceptquantlib-1.0.0.tar.gz
Size 691.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b7765c2c41a4e80eb63057ccc7f5f2251b9ed372a6706e1a411e6e2fa03b9570
BLAKE2b-256 checksum
How to use checksums
e9c5ae6c3a380b55ee6e6821a8f8e5c0627942ba81d6f0dca195d7f0f864aef9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / finceptquantlib-1.0.0-py3-none-any.whl

Download URL finceptquantlib-1.0.0-py3-none-any.whl
Size 831.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d147227d76edaa68f432432a4ae69c92088ad1f2c6f965677983c669c4b58df
BLAKE2b-256 checksum
How to use checksums
adcbcf84ac7c0b81ebcc18f29d9a04eb9cebeb6e1dbf0d1b24aaafeec44ffcd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Security for finceptquantlib 1.0.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.

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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