Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deribit-gex

Deribit implied vol, skew, and crypto dealer gamma (GEX) — in a few lines of Python.

Pull the DVOL index, 25-delta skew, and compute net dealer Gamma Exposure from the live Deribit options chain. Public API only — no key, no account, no auth.

import deribit_gex as dg

dg.gex("BTC")
# {'currency': 'BTC', 'spot': 64188.0,
#  'gex_equity_convention': 50_500_000.0,
#  'gamma_wall_strike': 60000.0, 'gamma_wall_dist_pct': -6.5,
#  'put_call_oi_ratio': 0.53, 'n_options': 826, ...}

Why

Options dealers hedge their gamma, and that hedging flow pushes spot around. Gamma Exposure (GEX) — the net gamma the dealers are holding — is a widely-watched signal in equity markets for whether price is likely to pin (positive gamma) or trend (negative gamma). There was no dead-simple way to get it for crypto off the public Deribit API. Now there is.

It also gives you the gamma wall (the strike with the most open gamma, which price tends to gravitate toward into expiry), the front-expiry skew, and the DVOL implied-vol index — the three numbers most vol traders actually look at.

Install

pip install deribit-gex        # (or: pip install git+https://github.com/hshetrom2/deribit-gex)

Requires Python 3.9+, requests, and pandas.

Use

import deribit_gex as dg

# Aggregate dealer gamma
g = dg.gex("BTC")
print(g["gamma_wall_strike"], g["gex_equity_convention"])

# Full options chain, with Black-Scholes gamma computed per strike
chain = dg.chain_snapshot("BTC")     # DataFrame: strike, kind, oi, iv, gamma, dollar_gamma ...
print(chain.groupby("strike")["dollar_gamma"].sum().sort_values().tail())

# Front-expiry skew: ATM IV + 25-delta risk reversal (<0 = puts richer, crash demand)
dg.skew_snapshot("ETH")

# DVOL — Deribit's 30d implied-vol index, hourly
dg.dvol_history("BTC", days=90)      # DataFrame[time, open, high, low, close]

Command line:

python -m deribit_gex BTC ETH
BTC
  spot            64,188.00
  DVOL (30d IV)   34.83
  ATM IV          33.10   25d RR -5.86
  net GEX (eq)    50,500,000
  gamma wall      60,000   (-6.5% from spot)
  put/call OI     0.53   (826 options)

An honest note on the GEX sign

Crypto dealer positioning is not equity-index positioning. Deribit flow is dominated by covered-call overwriting and put hedging, so the sign of net gamma may not carry the same "positive = pin, negative = trend" meaning it does in SPX. This library reports the raw call/put dollar-gamma split alongside the equity-convention net, so you can test the relationship on your own data instead of trusting an assumed sign. It computes the number; it does not claim the number predicts anything.

(If you're curious: a 6-year backtest of monthly Deribit GEX vs forward BTC/ETH vol came back with no predictive signal — so treat GEX as a positioning lens, not an alpha source, until you've proven otherwise on your own horizon.)

API

Function Returns
gex(currency, chain=None) dict — net dollar-gamma (both conventions), gamma wall, put/call OI
chain_snapshot(currency) DataFrame — full chain with per-strike Black-Scholes gamma
skew_snapshot(currency) dict — front-expiry ATM IV + 25d risk-reversal proxy
dvol_history(currency, days) DataFrame — hourly DVOL OHLC
current_dvol(currency) float — latest DVOL
bs_gamma(spot, strike, iv_pct, t_years) float — Black-Scholes gamma (r=0)

Every network call retries with backoff and returns None on failure — it never raises into your app.

License

MIT © Hunter

Built as a byproduct of a larger crypto quant system. I build trading infrastructure for traders and small funds — get in touch.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages