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[cvxopt,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.1.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.1.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: option_price_repair-0.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 3a1528b0696f8285dfea57c69c0c9baa3f1a93cb1867cb8362d21742ab925b3c
MD5 d50892acb7f7163369a91bc1c1000d28
BLAKE2b-256 77aee61ae87fb538ac13231e189b5aef2350aef1180db0f434fbdb4cda4e23ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for option_price_repair-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 27c70670263cd1bd67d1b09e3de53380e7d78a46d2003039556ec1b3205f372e
MD5 7ceb6b216b6bbe5aac7ba10a33fc0eed
BLAKE2b-256 c9db6fbf918dc41e381f9ebc39e50236ce4e5813c9c3ddc414cf62bbbf75bd5c

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