上一篇 隐含波动率
编程金融小白学 股票期权
希腊字母 II
-
运用希腊字母 是对期权 比较静态的敏感分析
-
含义:其他条件不变,(某因素)变化一单位,期权价格大概变化多少?
- 标的资产价格: Delta ( Δ ) (\Delta) (Δ)
- 时间: Theta ( Θ ) (\Theta) (Θ)
- 隐含波动率: Vega ( ϑ ) (\vartheta) (ϑ) T
- 利率: Rho ( r ) (r) (r)
-
Gamma ( γ ) (\gamma) (γ): 标的价格变动1单位时,Delta Δ \Delta Δ 变多少?
波动率 Sigma ( σ ) (\sigma) (σ)
- 详情 请看 隐含波动率
Delta ( Δ ) (\Delta) (Δ) — 标的资产价格
-
标的资产价格变化一单位,期权价格大概变化多少?
-
例:
- Delta = 0.3141 意味着
- 如果指数上涨 10 点,期权价格大概上涨 3.141点
-
Δ = ∂ c ∂ S \Delta = \frac{\partial c}{\partial S} Δ=∂S∂c
-
期权价格曲线切线斜率(动态时变)
-
(无红利欧式期权) Delta 的4个特征:
特征 I
标的价格 | 看涨多头 | 看涨空头 | 看跌多头 | 看跌空头 |
---|---|---|---|---|
区间 | 0 < Δ < 1 0<\Delta<1 0<Δ<1 | 符号相反 | − 1 < Δ < 0 -1<\Delta<0 −1<Δ<0 | 符号相反 |
虚值 | Δ → 0 \Delta\to0 Δ→0 | Δ → 0 \Delta\to0 Δ→0 | Δ → 0 \Delta\to0 Δ→0 | Δ → 0 \Delta\to0 Δ→0 |
平价 | Δ ≈ 0.5 \Delta\approx0.5 Δ≈0.5 | Δ ≈ − 0.5 \Delta\approx-0.5 Δ≈−0.5 | Δ ≈ − 0.5 \Delta\approx-0.5 Δ≈−0.5 | Δ ≈ 0.5 \Delta\approx0.5 Δ≈0.5 |
实值 | Δ → 1 \Delta\to1 Δ→1 | Δ → − 1 \Delta\to-1 Δ→−1 | Δ → − 1 \Delta\to-1 Δ→−1 | Δ → 1 \Delta\to1 Δ→1 |
图像 |
特征 II
- PCP 平价原理
- 看 涨 期 权 D e l t a = 看 跌 期 权 D e l t a + 1 看涨期权 Delta = 看跌期权 Delta + 1 看涨期权Delta=看跌期权Delta+1
c + X 1 + r ( T − t ) = p + S → ∂ c ∂ S = ∂ p ∂ S + 1 c + \frac{X}{1+r(T-t)}=p+S \to \frac{\partial c}{\partial S}= \frac{\partial p}{\partial S}+1 c+1+r(T−t)X=p+S→∂S∂c=∂S∂p+1
- 如图,可以看出来 他们的Delta 相差1
特征 III
- 快到期时,实值、虚值、和平值期权的Delta 差异比较大
- 剩余期限比较大的话 时间价值比较大 它的期权价格曲线相对平滑,所以它的切线斜率比较小
看涨 | 看跌 |
---|---|
特征 IV
- 波动率较低时,实值、虚值、和平值期权的Delta 差异比较大
- 原理与特征 III 相同
看涨 | 看跌 |
---|---|
证券组合的 Delta 值
头寸 | Delta | 例子(N为数量) |
---|---|---|
现货多头 | 1 | 4单位: 4 × 1 = 4 4\times 1 =4 4×1=4 |
现货空头 | -1 | 3单位: 3 × − 1 = − 3 3\times -1 =-3 3×−1=−3 |
期货多头 | 1 | 2单位: 2 × 1 = 2 2\times 1 =2 2×1=2 |
现货多头 | -1 | 5单位: 5 × − 1 = − 5 5\times -1 =-5 5×−1=−5 |
欧式看涨期权多头 (无红利) | 0 < Δ < 1 0<\Delta<1 0<Δ<1 | 5单位多头,每单位Delta为0.5: 5 × 0.5 = 2.5 5\times 0.5 =2.5 5×0.5=2.5 |
欧式看涨期权空头 (无红利) | − 1 < Δ < 0 -1<\Delta<0 −1<Δ<0 | 4单位空头,每单位Delta为-0.4: 4 × − 0.4 = − 1.6 4\times -0.4 =-1.6 4×−0.4=−1.6 |
欧式看跌期权多头 (无红利) | − 1 < Δ < 0 -1<\Delta<0 −1<Δ<0 | 3单位多头,每单位Delta为-0.5: 3 × − 0.5 = − 1.5 3\times -0.5 =-1.5 3×−0.5=−1.5 |
欧式看跌期权空头 (无红利) | 0 < Δ < 1 0<\Delta<1 0<Δ<1 | 2单位空头,每单位Delta为0.6: 2 × 0.6 = 1.2 2\times 0.6 =1.2 2×0.6=1.2 |
投资组合 | ∑ i N i ⋅ Δ i \sum_i N_i\cdot\Delta_i i∑Ni⋅Δi |
Delta 中性
- 在投资组合中 让Delta 为0 称 Delta 中性
- 意味着 投资组合对现货价格变动的一阶敏感性为 0
- 实现:运用同一标的资产的现货,期货和期权等进行相互套期保值,使证券组合的值等于0
- 特点:有期权的情况下是动态的,需要不懂调整头寸以使组合重新处于 Δ \Delta Δ中性状态,这种调整称为再均衡(Rebalancing)。
Gamma ( Γ ) (\Gamma) (Γ)
-
标的价格变动1单位时,Delta Δ \Delta Δ 变多少?
-
例:
- Gamma = 0.0056,Delta = 0.3141 意味着
- 如果指数上涨 10 点,Delta大概上升至 0.3141 + 10 ∗ 0.0056 = 0.3701 0.3141+10*0.0056 = 0.3701 0.3141+10∗0.0056=0.3701
- 如果指数下跌 10 点,Delta大概下降至 0.3141 − 10 ∗ 0.0056 = 0.2581 0.3141-10*0.0056 = 0.2581 0.3141−10∗0.0056=0.2581
-
Γ = ∂ Δ ∂ S = ∂ 2 c ∂ S 2 \Gamma = \frac{\partial \Delta}{\partial S}=\frac{\partial^2 c}{\partial S^2} Γ=∂S∂Δ=∂S2∂2c
-
期权价格曲线曲度的主要部分 d c ≈ Δ × d S + 1 2 Γ × ( d S ) 2 d c \approx \Delta \times d S + \frac{1}{2}\Gamma \times (d S)^2 dc≈Δ×dS+21Γ×(dS)2
import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt # 画图
plt.rcParams['font.sans-serif'] = ['FangSong'] # 设置中文
plt.rcParams['axes.unicode_minus'] = False # 设置中文负号
class BlackScholes:
def __init__(self, S0, X, r, T, sigma=0.3,t=0):
self.S0 = S0
self.X = X
self.r = r
self.sigma = sigma
self.dT = T-t
def d1(self):
return(np.log(self.S0/self.X)+(self.r+self.sigma**2/2)*(self.dT))/(self.sigma*np.sqrt(self.dT))
def d2(self):
return self.d1()-self.sigma*np.sqrt(self.dT)
def calc(self, call_put):
if call_put in {'c','C','call','Call','CALL'}:
return self.S0 * norm.cdf(self.d1())- \
self.X*np.exp(-self.r*self.dT)*norm.cdf(self.d2())
elif call_put in {'p','P','put','Put','PUT'}:
return self.X*np.exp(-self.r*self.dT)*norm.cdf(-self.d2())- \
self.S0 * norm.cdf(-self.d1())
raise NameError('Must be call or Put!',call_put)
def imp_vol(self,call_put,mktprice):
price = 0
sigma = 0.3
up, low = 1,0
loop = 0
while abs(price-mktprice)>1e-6 and loop<50:
price = BlackScholes(self.S0,self.X,self.r,self.dT,sigma).calc(call_put)
if (price-mktprice)>0:
up = sigma
sigma = (sigma+low)/2
else:
low = sigma
sigma = (sigma+up)/2
loop+=1
return sigma
def d1(X,Y):
dx = X[2:] - X[:-2]
dy = Y[2:] - Y[:-2]
return X[1:-1],dy/dx
def d2(X,Y):
X, Y = d1(X,Y)
return d1(X,Y)
def plt_slope(X,Y,x):
dx,slopes = d1(X,Y)
d2x, gammas = d2(X,Y)
slope_x = slopes[abs(dx-x)<1e-6]
gamma_x = gammas[abs(d2x-x)<1e-6]
y = Y[abs(X-x)<1e-6]
plt.plot(X,slope_x*(X-x)+y,'--',c='orange',label='slope')
plt.annotate(fr'$\Delta = ${round(slope_x[0],4)}',xy=(x,y-0.08),weight="bold")
plt.annotate(fr'$\Gamma = ${round(gamma_x[0],4)}',xy=(x,y-0.12),weight="bold")
# 标的价格S做自变量 求因变量c
S = np.arange(2.5,3.5,0.001)
BS = [BlackScholes(s,3., 0.05, 0.16)for s in S]
bc = np.array([bs.calc('c') for bs in BS]) # Buy Call
bp = np.array([bs.calc('p') for bs in BS]) # Buy Put
bc_dx,bc_dy = d1(S,bc) # Buy Call Delta
bp_dx,bp_dy = d1(S,bp) # Buy Put Delta
bc_d2x,bc_d2y = d2(S,bc) # Buy Call Delta
bp_d2x,bp_d2y = d2(S,bp) # Buy Put Delta
x_samples = [2.6,3,3.4]
y_samples = [bc[abs(S-x)<1e-6]for x in x_samples] # 计算得出y坐标
plt.figure(figsize=(8,5), dpi=200)
plt.plot(S,bc)
plt_slope(S,bc,3.)
plt.grid(True)
plt.xlabel('标的价格')
plt.ylabel('看涨期权价格')
plt.yticks(y_samples,[r'$C_2$',r'$C_0$',r'$C_1$'])
plt.xticks(x_samples,[r'$S_2$',r'$S_0$',r'$S_1$'])
plt.show()
- (无红利欧式期权)Gamma的4个特征
特征 I
- 期权多头
Γ
>
0
\Gamma>0
Γ>0 凹曲面 Convex
- 看涨 Convex up 上凹
- 看跌 Convex down 下凹
- 期权空头
Γ
<
0
\Gamma<0
Γ<0 凸曲面 Concave
- 看涨 Concave down 下凸
- 看跌 Concave up 上凸
# 看涨多头
plt.figure(figsize=(8,5), dpi=200)
plt.plot(S,bc,'r',lw=2)
plt_slope(S,bc,3.)
plt.xlabel('标的价格')
plt.ylabel('看涨期权价格')
plt.title('看涨期权多头 Gamma 特征')
plt.show()
# 看跌多头
plt.figure(figsize=(8,5), dpi=200)
plt.plot(S,bp,'r',lw=2)
plt_slope(S,bp,3.)
plt.xlabel('标的价格')
plt.ylabel('看跌期权价格')
plt.title('看跌期权多头 Gamma 特征')
plt.show()
# 看涨空头
plt.figure(figsize=(8,5), dpi=200)
plt.plot(S,-1*bc,'r',lw=2)
plt_slope(S,-1*bc,3.)
plt.xlabel('标的价格')
plt.ylabel('看涨期权价格')
plt.title('看涨期权空头 Gamma 特征')
plt.show()
# 看跌空头
plt.figure(figsize=(8,5), dpi=200)
plt.plot(S,-1*bp,'r',lw=2)
plt_slope(S,-1*bp,3.)
plt.xlabel('标的价格')
plt.ylabel('看跌期权价格')
plt.title('看跌期权空头 Gamma 特征')
plt.show()
特征 II
- 其他条件相同的欧式期权:看涨Gamma=看跌Gamma
c + X 1 + r ( T − t ) = p + S → ∂ 2 c ∂ S 2 = ∂ 2 p ∂ S 2 c + \frac{X}{1+r(T-t)}=p+S \to \frac{\partial^2 c}{\partial S^2}= \frac{\partial^2 p}{\partial S^2} c+1+r(T−t)X=p+S→∂S2∂2c=∂S2∂2p
# 对比多头 Gamma
plt.figure(figsize=(8,5), dpi=200)
plt.plot(bc_d2x,bc_d2y,'r',lw=4,label='Call') # 因为相等 加粗
plt.plot(bp_d2x,bp_d2y,'green',label='Put')
plt.legend(loc='best')
plt.ylabel('Gamma 值')
plt.xlabel('标的价格')
plt.grid(True)
plt.show()
特征 III
- 平价附近期权的Gamma值最大
特征 IV
- 快到期时,实值、虚值、和平值期权的Delta 差异比较大
- 波动率较低时,实值、虚值、和平值期权的Delta 差异比较大
# 看涨期权的Gamma 与期限的关系
T = np.arange(0.01,2,0.001)
BS_T_r = [[BlackScholes(3.48+i*0.01,3., 0.05, t).calc('c') for i in range(5)] for t in T] # 实值
BS_T_e = [[BlackScholes(2.98+i*0.01,3., 0.05, t).calc('c') for i in range(5)] for t in T] # 平价
BS_T_i = [[BlackScholes(2.48+i*0.01,3., 0.05, t).calc('c') for i in range(5)] for t in T] # 虚值
interval_x = np.array([i*0.01 for i in range(5)])
plt.figure(figsize=(8,5), dpi=200)
for BS_T,labels,color in zip([BS_T_r,BS_T_e,BS_T_i],['实值','平价','虚值'],['r','orange','g']):
bc = [d2(interval_x, np.array(bs))[1][0] for bs in BS_T] # Buy Call Gamma
plt.plot(T,bc,color,label=labels)
plt.legend(loc='best')
plt.ylabel('Gamma 值')
plt.title('看涨期权的Gamma 与期限的关系')
plt.xlabel('期权期限(年)')
plt.xticks([0,1,2])
plt.grid(True)
plt.show()
# 看跌期权的Gamma 与期限的关系
T = np.arange(0.01,2,0.001)
BS_T_r = [[BlackScholes(3.48+i*0.01,3., 0.05, t).calc('p') for i in range(5)] for t in T] # 实值
BS_T_e = [[BlackScholes(2.98+i*0.01,3., 0.05, t).calc('p') for i in range(5)] for t in T] # 平价
BS_T_i = [[BlackScholes(2.48+i*0.01,3., 0.05, t).calc('p') for i in range(5)] for t in T] # 虚值
interval_x = np.array([i*0.01 for i in range(5)])
plt.figure(figsize=(8,5), dpi=200)
for BS_T,labels,color in zip([BS_T_i,BS_T_e,BS_T_r],['实值','平价','虚值'],['r','orange','g']):
bc = [d2(interval_x, np.array(bs))[1][0] for bs in BS_T] # Buy Put Gamma
plt.plot(T,bc,color,label=labels)
plt.legend(loc='best')
plt.ylabel('Gamma 值')
plt.title('看跌期权的Gamma 与期限的关系')
plt.xlabel('期权期限(年)')
plt.xticks([0,1,2])
plt.grid(True)
plt.show()
# 看涨期权的Gamma 与波动率的关系
Sigma = np.arange(0.01,1,0.001)
t = 0.5
BS_S_r = [[BlackScholes(3.48+i*0.01,3., sigma, t).calc('c') for i in range(5)] for sigma in Sigma] # 实值
BS_S_e = [[BlackScholes(2.98+i*0.01,3., sigma, t).calc('c') for i in range(5)] for sigma in Sigma] # 平价
BS_S_i = [[BlackScholes(2.48+i*0.01,3., sigma, t).calc('c') for i in range(5)] for sigma in Sigma] # 虚值
interval_x = np.array([i*0.01 for i in range(5)])
plt.figure(figsize=(8,5), dpi=200)
for BS_S,labels,color in zip([BS_S_r,BS_S_e,BS_S_i],['实值','平价','虚值'],['r','orange','g']):
bc = [d2(interval_x, np.array(bs))[1][0] for bs in BS_S] # Buy Call Gamma
plt.plot(Sigma,bc,color,label=labels)
plt.legend(loc='best')
plt.ylabel('Gamma 值')
plt.title('看涨期权的Gamma 与波动率的关系')
plt.xlabel('波动率')
plt.xticks([0,0.5,1],['0%','50%','100%'])
plt.grid(True)
plt.show()
# 看跌期权的Gamma 与波动率的关系
Sigma = np.arange(0.01,1,0.001)
t = 0.5
BS_S_r = [[BlackScholes(3.48+i*0.01,3., sigma, t).calc('p') for i in range(5)] for sigma in Sigma] # 实值
BS_S_e = [[BlackScholes(2.98+i*0.01,3., sigma, t).calc('p') for i in range(5)] for sigma in Sigma] # 平价
BS_S_i = [[BlackScholes(2.48+i*0.01,3., sigma, t).calc('p') for i in range(5)] for sigma in Sigma] # 虚值
interval_x = np.array([i*0.01 for i in range(5)])
plt.figure(figsize=(8,5), dpi=200)
for BS_S,labels,color in zip([BS_S_i,BS_S_e,BS_S_r],['实值','平价','虚值'],['r','orange','g']):
bc = [d2(interval_x, np.array(bs))[1][0] for bs in BS_S] # Buy Put Gamma
plt.plot(Sigma,bc,color,label=labels)
plt.legend(loc='best')
plt.ylabel('Gamma 值')
plt.title('看跌期权的Gamma 与波动率的关系')
plt.xlabel('波动率')
plt.xticks([0,0.5,1],['0%','50%','100%'])
plt.grid(True)
plt.show()
证券组合的 Gamma 值
头寸 | Gamma | 例子(N为数量) |
---|---|---|
现货多头 | 0 | 4单位: 4 × 0 = 0 4\times 0 =0 4×0=0 |
现货空头 | 0 | 3单位: 3 × 0 = 0 3\times 0 =0 3×0=0 |
期货多头 | 0 | 2单位: 2 × 0 = 0 2\times 0 =0 2×0=0 |
现货多头 | 0 | 5单位: 5 × 0 = 0 5\times 0 =0 5×0=0 |
欧式看涨期权多头 (无红利) | Γ > 0 \Gamma>0 Γ>0 | 5单位多头,每单位 Gamma 为0.005: 5 × 0.005 = 0.025 5\times 0.005 =0.025 5×0.005=0.025 |
欧式看涨期权空头 (无红利) | Γ < 0 \Gamma<0 Γ<0 | 4单位空头,每单位 Gamma 为-0.004: 4 × − 0.004 = − 0.016 4\times -0.004 =-0.016 4×−0.004=−0.016 |
欧式看跌期权多头 (无红利) | Γ > 0 \Gamma>0 Γ>0 | 3单位多头,每单位 Gamma 为0.005: 3 × 0.005 = 0.015 3\times 0.005 =0.015 3×0.005=0.015 |
欧式看跌期权空头 (无红利) | Γ < 0 \Gamma<0 Γ<0 | 2单位空头,每单位 Gamma 为-0.006: 2 × − 0.006 = 0.012 2\times -0.006 =0.012 2×−0.006=0.012 |
投资组合 | ∑ i N i ⋅ Γ i \sum_i N_i\cdot\Gamma_i i∑Ni⋅Γi |
Gamma 中性
- 只有期权有 Gamma 值
- 在投资组合中 让 Γ \Gamma Γ 为0 称 Γ \Gamma Γ 中性
- Γ \Gamma Γ 中性 时为了消除 Δ \Delta Δ 中性的误差,同样也是动态的概念
- 实现:由于保持 Γ \Gamma Γ 中性只能通过期权头寸调整获得,实现中性的结果往往时非中性,因而常常还需要运用标的资产或期货头寸进行调整,才能使得证券组合同时实现 Δ , Γ \Delta ,\ \Gamma Δ, Γ 中性
Theta ( Θ ) (\Theta) (Θ) — 时间
-
时间变化一天,期权价格大概变化多少?
-
Time 时间
-
例:
- Theta = 1.234 意味着
- 时间每过一天,期权价格大概上涨 1.234点
Vega ( ϑ ) (\vartheta) (ϑ) — 隐含波动率
-
隐含波动率变化一百分点,期权价格大概变化多少?
-
Volatility 隐含波动率
-
例:
- Vega = 1.878 意味着
- 每隐含波动率上升1%,期权价格大概上涨 1.878点
Rho ( r ) (r) (r) — 利率
- Rate 利率