開始使用免費開始

計算選擇權的 Black–Scholes 價格

套件 qrmtools 中的 Black_Scholes() 函式,可用標準的 Black–Scholes 定價公式,為不配息股票的歐式買權(call)與賣權(put)定價。

在這個練習中,你會依序為以下標的定價:價外的歐式買權、價內的歐式買權、價內的歐式賣權,以及價外的歐式賣權。若立即執行可得到正的權利金,稱為價內;否則為價外。

本題的重點是理解參與定價的各種風險因子:目前股價、目前波動度,以及目前利率。

本練習屬於課程

R 的量化風險管理

檢視課程

練習說明

  • 將目前利率 r 設為 0.01、目前波動度 sigma 設為 0.2、履約價 K 設為 100。
  • 檢視 Black_Scholes() 函式的引數。
  • 當目前股價為 S = 80、到期時間為 T = 1 年時,為一個歐式買權定價。
  • 當目前股價為 S = 120、到期時間為 T = 1 年時,為一個歐式買權定價。
  • 當目前股價為 S = 80、到期時間為 T = 1 年時,為一個歐式賣權定價。
  • 當目前股價為 S = 120、到期時間為 T = 1 年時,為一個歐式賣權定價。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Set the interest rate r to be 0.01, the volatility sigma to be 0.2 and the strike K to be 100
r <- 0.01



# Look at the arguments of the Black_Scholes function
args(___)

# Price a European call option that matures in one year if the current stock price is 80
Black_Scholes(0, ___, r, sigma, K, 1, "call")

# Price a European call option that matures in one year if the current stock price is 120


# Price a European put option that matures in one year if the current stock price is 80
Black_Scholes(___, ___, r, sigma, K, ___,"put")

# Price a European put option that matures in one year if the current stock price is 120
編輯並執行程式碼