5D Library › 做市商伽马敞口、零日到期期权与波动率收割动力学 · English
第三章 一张 GEX 图能知道什么:符号不在数据里
流行的说法
「伽马敞口」(GEX)图把每个行权价的未平仓量乘以期权的伽马,认购取一个符号、认沽取另一个符号相加,画出按行权价排列的「做市商伽马」柱状图,以及总和变号处的「零伽马位」。建立在它之上的说法有强弱两种。弱的说法是:这张图告诉你做市商是多头还是空头伽马,因而(按第二章)当天会平静还是剧烈。强的说法在散户评论中很常见:这张图能预测当天的顶和底。
本章把两者都检验一遍。强的说法失败,原因与数据质量无关:对冲改变的是价格走多远,不是往哪走。弱的说法失败,原因恰恰在数据:真正要紧的那个符号,不在这张图所用的数据里。
未平仓量与谁是多头无关
每张期权合约都有买方和卖方。未平仓量数的是存续合约,所以无论客户在哪一边,它都是同一个数。这张图因此需要一个关于方向的假设。通常的假设是客户卖出认购(备兑开仓)、买入认沽(保护),所以做市商持有认购多头、认沽空头。
设 为未平仓量中客户处于多头一方的份额。做市商的净多头就是 张,而图的惯例是 、。任何其他的 值都与完全相同的未平仓量相容。第五段程序把这一点具体化。
推导
# Chapter 3. What open interest can and cannot tell you about dealer gamma.
# Open interest counts contracts outstanding. Every contract has a long side
# and a short side, so OI is the same number whoever is long. The popular
# "GEX" chart assumes the customer is SHORT every call (dealer long calls) and
# LONG every put (dealer short puts). Let a = the share of OI in which the
# customer is the long side. The dealer is then net long OI x (1 - 2a)
# contracts. The convention is a_call = 0, a_put = 1. Synthetic chain: S =
# 100, strikes 90..110, expiries 1, 7 and 30 trading days. GEX is reported in
# "dollars of hedge per 1 % move" = gamma x S^2 x 0.01 x 100 x OI.
import math
def gamma(S, K, sig, T):
d1 = (math.log(S / K) + 0.5 * sig * sig * T) / (sig * math.sqrt(T))
return math.exp(-0.5 * d1 * d1) / (
math.sqrt(2 * math.pi) * S * sig * math.sqrt(T)
)
SIG = 0.20
EXPIRIES = (1 / 252, 7 / 252, 30 / 252)
STRIKES = list(range(90, 111))
def oi(K, kind, T):
# stylised OI: calls heavier just above spot, puts heavier below; more OI
# far out
centre = 103.0 if kind == "C" else 96.0
base = 4000.0 * math.exp(-((K - centre) / 4.0) ** 2) + 300.0
return base * (1.0 + 2.0 * T * 252 / 30)
def gex(S, a_call, a_put, extra=None):
tot = 0.0
for T in EXPIRIES:
for K in STRIKES:
g = gamma(S, K, SIG, T) * S * S * 0.01 * 100
tot += g * oi(K, "C", T) * (1 - 2 * a_call)
tot += g * oi(K, "P", T) * (1 - 2 * a_put)
if extra:
tot += extra(S)
return tot / 1e6
def zero_level(a_call, a_put, extra=None):
prev_s, prev_g = 85.0, gex(85.0, a_call, a_put, extra)
s = 85.0
while s < 115.0:
s += 0.05
g = gex(s, a_call, a_put, extra)
if (g > 0) != (prev_g > 0):
return prev_s + (s - prev_s) * prev_g / (prev_g - g)
prev_s, prev_g = s, g
return None
WORLDS = [
("convention (calls sold, puts bought)", 0.0, 1.0),
("half of call OI customer-long", 0.5, 1.0),
("call buyers 70 %, put buyers 60 %", 0.7, 0.6),
("everything reversed", 1.0, 0.0),
]
if __name__ == "__main__":
print(
"A. The data are identical in every world: OI at three strikes, 7-day"
" expiry"
)
for K in (95, 100, 105):
print(
" K = {:3d}: calls {:7.0f} puts {:7.0f}".format(
K, oi(K, "C", 7 / 252), oi(K, "P", 7 / 252)
)
)
print(
"\nB. Dealer gamma implied by the same OI under different customer"
" directions"
)
print(
" world GEX at S=100 zero-gamma"
)
print(" ($m per 1 %) level")
for name, ac, ap in WORLDS:
z = zero_level(ac, ap)
print(
" {:<36}{:+11.1f} {}".format(
name,
gex(100.0, ac, ap),
"none in 85-115" if z is None else "{:.2f}".format(z),
)
)
intraday = lambda S: -(
gamma(S, 100.0, SIG, 3 / (252 * 6.5)) * S * S * 0.01 * 100 * 60000.0
)
print(
"\nC. Add 0DTE contracts opened and closed within the day (never in"
" any OI):"
)
print(
" 60,000 ATM contracts bought by customers at 13:00, dealer short"
" them"
)
print(
" convention GEX at S=100, from OI only: {:+.1f}".format(
gex(100.0, 0.0, 1.0)
)
)
print(" true GEX at 13:00 including that flow: {:+.1f}".format(
gex(100.0, 0.0, 1.0, intraday)))
print(
"\nReading: OI fixes the gross gamma outstanding, not the dealers'"
" net share of"
)
print(
"it. Worlds with identical OI carry dealer gamma of either sign, and"
" 0DTE"
)
print(
"positions opened and closed before the OI snapshot are invisible"
" to it."
)
# A. The data are identical in every world: OI at three strikes, 7-day expiry
# K = 95: calls 547 puts 5951
# K = 100: calls 3783 puts 2598
# K = 105: calls 5009 puts 477
#
# B. Dealer gamma implied by the same OI under different customer directions
# world GEX at S=100 zero-gamma
# ($m per 1 %) level
# convention (calls sold, puts bought) +18.9 99.37
# half of call OI customer-long -94.5 none in 85-115
# call buyers 70 %, put buyers 60 % -64.3 none in 85-115
# everything reversed -18.9 99.37
#
# C. Add 0DTE contracts opened and closed within the day (never in any OI):
# 60,000 ATM contracts bought by customers at 13:00, dealer short them
# convention GEX at S=100, from OI only: +18.9
# true GEX at 13:00 including that flow: -260.7
#
# Reading: OI fixes the gross gamma outstanding, not the dealers' net share of
# it. Worlds with identical OI carry dealer gamma of either sign, and 0DTE
# positions opened and closed before the OI snapshot are invisible to it.A 段说明数据是固定的;B 段说明结论不是。按惯例,价格 100 处的做市商伽马为每 1% 波动 +18.9 百万美元的对冲量,零伽马位在 99.37。若认购未平仓量中只有一半是客户多头,同样的数据意味着 −94.5,且在 85 到 115 之间没有零伽马位。若客户同时是认购与认沽的净买方,为 −64.3。若所有方向都反过来,为 −18.9,零伽马位不变——图上那条线纹丝不动,而线两侧一切的符号都翻了过来。
这不是一个更多数据就能解决的估计问题,而是一个可识别性问题:要求的量不是观测数据的函数,所以只用这些数据建立的任何估计量都无法把它恢复出来。
证据
关于客户方向已知的情况。 Gârleanu、Pedersen 与 Poteshman 使用确实记录了每个头寸由谁开立的数据,发现终端用户对标普 500 指数期权是净多头,对虚值认沽的净需求尤其大,因此做市商是净空头 (Gârleanu et al. 2009)。Lakonishok、Lee、Pearson 与 Poteshman 发现,在个股期权中,非做市商的活动有很大一部分是卖出期权,包括备兑认购 (Lakonishok et al. 2007)。两种方向都会发生;哪一种占主导,因标的、行权价和时期而异。一个固定的惯例,是对一个量的猜测——这个量即便在被测量的地方,也只在这张图不使用的数据里被测量。
未平仓量从不看见的日内头寸
C 段补上第二个缺口。未平仓量每天只拍一次快照。一张 13:00 买入、15:30 卖出的 0DTE 合约,不会出现在任何一张快照里。程序中,客户在 13:00 买入的 60,000 张这样的平值合约,把做市商的伽马从惯例给出的 +18.9 变成 −260.7:大一个数量级,且符号相反。
证据
0DTE 研究用的是什么数据。 真正估计做市商 0DTE 伽马的研究,用的是带推断或记录方向的逐笔成交数据,而不是未平仓量。Dim、Eraker 与 Vilkov 用这类数据研究标普 500 的 0DTE 期权,报告在其样本中做市商 0DTE 伽马合计平均为正,并未发现 0DTE 交易放大了日内波动率 (Dim et al. 2024);这是一篇工作论文,结论依赖于成交方向如何分类。Barbon 与 Buraschi 同样使用带方向的数据,把做市商伽马的负向失衡与更高的日内波动率和动量联系起来 (Barbon and Buraschi 2021)。弱的说法需要的正是这些研究;两者都无法从一张未平仓量图里复现。
这个估计能预测什么吗?
不妨慷慨地假设第二章的机制完全成立。第六段程序构造这样一个世界:真实的做市商伽马决定每天的波动率,无论伽马是多少收益的均值都为零,分析者看到伽马,而符号惯例只在 比例的日子里是对的。
推导
# Chapter 3. Does an OI-based GEX estimate predict anything? A simulated world
# in which the Chapter 2 mechanism is TRUE by construction: true dealer gamma
# kappa_t sets the day's volatility, sigma_t = sigma0 / (1 + kappa_t) x
# exp(noise). Returns have mean zero whatever kappa is, because hedging
# changes how far prices move, not which way. The analyst sees est_t = s_t x
# kappa_t + measurement noise, where s_t = +1 when the sign convention happens
# to be right that day (probability q) and -1 otherwise.
import math
import random
def corr(x, y):
n = len(x)
mx, my = sum(x) / n, sum(y) / n
sxy = sum((a - mx) * (b - my) for a, b in zip(x, y))
sxx = sum((a - mx) ** 2 for a in x)
syy = sum((b - my) ** 2 for b in y)
return sxy / math.sqrt(sxx * syy)
def world(q, n, rng):
est, logrv, ret = [], [], []
for _ in range(n):
k = rng.uniform(-0.5, 0.5)
sig = 0.0126 / (1 + k) * math.exp(rng.gauss(0, 0.25))
r = rng.gauss(0, sig)
s = 1 if rng.random() < q else -1
est.append(s * k + rng.gauss(0, 0.15))
logrv.append(math.log(abs(r) + 1e-9))
ret.append(r)
return est, logrv, ret
def rule_sharpe(est, ret, thr, side):
pnl = [side * (r if e > thr else -r) for e, r in zip(est, ret)]
m = sum(pnl) / len(pnl)
sd = math.sqrt(sum((p - m) ** 2 for p in pnl) / (len(pnl) - 1))
return m / sd * math.sqrt(252)
if __name__ == "__main__":
rng = random.Random(56006)
print("A. 5,000 simulated days per row")
print(" q (sign right) corr(est, log|ret|) corr(est, ret)")
for q in (1.0, 0.8, 0.6, 0.5):
est, lrv, ret = world(q, 5000, rng)
print(
" {:9.1f} {:+12.3f} {:+10.3f}".format(
q, corr(est, lrv), corr(est, ret)
)
)
print(
"\nB. Data mining a directional rule (q = 1, the most favourable"
" case)"
)
print(
" 42 rules (21 thresholds x 2 directions) tried on 1,000 days, the"
" best one"
)
print(
" then traded on the next 1,000 days; repeated on 200 simulated"
" histories"
)
ins_best, outs = [], []
for rep in range(200):
est, lrv, ret = world(1.0, 2000, rng)
ie, ir, oe, orr = est[:1000], ret[:1000], est[1000:], ret[1000:]
b = max((rule_sharpe(ie, ir, t / 20.0, sd), t / 20.0, sd)
for t in range(-10, 11) for sd in (1, -1))
ins_best.append(b[0])
outs.append(rule_sharpe(oe, orr, b[1], b[2]))
ins_best.sort()
print(
" best in-sample Sharpe: mean {:+.2f}, middle 90 % {:+.2f} to"
" {:+.2f}".format(sum(ins_best) / 200, ins_best[10], ins_best[189])
)
print(" same rule out of sample: mean {:+.2f}".format(sum(outs) / 200))
print(
" share of histories with best in-sample Sharpe above 1.0: {:.3f}"
.format(sum(x > 1.0 for x in ins_best) / 200)
)
print(
"\nReading: a correctly signed GEX carries information about how"
" large the"
)
print(
"move will be, and that information fades as the sign convention"
" fails."
)
print("It carries none about direction even when the mechanism is true.")
# A. 5,000 simulated days per row
# q (sign right) corr(est, log|ret|) corr(est, ret)
# 1.0 -0.238 +0.013
# 0.8 -0.120 +0.027
# 0.6 -0.048 +0.014
# 0.5 -0.010 -0.019
#
# B. Data mining a directional rule (q = 1, the most favourable case)
# 42 rules (21 thresholds x 2 directions) tried on 1,000 days, the best one
# then traded on the next 1,000 days; repeated on 200 simulated histories
# best in-sample Sharpe: mean +0.85, middle 90 % +0.47 to +1.35
# same rule out of sample: mean +0.01
# share of histories with best in-sample Sharpe above 1.0: 0.270
#
# Reading: a correctly signed GEX carries information about how large the
# move will be, and that information fades as the sign convention fails.
# It carries none about direction even when the mechanism is true.A 段同时给出诚实的正面结果与诚实的否定结果。当符号总是对的(),估计值与下一次波动的大小相关:与对数绝对收益的相关为 −0.238(为负,是因为做市商伽马越多,当天越平静)。随着惯例失效,这份信息消退: 时 −0.120, 时 −0.048,(符号等于抛硬币)时 −0.010。与带符号收益的相关在每一行都与零无法区分(介于 −0.019 与 +0.027 之间),因为这个机制里根本没有方向可预测。
即便是最有利的 −0.238 也不大。单日绝对收益是当天波动率的一个嘈杂测度,所以即使是完美的波动率信号,与它的相关也很弱。
B 段解释了强的说法为什么总能找到支持。在 1,000 天上试 42 条方向规则并保留最好的一条,样本内夏普比率平均为 +0.85,有 0.270 的历史超过 1.0;同一条规则在样本外平均为 +0.01。一张每天早上反复重读、直到「灵验」为止的图,是一台多重比较机器。
注
剩下的是什么。 本章并没有证明做市商伽马无关紧要。第二章给出了机制,证据框给出了它被测量的情况。失败的是从未平仓量到做市商符号的那一步,以及从伽马到方向的那一步。一张 GEX 图可以是粗糙的波动率预测——当且仅当它的符号惯例恰好与该标的、该时期的现实相符,而这一点图本身无法告诉你。
小结
未平仓量确定的是存续伽马的总量,而不是做市商在其中的净份额:未平仓量完全相同的世界,可以承载任一符号的做市商伽马,而日内 0DTE 头寸对它不可见。因此做市商的符号不能由 GEX 图所用的数据识别。在一个对冲机制按构造成立的世界里,符号正确的估计对次日波动幅度携带有限的信息、对方向不携带任何信息,且随着符号惯例失效,这份信息消失。「顶和底」的说法即使在最有利的情形下也失败;它表面上的成功,是在许多规则中搜索时从噪声里产生的东西。
参考文献
Fan, Y. (2026). Dealer Gamma Exposure, Zero-Day Options and Volatility Harvesting Dynamics: Delta-Hedging Feedback Loops, Strike Pinning, Iron Condor Tail Ruin and Variance Swap Replication [做市商伽马敞口、零日到期期权与波动率收割动力学] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090160 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).