Skip to main content

CoreDesk: quant dev-oriented Python library for pricing, risk, and calibration.

Project description

CoreDesk

CoreDesk is an open-source, quant-dev–oriented Python library for pricing, risk, and calibration of vanilla derivatives.

It is designed to provide clean, explicit, desk-grade building blocks for quantitative finance, with a strong focus on numerical robustness, readability, and testability.


🧭 Philosophy

CoreDesk follows four core principles:

  • Explicit over implicit No hidden globals, no silent conventions.

  • Separation of concerns Products ≠ Models ≠ Market ≠ Engines.

  • Numerical robustness Bracketing, tolerances, clear failure modes.

  • Desk-grade readability Code written to be read, reviewed, and extended.

This makes CoreDesk suitable for:

  • quantitative finance education
  • research notebooks
  • interview preparation
  • prototyping pricing libraries
  • model validation and experimentation

🧱 Architecture overview

coredesk/
├─ core/           # numerical foundations
├─ market/         # conventions & market environment
├─ products/       # financial instruments (payoff only)
├─ models/         # model parameters (no pricing logic)
├─ engines/        # pricing engines
├─ risk/           # Greeks
├─ calibration/    # implied volatility
└─ api/            # user-facing helpers

Module responsibilities

Module Responsibility
core math, stats, roots, interpolation, linalg, RNG
market day count, rate conventions, market inputs
products contract definitions (payoff only)
models model parameters (volatility, dynamics)
engines pricing logic
risk Greeks
calibration implied volatility
api simplified public interface

✨ Features (v0.1)

  • European vanilla options

  • Black–Scholes–Merton (spot + dividend yield)

  • Black 76 (options on forwards/futures)

  • Closed-form pricing

  • Analytic Greeks (Delta, Gamma, Vega)

  • Implied volatility (Brent solver)

  • Robust numerical core:

    • root finding (bisect / brent / newton)
    • interpolation (linear / log-linear)
    • Cholesky & correlation repair
    • reproducible RNG
  • Fully tested (pytest)


📦 Installation

From source (recommended)

git clone https://github.com/baptiste-dehay/coredesk.git
cd coredesk
pip install -e .[dev]

Run tests

python -m pytest

🚀 Quick start (API)

Black–Scholes price

from coredesk.api.vanilla import bsm_price

price = bsm_price(
    spot=100.0,
    strike=110.0,
    maturity=1.0,
    option_type="call",
    sigma=0.30,
    r=0.02,
    q=0.01,
)

print(price)

Greeks

from coredesk.api.vanilla import bsm_greeks

greeks = bsm_greeks(
    spot=100.0,
    strike=110.0,
    maturity=1.0,
    option_type="call",
    sigma=0.30,
    r=0.02,
    q=0.01,
)

print(greeks.delta, greeks.gamma, greeks.vega)

Implied volatility (BSM)

from coredesk.api.vanilla import bsm_iv

iv = bsm_iv(
    price=price,
    spot=100.0,
    strike=110.0,
    maturity=1.0,
    option_type="call",
    r=0.02,
    q=0.01,
)

print(iv)

Black 76 (options on forwards / futures)

from coredesk.api.vanilla import black76_price, black76_iv

price = black76_price(
    forward=100.0,
    strike=95.0,
    maturity=2.0,
    option_type="put",
    sigma=0.25,
    r=0.01,
)

iv = black76_iv(
    price=price,
    forward=100.0,
    strike=95.0,
    maturity=2.0,
    option_type="put",
    r=0.01,
)

print(price, iv)

📚 Glossary of functions (Public API)

Pricing

Function Description
bsm_price Black–Scholes–Merton price (spot + dividend yield)
black76_price Black 76 price (options on forwards/futures)

Greeks

Function Description
bsm_greeks Delta, Gamma, Vega (spot)
black76_greeks Delta, Gamma, Vega (forward)

Calibration

Function Description
bsm_iv Implied volatility under BSM
black76_iv Implied volatility under Black 76

📐 Core numerical toolbox

core.stats

  • normal_pdf
  • normal_cdf
  • normal_ppf

core.roots

  • bisect
  • newton
  • brent

core.interpolation

  • linear_interp
  • log_linear_interp
  • Interp1D

core.linalg

  • cholesky
  • nearest_correlation
  • check_correlation_matrix

core.random

  • RNG
  • standard normals
  • antithetic sampling

🛣️ Roadmap (Applications)

v0.2 — Curves & discounting

  • Yield curves
  • Discount factors
  • Bootstrapping

v0.3 — Volatility

  • Volatility surfaces
  • Smile calibration
  • Surface interpolation / extrapolation

v0.4 — Monte Carlo

  • GBM path simulation
  • Multi-asset correlation
  • Greeks via Monte Carlo

v0.5 — Advanced products

  • American options (LSM)
  • Barrier options
  • Asian options

🧪 Testing & quality

  • 100% pytest-based
  • Finite-difference validation for Greeks
  • Numerical tolerances explicit
  • Designed to be CI-friendly

📄 License

Open-source (see LICENSE).


👤 Author

Baptiste Dehay Quantitative Finance / Financial Engineering "Baptiste is analyzing, the world is watching"

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

coredesk-0.1.0.tar.gz (36.8 kB view details)

Uploaded Source

Built Distribution

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

coredesk-0.1.0-py3-none-any.whl (34.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coredesk-0.1.0.tar.gz
  • Upload date:
  • Size: 36.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for coredesk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b31ca1d5a662c706b641b35600bc7b559e7128ce1d28c7d9630e4b54824335bc
MD5 d51126247138182a275fba25fec5e45c
BLAKE2b-256 3894cbfa61d065d41dbe60d567eefdfe37a34fa0bc79a5b4c284dab86df79bb7

See more details on using hashes here.

File details

Details for the file coredesk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: coredesk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 34.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for coredesk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3462806707871570ae381af21dad58dce602427582c97a98af84b3dde4e56b9
MD5 7ef5889a6dfae7086c80c522d3cd2d55
BLAKE2b-256 5b04535ef17f299aa696e74f1807b044bc28d758f8fd2c42db21879769e151d4

See more details on using hashes here.

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