Skip to main content

Repair arbitrage in European call option prices.

Project description

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.

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

option_price_repair-0.2.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

option_price_repair-0.2.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file option_price_repair-0.2.0.tar.gz.

File metadata

  • Download URL: option_price_repair-0.2.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for option_price_repair-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3ec93c3e616081852a5d999e08b67449ed3e80a70b47532982ac7e402f799ebf
MD5 12edc137b90a16dbcbcd951c336eeb74
BLAKE2b-256 a2a70b1b543b8fd3c43c2407c603e7c96026dfc4216b40bb37a90efe1653a0cc

See more details on using hashes here.

File details

Details for the file option_price_repair-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for option_price_repair-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 77ae00ad40dc8a05557d6929e5b5e9e5532351a4973ec6a79084f004976af0e2
MD5 e0fbb0ac2dc0974fd7faa936a966b88a
BLAKE2b-256 4d0ae65f441c54d26b593f217c4ea14d0fa047444a32d15712e38df3a87d5356

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