[問題]用fsolve解BS選擇權公式的某個參數

作者: lucow (lucow)   2014-03-29 10:24:12
請問有人知道怎麼解嗎
% close form pricing model option with Call-on-call option
function F = BS_cf(cp,S,K,r,q,vol,t,bv)
% Input
% cp: '1' is call option and '2' is put option.
% S: initial stock price.
% K: strike price.
% r: annual risk-free interest rate.
% q: annual dividend yield.
% vol: annual volatility of stock return rate.
% t: time to maturity (in year).
% Output
% premium: fair premium of European option under Black-Scholes model.
% computing parameters
d1 = (log(S/K)+(r-q+0.5*vol^2)*t)/(vol*t^0.5); d2 = d1 - vol*t^0.5;
Nd1 = normcdf(d1,0,1); Nd2 = normcdf(d2,0,1);
% choosing the call formula or put formula
if cp == 1
F = (S*exp(-1*q*t)*Nd1 - K*exp(-1*r*t)*Nd2)-bv;
elseif cp == 2
F = (K*exp(-1*r*t)*(1-Nd2) - S*exp(-1*q*t)*(1-Nd1))-bv;
else
end
end
我想要解選擇權的價格=bv時候的S是多少
所以打了這個程式檔,可是我用fsolve去跑的時候卻Error
麻煩知道的人救我
作者: primeman (精華)   2014-03-29 23:37:00
這樣不能解 因為分佈是含有S

Links booklink

Contact Us: admin [ a t ] ucptt.com