delta 不是常数
delta 对冲只在一瞬间是精确的。股价一动,期权的 delta 就变了,对冲也就不对了。Gamma 是 delta 随股价的变化率:gamma = d(delta)/dS,即价格的二阶导数。多头看涨或看跌期权的 gamma 为正。在布莱克-斯科尔斯中它等于 pdf(d1) / (S * sigma * sqrt(T)),看涨和看跌相同,其中 pdf 是钟形曲线的密度。gamma 大意味着对冲很快过时,必须经常调整。
import math
def norm_pdf(x):
return math.exp(-0.5 * x * x) / math.sqrt(2 * math.pi)
def d1(spot, strike, rate, sigma, t):
return (math.log(spot / strike) + (rate + 0.5 * sigma ** 2) * t) / (sigma * math.sqrt(t))
def gamma(spot, strike, rate, sigma, t):
return norm_pdf(d1(spot, strike, rate, sigma, t)) / (spot * sigma * math.sqrt(t))
for spot in (80, 90, 100, 110, 120):
print(spot, round(gamma(spot, 100, 0.05, 0.2, 1), 5))
# 80 0.0186
# 90 0.02182
# 100 0.01876
# 110 0.01289
# 120 0.0075 gamma peaks near the strike and fades far from it临近到期时 gamma 变大
对平值期权来说,临近到期时 gamma 急剧上升:剩一年时 0.019,三个月时 0.039,一周时 0.141。临近到期时期权几乎成了在一文不值和值整个波动之间抛硬币,所以 delta 会在极小的价格区间内从 0 跳到 1。这就是临近到期时卖出期权的交易员(空头 gamma)睡不好觉的原因:对冲需要不断调整,一次跳空就会受伤。你也可以用二阶差分 (f(S + h) - 2 f(S) + f(S - h)) / h² 为任何模型估计 gamma,对抛物线是精确的。
for t in (1, 0.25, 0.02):
print(t, round(gamma(100, 100, 0.05, 0.2, t), 5))
# 1 0.01876
# 0.25 0.03929
# 0.02 0.14087 a week before expiry the at-the-money gamma is 7 times larger
def numerical_gamma(price_function, spot, bump):
return (price_function(spot + bump) - 2 * price_function(spot) + price_function(spot - bump)) / bump ** 2
price = lambda s: bs_call(s, 100, 0.05, 0.2, 1) # bs_call as in the previous topic
print(round(numerical_gamma(price, 100, 0.5), 5)) # 0.01876 the same as the formulagamma 带来的收益
因为 delta 随股价变化,多头期权无论股价朝哪个方向走,赚的都比单靠 delta 预测的多。上涨 5 美元使 delta 从 0.637 升到 0.637 + 0.01876 * 5 = 0.731。一次变动的盈亏是 delta * 变动 + 0.5 * gamma * 变动²:第二项就是多头期权的 gamma 收益(空头则是亏损)。它随变动的平方增长,所以无论哪个方向的大幅波动都对多 gamma 一方有利。这份收益不是免费的:持有者通过期权费和时间价值衰减为它付费。
g = gamma(100, 100, 0.05, 0.2, 1)
delta = call_delta(100, 100, 0.05, 0.2, 1) # as in the delta topic
print(round(delta, 4), round(delta + g * 5, 4)) # 0.6368 0.7306 the delta after a $5 rise
print(round(call_delta(105, 100, 0.05, 0.2, 1), 4)) # 0.7237 the exact delta at 105 (gamma is a first-order guide)
move = 5
true_gain = bs_call(105, 100, 0.05, 0.2, 1) - bs_call(100, 100, 0.05, 0.2, 1)
print(round(true_gain - delta * move, 4), round(0.5 * g * move ** 2, 4)) # 0.2232 0.2345 what delta missed, and what gamma explains# Dollar gamma: how many dollars of stock the delta hedge changes for a 1% move of the stock at 100
print(round(g * 100 ** 2 / 100, 3)) # 1.876做多 gamma 并非免费gamma 收益是有代价的:期权的时间价值衰减(theta)。股价原地不动时持有期权,每天都在损失价值。做多 gamma 是否划算,取决于股价实际波动是否达到了给期权定价时所用的波动率;gamma 与 theta 之间的平衡是期权交易的核心权衡。
- Gamma =
pdf(d1) / (S * sigma * sqrt(T)),价格的二阶导数;看涨看跌相同,在行权价附近和临近到期时最大。 - 数值 gamma
(f(S + h) - 2 f(S) + f(S - h)) / h²;变动后的 delta:delta + gamma * 变动。 - 一次变动带来
delta * 变动 + 0.5 * gamma * 变动²:多头期权在任一方向的大幅波动中获利,代价是时间价值衰减。
下一节:Vega,对波动率的敏感度,这是没人能直接观察到的输入。
实验:评分内容
- 用
gamma衡量 delta 变化有多快25 分 - 用
numerical_gamma衡量任意价格的曲率25 分 - 用
delta_after_move在价格变动后更新 delta25 分 - 用
gamma_pnl计算曲率带来的收益25 分