Exact and entropic martingale optimal transport experiments for robust pricing.
Project description
MOT Pricing
mot-pricing turns the original one-off notebook into a reproducible Python project for robust pricing with martingale optimal transport (MOT).
The reference experiment in this repository studies:
S1 ~ Uniform[1, 3]S2 ~ Uniform[0, 4]- payoff
|S1 - S2| - exact martingale constraint
E[S2 | S1] = S1
The codebase includes:
- an exact linear-programming solver for discrete MOT
- a numerically stable entropic regularization solver
- discrete marginal helpers plus convex-order checks
- a built-in payoff library for spread-style payoffs
- a curated gallery runner for multi-example experiment showcases
- corrected unrestricted coupling benchmarks
- a configurable CLI and script for custom uniform interval experiments
- JSON summaries for reproducible experiment outputs
- reusable reporting helpers for figures, diagnostics, and summaries
- tests for the exact and regularized solvers
Public Outputs
- Docs site:
https://anouarmohamed.github.io/JavaFinalJee/ - GitHub releases: the tag workflow attaches wheel and source distribution assets
- PyPI package:
https://pypi.org/project/mot-pricing/ - TestPyPI package:
https://test.pypi.org/project/mot-pricing/ - Trusted publishing and GitHub Pages are active for this repository
Why this repo exists
The original notebook had strong ideas but mixed together derivation, experimentation, plotting, and solver logic. It also had a few correctness and presentation issues:
- unrestricted benchmark labels were flipped
- the dual value was compared to the wrong primal quantity in the regularized section
- the
hupdate used direct exponentials and produced overflow warnings
This project keeps the same experiment while packaging it into reusable, testable code.
Quick Start
Install from PyPI:
pip install mot-pricing
Then run the CLI:
mot-uniform --n 50 --x-interval 1 3 --y-interval 0 4 --payoff abs_spread --eps 1.0 0.3 0.1 0.03 0.01 --output-dir artifacts
Generate the curated gallery:
mot-gallery --output-dir gallery_artifacts
For editable local development:
python -m venv .venv
.venv\Scripts\activate
pip install -e .[dev]
pytest
To build the docs locally:
pip install -e .[docs]
mkdocs serve
If you prefer not to install the package in editable mode:
pip install -r requirements.txt
python scripts/run_uniform_abs_spread.py --output-dir artifacts
Custom payoff example:
mot-uniform --n 60 --x-interval 1 3 --y-interval 0 4 --payoff call_on_spread --strike 0.25 --eps 0.3 0.1
Expected Results
For the default uniform example:
- the exact MOT upper value converges toward
1.0 - the lower value is about
0.6 - the unrestricted comonotone coupling is the minimum benchmark
- the unrestricted countermonotone coupling is the maximum benchmark
- the regularized value approaches the exact LP value as
eps -> 0
For the broader API:
DiscreteMarginalrepresents weighted discrete lawscheck_convex_order_discrete(...)provides a practical feasibility diagnostic- built-in payoffs include
abs_spread,squared_distance,call_on_spread,put_on_spread, andstraddle_on_spread save_experiment_artifacts(...)writes figures and machine-readable summariesbuiltin_gallery_specs()andsave_gallery_assets(...)generate a mini research gallery
Repo Layout
src/mot_pricing/: solver libraryscripts/: runnable entry scripttests/: regression and numerical checksCHANGELOG.md: release historyCONTRIBUTING.md: local development and release flownotebooks/: notebook material preserved from the original explorationdocs/: GitHub Pages documentation source.github/workflows/: CI for test automation
Notebook Status
The original notebook is preserved under notebooks/ as legacy exploratory work. A clean report notebook now imports the library directly, and the library plus CLI are the canonical implementation.
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
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 mot_pricing-0.4.0.tar.gz.
File metadata
- Download URL: mot_pricing-0.4.0.tar.gz
- Upload date:
- Size: 19.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4cc6cb181d17ae7f4b524250d16c8f7cd8dc67f938acc223eaca6d7e16e94f1
|
|
| MD5 |
e908368df4222fe5ce8d2daaedeb2af4
|
|
| BLAKE2b-256 |
9c753956b09095324875b187390603522475a1d547907fb294df4b4d59139d40
|
Provenance
The following attestation bundles were made for mot_pricing-0.4.0.tar.gz:
Publisher:
publish-package.yml on AnouarMohamed/JavaFinalJee
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mot_pricing-0.4.0.tar.gz -
Subject digest:
a4cc6cb181d17ae7f4b524250d16c8f7cd8dc67f938acc223eaca6d7e16e94f1 - Sigstore transparency entry: 1140859146
- Sigstore integration time:
-
Permalink:
AnouarMohamed/JavaFinalJee@643eca9e3e55c7981366ef03618bc7b6a8c0fc72 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AnouarMohamed
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@643eca9e3e55c7981366ef03618bc7b6a8c0fc72 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file mot_pricing-0.4.0-py3-none-any.whl.
File metadata
- Download URL: mot_pricing-0.4.0-py3-none-any.whl
- Upload date:
- Size: 19.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5339b8485b249f6edab2d837ca911736eaba64b04ea3ffb1238109feed41b566
|
|
| MD5 |
b8b09cb92988770ab3bf5836e28742f0
|
|
| BLAKE2b-256 |
a3d2f747efdd3bd8d8ae489181cd1088bda308c2062fa7806aa11d568da55982
|
Provenance
The following attestation bundles were made for mot_pricing-0.4.0-py3-none-any.whl:
Publisher:
publish-package.yml on AnouarMohamed/JavaFinalJee
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mot_pricing-0.4.0-py3-none-any.whl -
Subject digest:
5339b8485b249f6edab2d837ca911736eaba64b04ea3ffb1238109feed41b566 - Sigstore transparency entry: 1140859191
- Sigstore integration time:
-
Permalink:
AnouarMohamed/JavaFinalJee@643eca9e3e55c7981366ef03618bc7b6a8c0fc72 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AnouarMohamed
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@643eca9e3e55c7981366ef03618bc7b6a8c0fc72 -
Trigger Event:
workflow_dispatch
-
Statement type: