Skip to main content

SDev.Python

Python repository for various tools and projects in Machine Learning for Quantitative Finance. In the current release, we focus on stochastic volatility surfaces and their calibration through Machine Learning methods. See other work on our main website SDev-Finance.

Stochastic volatility calibration

In this project we use Neural Networks to improve the calibration speed for stochastic volatility models. For now we consider only the direct map, i.e. the calculation from model parameters to implied volatilities.

We first generate datasets of parameters (inputs) and vanilla option prices (outputs) and then train the network to replicate the prices. In this manner, the learning model is used as a pricing function to replace costly closed-forms or PDE/MC price calculations.

Our models can be saved to files for later usage, and can be re-trained from a saved state. We cover (Hagan) SABR, No-Arbitrage SABR (i.e. the actual SABR dynamic), Free-Boundary SABR, ZABR and Heston models.

Jupyter notebooks are available for demo under ./notebooks.

Trained models are saved under ./models/stovol. Sample training data is provided under ./datasets/stovol. However, these are only small sets for demo (50k samples). The larger sets we used for training (500k-2m) can be downloaded from our Kaggle account.

The notebook ./notebooks/StoVol Dataset Generation.ipynb can be used to generate samples (beware of setting up output paths to your local drive). The notebook ./notebooks/StoVol Training.ipynb can be used to train models (pre-trained or not) on the samples. The .py scripts corresponding to these notebooks are under examples/stovol.

AAD Monte-Carlo

In script ./examples/aad/aad_mc.py, we show how to calculate 1st and 2nd order Greeks on a Monte-Carlo simulation of Black-Scholes model (1 asset) using AAD. We compare the results with standard Monte-Carlo Greeks by Finite Differences and the closed-form. We make use of payoff smoothers for both AAD and Standard MC.

In ./examples/aad/aad_mc_nd.py, we compare AAD to standard MC and Closed-Form on a product with generic dimension. We can then benchmark the performance of AAD compared to MC bump-based sensitivities varying dimension and number of simulations.

Other Tools

The package contains various other tools including Black-Scholes/Bachelier formulas, Monte-Carlo simulation of vanilla prices and other utilities. It also features a wrapper class above Keras for easier management of trained models with their scalers, as well as custom callbacks and learning schedules.

Jupyter notebooks of previous work are also available (PINNs, AAD Monte-Carlo) but are not yet integrated in the framework.

Metadata

Release files for sdevpy 1.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 sdevpy 1.3
File Size Uploaded Provenance Actions
sdevpy-1.3.tar.gz 25.0 MB Without provenance Details for sdevpy-1.3.tar.gz

Built distribution (wheel)

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

Total release size: 50.0 MB

Release files / sdevpy-1.3.tar.gz

Download URL sdevpy-1.3.tar.gz
Size 25.0 MB
Tags Source
SHA-256 checksum
How to use checksums
49e523ec5525905724ce1ea9b85f759fbbec38cb5acabd0e0253d2cce1b64324
BLAKE2b-256 checksum
How to use checksums
62e45503bd2da8761e401fb94097f4e1e35f3242bba94de75a204d47e65736ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / sdevpy-1.3-py3-none-any.whl

Download URL sdevpy-1.3-py3-none-any.whl
Size 25.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
55219451d12941b5800ff35b8538c67ca3a8ab251fba8274c1a826a572eeb819
BLAKE2b-256 checksum
How to use checksums
e39b6419bb8c64ce4c9d62e1f81afaa63e7a4f6ec66c5a5fd86f17a8cc46fc50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for sdevpy 1.3

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.

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