option_price_repair: Repair Arbitrage in Option Prices
An pure-python implementation of the arbitrage repair algorithm described in Detect and Repair Arbitrage in Price Data of Traded Options.
Perturbs a set of European call option prices (of arbitrary strike and expiry) on the same underlyer to ensure that certain no-arbitrage conditions are met.
# pip install option-price-repair[cvxpy,analysis]
import polars as pl
from option_price_repair import repair
input_file = "https://raw.githubusercontent.com/vicaws/arbitragerepair/refs/heads/master/data/sample.csv" # authors' sample data
use_bid_ask = True # use bid-ask -based optim
# prepare data
data = pl.read_csv(input_file)
mids = data.filter(pl.col("quote").eq("mid"))
t = mids.get_column("expiry").to_list()
k = mids.get_column("strike").to_list()
c = mids.get_column("call_fv").to_list()
fwd = mids.get_column("forward").to_list()
bid = data.filter(pl.col("quote").eq("bid")).get_column("call_fv").to_list()
ask = data.filter(pl.col("quote").eq("ask")).get_column("call_fv").to_list()
f = {t: fwd for t, fwd in zip(t, fwd)}
bid_ask = {"bid": bid, "ask": ask} if use_bid_ask else None
repaired_prices repair(k, t, c, bid_ask, f, None, verbose=True, plot=True, output_dir=".")
Installation
With cvxpy solver:
pip install option-price-repair[cvxpy]
Without a solver:
pip install option-price-repair
With (optional) perturbation plots:
pip install option-price-repair[cvxpy,analysis]
Features
- MIT license
- Minimal dependencies (only the solver you choose)
- Solver agnostic: cvxpy (Apache 2.0 license) solver implementation is provided, simple to add your own solver
- Verified against the authors' implementation here
User Guide
See __init__.py for the main entrypoint; repair.py for core functions
which normalize data and construct constraints, and cvxpy.py for
a sample solver implementation.
License
Licensed under the MIT license.
Metadata
Release files for option-price-repair 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| option_price_repair-0.3.0.tar.gz | 8.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| option_price_repair-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.2 kB
Release files / option_price_repair-0.3.0.tar.gz
| Download URL | option_price_repair-0.3.0.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
11835cb2ec1eef615231ffb2626bc8a113b805a8545f84eed4d93e237deaf25d
|
|
BLAKE2b-256 checksum How to use checksums |
84041650f6d4334027eff133b0765cd2366e0b154aa69de8adf6b0076d9985bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.12
|
Release files / option_price_repair-0.3.0-py3-none-any.whl
| Download URL | option_price_repair-0.3.0-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
683e0c24f9ea07b82f7b30dd4e1006e054fcc4ea4aaaf037eda45f64a887a953
|
|
BLAKE2b-256 checksum How to use checksums |
1002403910e401e951d87eb9091687e5d35dcd9c8551b150cfc5b4da61e16c33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.12
|
Security for option-price-repair 0.3.0
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.