Skip to main content

A high-performance financial valuation library

Project description

VelesQuant

VelesQuant is a high-performance financial valuation library written in C++ and exposed to Python using pybind11. It provides tools for pricing complex financial derivatives using advanced models and numerical techniques.

Quick Start

VelesQuant provides high-level Python wrappers in velesquant.models for ease of use.

import numpy as np
from velesquant.models import SabrModel, HestonModel, HullWhiteModel
from velesquant.market.curves import DiscountCurve

# --- SABR Volatility Model ---
sabr = SabrModel(maturity=1.0, forward=100.0, beta=0.5)

# Calibrate to market data
strikes = [90.0, 100.0, 110.0]
quotes = [0.25, 0.20, 0.22]  # Implied volatilities
sabr.calibrate(strikes=strikes, quotes=quotes, calibration_target="Volatility")

print(f"Calibrated SABR: alpha={sabr.alpha:.4f}, nu={sabr.nu:.4f}, rho={sabr.rho:.4f}")

# Get implied volatility for a strike
iv = sabr.implied_vol(105.0)

# --- Heston Stochastic Volatility ---
heston = HestonModel(spot=100.0, var0=0.04, kappa=2.0, theta=0.04, xi=0.3, rho=-0.7, seed=42)

# Price a vanilla option
price = heston.price_option(maturity=1.0, forward=100.0, strike=100.0, option_type="call")

# --- Hull-White Interest Rate Model ---
# 1. Define a Discount Curve
curve = DiscountCurve(
    times=[0.0, 1.0, 5.0, 10.0],
    dfs=[1.0, 0.95, 0.80, 0.65]
)

# 2. Initialize Model
hw = HullWhiteModel(kappa=0.1, sigma=0.01)

# 3. Price a Swaption
from velesquant.instruments.rates import Swaption
swaption = Swaption(expiry=1.0, tenor=5.0, strike=0.03, pay_frequency=0.5)
price = hw.price(swaption, curve)

# 4. Simulate Short Rate (Vectorized)
times = np.array([0.25, 0.5, 0.75, 1.0])
paths = hw.simulate(times, curve)

Available Models

Model Class Description
SABR SabrModel Stochastic Alpha Beta Rho volatility model
Heston HestonModel Stochastic variance model
Local Vol LocalVolModel Local volatility from SABR slices
Hull-White HullWhiteModel 1-Factor short rate model
ShortRate2F ShortRate2FPDEModel 2-Factor G2++ short rate model
CMS CMSModel Constant Maturity Swap pricing
CMS Spread CMSSpreadModel CMS Spread Option pricing (Copula)
Basket LogNormalBasketModel Multi-asset Log-Normal Basket
Quantoed CMS QuantoedCMSModel Quantoed Constant Maturity Swap
Quantoed Spread QuantoedCMSSpreadModel Quantoed CMS Spread Option
Heston Hull-White HybridHWModel Hybrid Equity-Interest Rate Model

For a comprehensive list of supported financial instruments and their pricing methods, please refer to Supported Instruments.

Performance

VelesQuant is built for extreme performance:

  • C++20 Core: Leveraging modern language features for safety and speed.
  • SIMD Optimized: Critical numerical paths are designed for vectorization.
  • Multi-threaded: Parallel PDE solvers and Monte Carlo simulations utilizing OpenMP.
  • QuantLib Integration: Built on top of the industry-standard QuantLib library.

Testing

Python Tests

The recommended way to develop is using uv for lightning-fast environment management:

uv sync --all-extras
uv run pytest

Alternatively, using standard pip:

pip install ".[dev]"
pytest

If using poetry:

poetry run pytest

C++ Tests

./build/tests_cpp/velesquant_tests

Contributing

We welcome contributions! Please follow these steps:

  1. Bug Reports: Open an issue describing the bug and providing a reproducible example.
  2. Feature Requests: Use the issue tracker to propose new features.
  3. Pull Requests:
    • Fork the repository.
    • Create a feature branch.
    • Ensure all C++ and Python tests pass.
    • Submit a PR with a clear description of changes.

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

