看板 NTHU_QFG99 關於我們 聯絡資訊
※ 引述《astro54088 (戲達)》之銘言: 日曆 ==================================== function payoff = calendar( St,k,r,t,sigma,c ) %calendar spread LC=max(blsprice(St,k,r,t,sigma),0)-c;%long a call 遠期 SC=-max(St-k,0)+c;%short a call 近期 payoff=LC+SC; end ================================= k=40;%strike r=0.05;%rate t=300; c=4; St=20:0.1:60; sigma=0.4; plot(St,-max(St-k,0)+c,'--black'); hold on; plot(St,max(blsprice(St,k,r,t,sigma),0)-c,'--blue'); plot(St,calendar( St,k,r,t,sigma,c) ,'r'); ================================= 因為Black-scholes的公式 可以發現算出來的值恆正 所以寫max(blsprice(St,k,r,t,sigma),0)和blsprice(St,k,r,t,sigma)同義 That's all -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.167.98.152