選擇權定價與標的資產
選擇權本質上是對標的資產未來價格走勢的「押注」。
例如,當現貨(市場)價格低於履約價時,賣權(put) 的價值就會提高。選擇權持有人可以「履約」:以履約價 \(X\) 賣出標的資產,再以現貨價 \(S < X\) 買回,獲得利潤 $X - S$。
在這個練習中,你將對 IBM 股票的歐式 賣權(put) 進行定價與視覺化,並在「現貨價 \(S\) 變動」時套用 Black-Scholes 定價公式。
履約價 X = 140,到期時間 T 為 1/2 年,無風險利率為 2%。
IBM 的年化波動率以 sigma 提供,並已提供繪圖座標軸 option_axis 讓你加入圖形。
你可以在這裡找到 black_scholes() 函式的原始碼:here。
本練習屬於課程
Python 量化風險管理
練習說明
- 將
IBM_spot設為IBM現貨價格時間序列資料的前 100 筆觀察值。 - 以列舉
IBM_spot的方式迭代,並使用black_scholes()定價公式,計算出 Numpy 陣列option_values。 - 繪製
option_values,觀察現貨價格變動(藍色)與選擇權價值變動(紅色)之間的關係。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Select the first 100 observations of IBM data
IBM_spot = IBM[:____]
# Initialize the European put option values array
option_values = np.zeros(IBM_spot.size)
# Iterate through IBM's spot price and compute the option values
for i,S in enumerate(____.values):
option_values[i] = black_scholes(S = ____, X = 140, T = 0.5, r = 0.02,
sigma = ____, option_type = "put")
# Display the option values array
option_axis.plot(____, color = "red", label = "Put Option")
option_axis.legend(loc = "upper left")
plt.show()