velesquant-0.1.0.tar.gz (222.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

velesquant-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

velesquant-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (10.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

velesquant-0.1.0-cp312-cp312-macosx_10_9_x86_64.whl (11.1 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

velesquant-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

velesquant-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (10.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

velesquant-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl (11.1 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

File details

Details for the file velesquant-0.1.0.tar.gz.

File metadata

  • Download URL: velesquant-0.1.0.tar.gz
  • Upload date:
  • Size: 222.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for velesquant-0.1.0.tar.gz
Algorithm Hash digest
SHA256 76e6965e55df145308d74cb08fa5414f60912986d9daab235eeea99602f7d44e
MD5 de975edc337ffee19b2e3490cf82c7d9
BLAKE2b-256 3f751b6cbcaea5b3b6751926d2801dcd4f8ad38a8d85b49340e771d248997042

See more details on using hashes here.

Provenance

The following attestation bundles were made for velesquant-0.1.0.tar.gz:

Publisher: build_wheels.yml on suren777/VelesQuant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file velesquant-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for velesquant-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 add21641f9bafe462f4e52671aebbf6816f1d1d5eceb35da79ef9dbb948e773c
MD5 97f663c3691db38bd8d483a3fe5c15fe
BLAKE2b-256 5ae369a1642cfa7ae978711a26f3e21def9d5134f86a0a84dc855f543452a82a

See more details on using hashes here.

Provenance

The following attestation bundles were made for velesquant-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: build_wheels.yml on suren777/VelesQuant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file velesquant-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for velesquant-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 06d96a3ee68b47a1a1e878cae0de3aafede1b8f73992c062186256bab8dc20ff
MD5 f78ca03333e6070a9f2028fee6f36753
BLAKE2b-256 6a6ecffa760595fee5744b500013a2b8ca7287228768568d4b2fcb1fa93d2216

See more details on using hashes here.

Provenance

The following attestation bundles were made for velesquant-0.1.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: build_wheels.yml on suren777/VelesQuant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file velesquant-0.1.0-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for velesquant-0.1.0-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1de7b5872ba5eafe99c2d0de5bb086e6ac09b804a54f7d94bbdbca99599c1a18
MD5 f503b704494e8a7949e0a1a9f3b5e667
BLAKE2b-256 8f8e724d27049489a1301e02f4d201edb80ad2a84d2383ed48ef4a25c787ecaf

See more details on using hashes here.

Provenance

The following attestation bundles were made for velesquant-0.1.0-cp312-cp312-macosx_10_9_x86_64.whl:

Publisher: build_wheels.yml on suren777/VelesQuant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file velesquant-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for velesquant-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1c0d943d4a1d980bc3879d2986cfd033d31815269b1f2b5d3619fa574a94e0e0
MD5 acc555cbf80beb0faf9c149b7909f422
BLAKE2b-256 913475bc4149932df31a3fd0d099e3cdf76d070bafc5d55b44060f4b632e3dbf

See more details on using hashes here.

Provenance

The following attestation bundles were made for velesquant-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: build_wheels.yml on suren777/VelesQuant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file velesquant-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for velesquant-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 09d3b4796361765c18f394b137d1b8799a7870ed7a394b6e611bb688a221a550
MD5 0871f34ed0fdfeb145ae0e2abfc5dd9f
BLAKE2b-256 27e4dde86d236479f45405f695056055f7a147d1a93648938037948f2210f896

See more details on using hashes here.

Provenance

The following attestation bundles were made for velesquant-0.1.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: build_wheels.yml on suren777/VelesQuant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file velesquant-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for velesquant-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 736d1d34181b7a28f3a50f2e27c6be9bd28a40c3a1f496f801bc61795a6efb3e
MD5 c2ee410d1f97b8b68fd354e4a5d26625
BLAKE2b-256 7e4d0c118be17a650c6d7c31a5a03f377abea2a315510d55f96f47aa82c3626f

See more details on using hashes here.

Provenance

The following attestation bundles were made for velesquant-0.1.0-cp311-cp311-macosx_10_9_x86_64.whl:

Publisher: build_wheels.yml on suren777/VelesQuant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page