Skip to content
Back to blog

How to Calculate GEX Levels from an Option Chain: Gamma Flip, Walls, and Max Pain

GEX levels are computed from one day's option chain: gamma exposure per contract, the gamma flip, call and put walls, and max pain. Here is each formula, reproduced on the free DIS sample.

4 min readOptionData
gexgamma-exposureoption-chaintutorialduckdb
OPTION CHAINOptionData blog450445440435430425

GEX levels are a handful of prices computed from a day's option chain: where dealers' gamma exposure is largest, where it changes sign, and where open interest is stacked. Every one comes from four columns of the chain: strike, gamma, oi and the underlying price. This post shows each formula and reproduces the numbers in the free DIS levels sample from the free DIS option chain sample, using DuckDB.

What the DIS levels row says for 2026-10-15

  • Underlying price: 110.68

  • Gamma flip: 107.09

  • Call wall / put wall (GEX): 115 / 106

  • Max pain: 105

Gamma exposure of one contract

GEX for one contract is gamma × open interest × 100 × underlying price² × 1%. It is measured in dollars per 1% move in the underlying. Calls count as positive and puts as negative.

Three details matter when you reproduce it:

  • Open interest is the figure published on the morning of the date, which is as of the previous close.
  • Gamma and the underlying price are ThetaData's at about 17:15 New York time, after the close.
  • Contracts that expire on that date are left out, because they have expired by the time the data is taken.

Total call and put GEX

SQL
SELECT
  sum(CASE WHEN put_call = 'CALL' THEN  gamma * oi * 100 * underlying_price^2 * 0.01 END) AS call_gex,
  sum(CASE WHEN put_call = 'PUT'  THEN -gamma * oi * 100 * underlying_price^2 * 0.01 END) AS put_gex
FROM 'DIS_chains_2026-10-15.parquet'
WHERE expiration_date > DATE '2026-10-15';
ResultIn the levels file
call_gex108,512,512.95108,512,512.95
put_gex-53,169,310.89-53,169,310.89

The two match to the cent. Net GEX is the sum, here positive: calls outweigh puts on this day.

The walls

A wall is the strike where one kind of exposure is largest on one side of the underlying price.

  • Call GEX wall: the strike at or above the underlying price with the most call GEX.
  • Put open interest wall: the strike at or below the underlying price with the most put open interest.
SQL
-- call GEX wall
SELECT strike, sum(gamma * oi * 100 * underlying_price^2 * 0.01) AS call_gex
FROM 'DIS_chains_2026-10-15.parquet'
WHERE put_call = 'CALL' AND expiration_date > DATE '2026-10-15'
  AND strike >= underlying_price
GROUP BY strike ORDER BY call_gex DESC LIMIT 1;

-- put open interest wall
SELECT strike, sum(oi) AS put_oi
FROM 'DIS_chains_2026-10-15.parquet'
WHERE put_call = 'PUT' AND expiration_date > DATE '2026-10-15'
  AND strike <= underlying_price
GROUP BY strike ORDER BY put_oi DESC LIMIT 1;

The first query returns 115 and the second 100 with 53,034 contracts, the same as call_gex_wall and put_oi_wall in the levels file. The put GEX wall and the call open interest wall work the same way. If no strike lies on the wall's side of the underlying price, the wall is the largest strike on either side.

Gamma flip

The gamma flip is the underlying price where net GEX would be zero. Above it, dealers' net gamma is positive, which tends to dampen moves. Below it, net gamma is negative, which tends to amplify them.

Unlike the other levels, it can't be read off the chain: it reprices every contract's gamma at other underlying prices, with each contract's implied volatility held fixed and a 5% interest rate, and finds the price nearest the current one where the sum crosses zero. A contract with no implied volatility is left out of it. DIS's flip on this day is 107.09, about 3% below the 110.68 close. The value is empty when net GEX keeps one sign from 50% to 150% of the underlying price.

Max pain

Max pain is the strike at which option holders would be paid the least at expiration. For each candidate strike, add up what calls and puts would be worth at that price, weighted by open interest, and take the strike with the smallest total. DIS's max pain across all later expirations is 105.

Weekly and monthly levels

The levels file repeats the six levels for contracts expiring in 1 to 7 days (weekly_) and in 8 to 31 days (monthly_), so you can see whether near-dated exposure sits somewhere different from the whole chain.

Skip the calculation

GEX levels files hold all of this for every option root: 27 columns, one row per root per trading day, for $1 per day with a $2 minimum. Every value is computed from that day's option chain file, so you can always check one yourself, as above. Order GEX levels, or read what each file holds.

Frequently asked questions

Is GEX the same everywhere? No. Vendors differ on which contracts they include, how they sign calls and puts, and which gamma and underlying price they use. The rules above are the ones in OptionData's levels files.

Why leave out contracts that expire that day? The data is taken after the close, when they have already expired.

Can I use the end-of-day numbers during the next session? The values describe the close. Open interest changes overnight, so levels for the next day are a new calculation.