期權
封閉式二項式期權價值與蒙特卡羅模擬的區別
我正在嘗試使用封閉式表達式和蒙特卡羅模擬來計算歐式看漲期權的價格。但是我從這兩種方法中得到的值是不一樣的:
封閉式表達式:
q=(1+r)−d在−d$$ q = \frac{(1+r)-d}{u-d} $$
C1(1+r)噸∗[噸∑一世=0(噸一世)∗q一世∗(1−q)噸−一世∗米一個X(在一世∗d噸−一世∗小號0−ķ,0)]$$ C \frac{1}{(1+r)^T} * \left [\sum \limits_{i=0}^T \binom{T}{i}q^i(1-q)^{T-i}max(u^id^{T-i}*S_0-K, 0) \right ] $$
從表達式關閉的 Python 實現:
import math T = 10 # Number of periods S0 = 8 # Starting price of stock K = 9 # Strike price of option r = 0.2 # Risk free interest rate u = 1.5 # Up factor d = 0.5 # Down factor C = 0 #Value of call risk_free = 1 / (1 + r)**T q = ((1 + r) - d) / (u - d) for i in range(T+1): prob = math.comb(T, i)*(q**T)*(1-q)**(T-i) ST = max(((u**i)*(d**(T-i))*S0)-K, 0) C += ST*prob print(risk_free*C)
輸出:4.945275514422904
蒙特卡羅模擬的Python實現:
import random T = 10 # Number of periods S0 = 8 # Starting price of stock K = 9 # Strike price of option r = 0.2 # Risk free interest rate u = 1.5 # Up factor d = 0.5 # Down factor n = 20000 # Number of runs for j in range(n): S = S0 for i in range(T): S *= u if random() < q else d value += max(S - K, 0) value /= n * (1 + r) ** T print("For {} runs the value is {}".format(n, value))
輸出:6.876698097695621
我不明白是什麼導致了這種差異,因為程式碼在我設置時確實產生了相同的值
T=2 and S0=10
,但是該輸入確實具有不同的 p 值 0.2 而目前輸入的 p 值為 0.25,但我不明白是什麼p值意味著它沒有在公式中使用..
好的,我發現了問題,我對二項式定價的實施是錯誤的。
這個python實現:
T = 10 # Number of periods S0 = 8 # Starting price of stock K = 9 # Strike price of option r = 0.2 # Risk free interest rate u = 1.5 # Up factor d = 0.5 # Down factor C = 0 q = ((1+r) - d) / (u - d) risk_free = 1 / ((1 + r)**T) for i in range(0, T+1): prob = math.comb(T, i) * (q**i) * (1-q)**(T-i) ST = (u**i) * (d**(T-i)) * S0 max_value = max(ST - K, 0) C += max_value * prob print(C * risk_free)
輸出:6.836045774062984
哪個更接近 MC 輸出