Re: [閒聊] 蝴蝶蝴蝶真的真美麗

看板NTHU_QFG99作者 (戲達)時間14年前 (2011/03/09 14:48), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/3 (看更多)
日曆 ==================================== 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'); ====================================== input ======================================== E1=input('請輸入E1='); E2=input('請輸入E2='); S=linspace(0,6,100); B=max(S-E1,0)-max(S-E2,0); plot(S,B); ylim([0,3]); xlabel('S'); ylabel('B'); title('Bull Spread payoff') grid on ================================= 慢用 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.114.135.236
文章代碼(AID): #1DToBEpR (NTHU_QFG99)
文章代碼(AID): #1DToBEpR (NTHU_QFG99)