A real-time options mispricing and volatility-surface engine for crypto options (Deribit / Binance). It inverts every live quote to its implied volatility, fits an arbitrage-checked volatility surface, compares each quote against a model fair value, and surfaces only those dislocations that survive transaction costs.
The design premise: a signal means "this quote is off the arbitrage-checked smile its own market implies" — a self-contained dislocation detector that needs no external calibration target. A calibrated Heston or Merton fair-IV function can be substituted instead.
Status: research prototype, actively being built. It is a research and analytics tool — it places no orders and connects to no broker.
| Layer | Contents |
|---|---|
models/ |
Black–Scholes with full Greeks, implied-volatility inversion, Heston, Merton jump-diffusion, SABR |
surface/ |
SVI volatility-surface calibration per expiry, with a spline fallback and fit diagnostics |
signals/no_arbitrage.py |
Put–call parity, vertical monotonicity, butterfly convexity and calendar-spread checks, reported as explicit violations |
signals/engine.py |
Mispricing engine, cost-aware edge computation, and a Bayesian reliability score per pricing model that drives adaptive model selection |
backtest/ |
Signal-level backtest harness with exit resolution and cost-aware P&L attribution |
data/ |
Deribit and Binance adapters, a synthetic chain generator for tests, and SQLite storage |
dashboard/ |
Streamlit dashboard over the live pipeline |
config.py |
Every threshold, cost assumption and convention in one auditable place |
- Edge is always net of costs. The cost model encodes the Deribit taker fee
(
min(3 bps of underlying, 12.5% of premium)) plus the actual half bid–ask spread of the quote, and a candidate is never surfaced if its edge sits inside costs. - No-arbitrage checks run before signals. A smile that violates butterfly convexity or parity is reported as a data/market-structure problem rather than silently priced.
- ACT/365 day count throughout (crypto trades continuously), with a minimum time-to-expiry floor below which IV inversion is numerically unstable.
- Every knob lives in
config.pyso a run is reproducible and auditable.
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
# Dashboard. Defaults to the synthetic feed, so it runs with zero network access.
streamlit run dashboard/app.pyProgrammatic use — the feed is an async chain stream, and analysis is a pure function of a chain:
import asyncio
from quant_options_engine.config import DEFAULT_CONFIG
from quant_options_engine.data.deribit import DeribitFeed
from quant_options_engine.pipeline import analyze_chain
async def main():
feed = DeribitFeed(currency="BTC")
await feed.connect()
async for chain in feed.stream_chains():
analysis = analyze_chain(chain, DEFAULT_CONFIG)
for s in analysis.signals[:10]:
print(s)
break
await feed.close()
asyncio.run(main())analyze_chain fits the surface, runs the no-arbitrage suite and generates cost-netted
signals; pass fair_iv_fn=heston_fair_iv(...) to price against a calibrated model instead of
the market's own smile.
models/ pricing models + Greeks + IV inversion
surface/ SVI calibration and surface diagnostics
signals/ no-arbitrage suite, mispricing engine, model selection
backtest/ signal backtest harness
data/ exchange adapters, synthetic generator, SQLite storage
dashboard/ Streamlit app
pipeline.py chain -> market IVs -> fitted surface -> ranked signals
config.py thresholds, cost model, conventions
- Persist full surface history for term-structure and skew time-series research
- Walk-forward validation of the mispricing signal with multiple-testing correction
- Delta-hedged P&L attribution (separating vol edge from directional drift)
Chirag Agarwal — CFA Level I passed, Level II candidate. LinkedIn
MIT — see LICENSE.