{"slug":"open-source-gex-dashboard","qid":"gex_by_expiry","label":"Signed SPY gamma exposure by expiry, next three weeks","post_title":"Open-Source GEX Dashboard: How It Works","post_url":"/blog/open-source-gex-dashboard#q-gex_by_expiry","columns":["expiry","call_gex_bn","put_gex_bn","net_gex_bn"],"rows":[{"expiry":"Aug 20","call_gex_bn":27.78,"put_gex_bn":-18,"net_gex_bn":9.79},{"expiry":"Aug 21","call_gex_bn":7.78,"put_gex_bn":-7.14,"net_gex_bn":0.64},{"expiry":"Aug 24","call_gex_bn":1.68,"put_gex_bn":-1.02,"net_gex_bn":0.67},{"expiry":"Aug 25","call_gex_bn":0.49,"put_gex_bn":-0.51,"net_gex_bn":-0.02},{"expiry":"Aug 26","call_gex_bn":0.5,"put_gex_bn":-0.46,"net_gex_bn":0.04},{"expiry":"Aug 27","call_gex_bn":0.21,"put_gex_bn":-0.14,"net_gex_bn":0.07},{"expiry":"Aug 28","call_gex_bn":0.65,"put_gex_bn":-0.53,"net_gex_bn":0.13},{"expiry":"Aug 31","call_gex_bn":0.29,"put_gex_bn":-0.44,"net_gex_bn":-0.15},{"expiry":"Sep 1","call_gex_bn":0.04,"put_gex_bn":-0.03,"net_gex_bn":0.02},{"expiry":"Sep 2","call_gex_bn":0.02,"put_gex_bn":-0.03,"net_gex_bn":-0.02},{"expiry":"Sep 4","call_gex_bn":0.16,"put_gex_bn":-0.25,"net_gex_bn":-0.09}],"shape":"ranking","sql":"SELECT\n    formatDateTime(expiry_date, '%b %e')                                    AS expiry,\n    round(sumIf(gex, side = 'call') / 1e9, 2)                               AS call_gex_bn,\n    round(-sumIf(gex, side = 'put') / 1e9, 2)                               AS put_gex_bn,\n    round((sumIf(gex, side = 'call') - sumIf(gex, side = 'put')) / 1e9, 2)  AS net_gex_bn\nFROM\n(\n    SELECT\n        expiration_date                                        AS expiry_date,\n        if(lower(option_type) LIKE 'c%', 'call', 'put')        AS side,\n        toFloat64(gamma) * toFloat64(volume) * 100\n            * pow(toFloat64(underlying_close), 2) * 0.01       AS gex\n    FROM global_markets.options_greeks\n    WHERE underlying_symbol = 'SPY'\n      AND date = (SELECT max(date) FROM global_markets.options_greeks WHERE underlying_symbol = 'SPY')\n      AND iv_converged = 1\n      AND volume > 0\n      AND days_to_expiry BETWEEN 0 AND 21\n)\nGROUP BY expiry_date\nORDER BY expiry_date","computed_at":"2026-08-22T04:17:49.477110+00:00","elapsed":2.097831225}