Skip to main content

Exact and entropic martingale optimal transport experiments for robust pricing.

Project description

MOT Pricing

CI Docs

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
  • corrected unrestricted coupling benchmarks
  • a configurable CLI and script for custom uniform interval experiments
  • JSON summaries for reproducible experiment outputs
  • 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 publishing workflow: prepared for trusted publishing once PyPI/TestPyPI are configured for this repo

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 h update used direct exponentials and produced overflow warnings

This project keeps the same experiment while packaging it into reusable, testable code.

Quick Start

python -m venv .venv
.venv\Scripts\activate
pip install -e .[dev]
pytest
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

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:

  • DiscreteMarginal represents weighted discrete laws
  • check_convex_order_discrete(...) provides a practical feasibility diagnostic
  • built-in payoffs include abs_spread, squared_distance, call_on_spread, put_on_spread, and straddle_on_spread

Repo Layout

  • src/mot_pricing/: solver library
  • scripts/: runnable entry script
  • tests/: regression and numerical checks
  • CHANGELOG.md: release history
  • CONTRIBUTING.md: local development and release flow
  • notebooks/: notebook material preserved from the original exploration
  • docs/: 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

mot_pricing-0.3.0.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

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

mot_pricing-0.3.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file mot_pricing-0.3.0.tar.gz.

File metadata

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

File hashes

Hashes for mot_pricing-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d115982b6b5daed428dd0ba6065216384dd6d22ae976bb62e4eafc49f064807a
MD5 f37bdd38559eb90bccbaddf3da9d3331
BLAKE2b-256 a659d4f8f6ec68a8ae541edfc10593e1abbe7698079a29f8d3eb5a5d456f675c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mot_pricing-0.3.0.tar.gz:

Publisher: publish-package.yml on AnouarMohamed/JavaFinalJee

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

File details

Details for the file mot_pricing-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: mot_pricing-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mot_pricing-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b763d5f10db79d32444d7f343e4cc069ceb2792a1854b8f2cedf466fde52531
MD5 8727da8ed652a8939e27be89bded0e9b
BLAKE2b-256 c1fc953e0a2f621725373e7e50335241f782e7bdbda43506dce1546c433fe2ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for mot_pricing-0.3.0-py3-none-any.whl:

Publisher: publish-package.yml on AnouarMohamed/JavaFinalJee

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