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.3.0.tar.gz (8.5 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.3.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for option_price_repair-0.3.0.tar.gz
Algorithm Hash digest
SHA256 11835cb2ec1eef615231ffb2626bc8a113b805a8545f84eed4d93e237deaf25d
MD5 5ddef6c988102b9bb45b9b0dd779eeb7
BLAKE2b-256 84041650f6d4334027eff133b0765cd2366e0b154aa69de8adf6b0076d9985bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for option_price_repair-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 683e0c24f9ea07b82f7b30dd4e1006e054fcc4ea4aaaf037eda45f64a887a953
MD5 351a4acbb693b40d1e135369b3c0d8ad
BLAKE2b-256 1002403910e401e951d87eb9091687e5d35dcd9c8551b150cfc5b4da61e16c33

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