DAFTAR PUSTAKA
[1]
Harapan, Riswan. 2007. Penentuan Harga Opsi Asia (Tugas Akhir Program Studi Matematika Fakultas Matematika dan Ilmu Pengetahuan Alam). ITB. Bandung.
[2]
Higham, D.J. 2004.
An Introduction to Financial Option Valuation.
Cambridge University Press, Cambridge. [3]
Hull, John. Options, Futures, and Other Derivatives . Prentice Hall. New Jersey.
[4]
Kwok, Yue-Kuen. 1998. Mathematical Models of Financial Derivatives. Springer-Verlag. Singapore.
[5]
Jackel, Peter. 2001. Monte Carlo Methods in Finance. John Wiley and Sons. Chichester - United Kingdom.
[6]
McDonald, Robert L. 2006. Derivatives Markets : Second edition. Addison Wesley. New York.
[7]
Rachman, Aditya. 2008. Penentuan Nilai Barrier Option Tipe Eropa dan Amerika (Tugas Akhir Program Studi Matematika Fakultas Matematika dan Ilmu Pengetahuan Alam). ITB. Bandung.
[8]
http://www.finance.yahoo.com/ (diakses pada tanggal 18 September 2007)
[9]
http://www.cboe.com/ (diakses pada tanggal 18 September 2007)
[10]
http://www.tradingeconomics.com/ (diakses pada tanggal 27 November 2007)
65
Lampiran I Hasil simulasi penentuan harga opsi dengan metode Monte Carlo N
M
B-S
Bin
Eropa 50
LSM standar
LSM AV
LSM CV
mean
mean
β*
s.e.
s.e.
mean
s.e.
1000
3.8443 4.4912 4.5153 0.0938 4.5512 0.0317 0.4005 4.5897 0.0772
2000
3.8443 4.4912 4.5235 0.0661 4.4432 0.0228 0.3844 4.5267 0.0545
5000
3.8443 4.4912 4.5488 0.0409 4.4562 0.0143 0.3742 4.527
10000
3.8443 4.4912 4.5094 0.0296 4.4909 0.0101 0.3927 4.5117 0.0243
20000
3.8443 4.4912 4.4844 0.0205 4.4687 0.0071 0.377
4.499
0.0339
0.017
100000 3.8443 4.4912 4.4629 0.0092 4.4663 0.0032 0.3824 4.4695 0.0076 100
1000
3.8443 4.4864 4.5325 0.0973 4.4896 0.032
0.426
4.5026 0.0775
2000
3.8443 4.4864 4.5641 0.0668 4.449
5000
3.8443 4.4864 4.5028 0.0408 4.4789 0.014
10000
3.8443 4.4864 4.4638 0.0285 4.485
20000
3.8443 4.4864 4.4712 0.0206 4.4886 0.0071 0.3853 4.4865 0.017
0.0224 0.3919 4.5301 0.0546 0.373
4.4964 0.0337
0.0101 0.3669 4.4759 0.0237
100000 3.8443 4.4864 4.4631 0.0091 4.4698 0.0032 0.3737 4.4655 0.0075 200
500
1000
3.8443 4.4872 4.5849 0.0944 4.3668 0.0325 0.4145 4.5371 0.0762
2000
3.8443 4.4872 4.5132 0.0633 4.4631 0.0223 0.3727 4.4733 0.0522
5000
3.8443 4.4872 4.4707 0.0411 4.4732 0.0142 0.3851 4.493
0.0339
10000
3.8443 4.4872 4.4688 0.0283 4.4761 0.0101 0.3688 4.489
0.0236
20000
3.8443 4.4872 4.4561 0.0198 4.4803 0.0072 0.3545 4.4728 0.0165
50000
3.8443 4.4872 4.458
1000
3.8443 4.487
4.6789 0.0863 4.4864 0.0309 0.3318 4.6622 0.074
2000
3.8443 4.487
4.5675 0.0616 4.5024 0.0223 0.3422 4.6043 0.0526
5000
3.8443 4.487
4.5312 0.0419 4.4573 0.0145 0.3915 4.5755 0.0347
10000
3.8443 4.487
4.4689 0.0281 4.4681 0.0101 0.3605 4.4945 0.0235
15000
3.8443 4.487
4.4452 0.0226 4.469
20000
3.8443 4.487
4.446
1000 1000
0.0126 4.4668 0.0045 0.3587 4.4608 0.0105
0.0083 0.3512 4.4634 0.019
0.0195 4.4791 0.0072 0.3469 4.4563 0.0164
3.8443 4.4866 4.5696 0.0916 4.5384 0.0318 0.3723 4.6375 0.0775
66
2000
3.8443 4.4866 4.5007 0.0615 4.4881 0.0226 0.3527 4.5455 0.052
2500
3.8443 4.4866 4.498
5000
3.8443 4.4866 4.4825 0.0385 4.472
7500
3.8443 4.4866 4.4743 0.0323 4.4748 0.0116 0.3541 4.508
10000
3.8443 4.4866 4.4743 0.0267 4.476
0.0576 4.4373 0.0205 0.3782 4.5529 0.0481 0.0142 0.3404 4.5213 0.0327 0.0272
0.0101 0.3219 4.4927 0.0229
67
Lampiran II Program - program
function S = asset_price(s,k,r,v,T,M) %Generate Security Price randn('state',1000); N = 50; dt = T/(N-1); S = zeros(M,N); drift=(r-v^2/2)*dt; vsqrdt=v*dt^0.5; S(:,1) = s; for i = 1:M, st = s; t = 0; for j = 2:N+1 st = st*exp(drift+vsqrdt*randn); t = t+dt; S(i,j) = st; end end
function S = asset_price_antitetic_variate(s,k,r,v,T,M)
%Generate Security Price randn('state',1000); N = 50; dt = T/(N-1); S = zeros(M,N); drift=(r-v^2/2)*dt; vsqrdt=v*dt^0.5; for i = 1:M st2 = s; t = 0; for j = 2:N+1 st2 = st2*exp(drift-vsqrdt*randn); t = t+dt; S2(i,j) = st2; end end S2(:,1) = s; S = S2;
68
function V = european_asian_aritmatik_average_asset_option(S,k,r,T,call_put) [M,N] = size(S); RatArit = zeros(M,1); for i =1:M RatArit(i) = mean(S(i,:)); end V = zeros(M,1); V = exp(-r*T)*max(call_put*(RatArit-k),0);
function V = european_asian_aritmatik_average_strike_option(S,k,r,T,call_put) [M,N] = size(S); RatArit = zeros(M,1); for i =1:M RatArit(i) = mean(S(i,:)); end V = zeros(M,1); V = exp(-r*T)*max(call_put*(S(:,end)-RatArit),0);
function V = european_asian_geometrik_average_asset_option(S,k,r,T,call_put) [M,N] = size(S); RatGeo = zeros(M,1); for i =1:M RatGeo(i) = exp((1/N)*sum(log(S(i,:)))); end V = zeros(M,1); V = exp(-r*T)*max(call_put*(RatGeo-k),0);
69
function V = european_asian_geometrik_average_strike_option(S,k,r,T,call_put) [M,N] = size(S); RatGeo = zeros(M,1); for i =1:M RatGeo(i) = exp((1/N)*sum(log(S(i,:)))); end V = zeros(M,1); V = exp(-r*T)*max(call_put*(S(:,end)-RatGeo),0);
function V = european_down_and_in_barrier_option(S,k,B,r,T,call_put) [M,N] = size(S); Smin = zeros(1,1); V = zeros(M,1); for i = 1:M Smin = min(S(i,:)); if Smin < B V(i) = exp(-r*T)*max(call_put*(S(i,end)-k),0); end end
function V = european_down_and_out_barrier_option(S,k,B,r,T,call_put) [M,N] = size(S); Smin = zeros(1,1); V = zeros(M,1); for i = 1:M Smin = min(S(i,:)); if Smin > B V(i) = exp(-r*T)*max(call_put*(S(i,end)-k),0); end end
70
function V = european_fixed_strike_lookback_option(S,k,r,T,call_put) [M,N] = size(S); Smax = zeros(M,1); Smin = zeros(M,1); V = zeros(M,1); if call_put == 1 for i = 1:M Smax(i) = max(S(i,:)); end V = exp(-r*T)*max(Smax-(ones(M,1)*k),0); elseif call_put == -1 for i = 1:M Smin(i) = min(S(i,:)); end V = exp(-r*T)*max((ones(M,1)*k)-Smin,0); end
function V = european_floating_strike_lookback_option(S,k,r,T,call_put) [M,N] = size(S); Smax = zeros(M,1); Smin = zeros(M,1); V = zeros(M,1); if call_put == 1 for i = 1:M Smin(i) = min(S(i,:)); end V = exp(-r*T)*max(S(:,end)-Smin,0); elseif call_put == -1 for i = 1:M Smax(i) = max(S(i,:)); end V = exp(-r*T)*max(Smax-S(:,end),0); end
function V = european_option(S,k,r,T,call_put) [M,N] = size(S); V = zeros(M,1); V = exp(-r*T)*max(call_put*(S(:,end)-k),0);
71
function V = european_up_and_in_barrier_option(S,k,B,r,T,call_put) [M,N] = size(S); Smax = zeros(1,1); V = zeros(M,1); for i = 1:M Smax = max(S(i,:)); if Smax > B V(i) = exp(-r*T)*max(call_put*(S(i,end)-k),0); end end
function V = european_up_and_out_barrier_option(S,k,B,r,T,call_put) [M,N] = size(S); Smax = zeros(1,1); V = zeros(M,1); for i = 1:M Smax = max(S(i,:)); if Smax < B V(i) = exp(-r*T)*max(call_put*(S(i,end)-k),0); end end
function [aM,bM,se] = monte_carlo(V) M = length(V); Vsum = 0; for i = 1:M Vsum = Vsum + V(i); end aM = (1/M)*Vsum; Vsel = V-aM; Vsum2 = 0; for i = 1:M Vsum2 = Vsum2 + (Vsel(i))^2; end bM = sqrt((1/(M-1))*Vsum2); se = bM/sqrt(M);
72
function V = american_option(S,k,r,T) N = 50; dt = T/(N-1); smat = S; CC = smat*0; CE = smat*0; EF = smat*0; st = smat(:,N); CE(:,N) = max(k-st,0); CC(:,N) = CE(:,N); EF(:,N) = (CE(:,N)>0); paramat = zeros(3,N);
%cash flow dari kekontinuan %Keputusan Excercise
%coeff dari fungsi basis
for p = N-1:-1:2, st = smat(:,p); CE(:,p) = max(k-st,0); %hanya payoff positif yang digunakan sebagai input regresi idx = find(CE(:,p)>0); X = smat(idx,p); Y = CC(idx,p+1)*exp(-r*dt); %Regresikan nilai kekontinuan diskonto reg = [ones(size(X,1),1),X,X.^2]; b = lscov(reg,Y); CC(idx,p) = b(1)+b(2)*X+b(3)*X.^2; %Jika nilai exercise melebihi nilai kekontinuan maka exercise opsi EF(idx,p) = CE(idx,p) > CC(idx,p); EF(find(EF(:,p)),p+1:N) = 0; paramat(:,p) = b; idx = find(EF(:,p) == 0); %jangan simpan nilai regresi dari CC untuk keperluan berikutnya CC(idx,p) = CC(idx,p+1)*exp(-r*dt); idx = find(EF(:,p) == 1); CC(idx,p) = CE(idx,p); end for i = 1:N idx = find(EF(:,i) == 1); V(idx) = exp(-r*(i-1)*dt)*max(k-smat(idx,i),0); End
73
function varargout = GUI_MC(varargin) gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @GUI_MC_OpeningFcn, ... 'gui_OutputFcn', @GUI_MC_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end function GUI_MC_OpeningFcn(hObject, eventdata, handles, varargin) set(handles.asian_popup,'Enable','off'); set(handles.asian_popup,'Visible','off'); set(handles.lookback_popup,'Enable','off'); set(handles.lookback_popup,'Visible','off'); set(handles.ex_popup,'Enable','off'); set(handles.ex_popup,'Visible','on'); set(handles.barrier_popup,'Enable','off'); set(handles.barrier_popup,'Visible','off'); set(handles.b_input,'Enable','off'); set(handles.text38,'Enable','off'); set(handles.text39,'Enable','off'); set(handles.start_input,'String',datestr(now,'dd/mm/yyyy')); set(handles.exp_input,'String',datestr(now,'dd/mm/yyyy')); set(handles.life_input,'String',0);
handles.put_call = 1; handles.ea = 1; handles.asian_op = 1; handles.exo = 1; handles.br_op = 1; handles.lookback_op = 1; coni = 1.96; handles.output = hObject; guidata(hObject, handles); clc
74
function varargout = GUI_MC_OutputFcn(hObject, eventdata, handles) varargout{1} = handles.output;
function european_or_american_popup_Callback(hObject, eventdata, handles) val = get(hObject,'Value'); str = get(hObject, 'String'); switch str{val}; case 'European' handles.ea = 1; set(handles.call_or_put_popup,'Value',1); set(handles.call_or_put_popup,'Enable','on'); set(handles.standart_or_exotic_popup,'Enable','on'); case 'American' handles.ea = 2; set(handles.call_or_put_popup,'Value',2); set(handles.call_or_put_popup,'Enable','off'); set(handles.standart_or_exotic_popup,'Value',1); set(handles.standart_or_exotic_popup,'Enable','off'); end guidata(hObject,handles) function european_or_american_popup_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function call_or_put_popup_Callback(hObject, eventdata, handles) val = get(hObject,'Value'); str = get(hObject, 'String'); switch str{val}; case 'Call' handles.put_call = 1; case 'Put' handles.put_call = -1; end guidata(hObject,handles)
function call_or_put_popup_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function s_input_Callback(hObject, eventdata, handles)
75
function s_input_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function v_input_Callback(hObject, eventdata, handles) function v_input_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function op_output_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function se_output_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function run_button_Callback(hObject, eventdata, handles)
%Input s = str2double(get(handles.s_input,'String')); k = str2double(get(handles.k_input,'String')); r = str2double(get(handles.r_input,'String')); v = str2double(get(handles.v_input,'String')); T = str2double(get(handles.T_input,'String')); M = str2double(get(handles.M_input,'String')); B = str2double(get(handles.b_input,'String')); ci = get(handles.confinf_list,'Value'); if (ci==2) coni = 1.28; elseif (ci==3) coni = 1.645; elseif (ci==1) coni = 1.96; elseif (ci==4) coni = 2.58; end
76
call_put = handles.put_call; exotic = handles.exo; asian_opt = handles.asian_op; barrier_opt = handles.br_op; lookback_opt = handles.lookback_op; eu_am = handles.ea; %Let's Proses begin here%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Generate Security Price S = asset_price(s,k,r,v,T,M); S_anti = asset_price_antitetic_variate(s,k,r,v,T,M); if (eu_am==1)%Opsi Eropa if (exotic == 1) %opsi standard V1 = european_option(S,k,r,T,call_put); V2 = european_option(S_anti,k,r,T,call_put); V = (V1+V2)/2; elseif (exotic == 2) %opsi asian if (asian_opt == 1) V1 = european_asian_aritmatik_average_asset_option(S,k,r,T,call_put); V2 = european_asian_aritmatik_average_asset_option(S_anti,k,r,T,call_put); V = (V1+V2)/2; elseif (asian_opt == 2) V1 = european_asian_aritmatik_average_strike_option(S,k,r,T,call_put); V2 = european_asian_aritmatik_average_strike_option(S_anti,k,r,T,call_put); V = (V1+V2)/2; elseif (asian_opt == 3) V1 = european_asian_geometrik_average_asset_option(S,k,r,T,call_put); V2 = european_asian_geometrik_average_asset_option(S_anti,k,r,T,call_put); V = (V1+V2)/2; elseif (asian_opt == 4) V1 = european_asian_geometrik_average_strike_option(S,k,r,T,call_put); V2 = european_asian_geometrik_average_strike_option(S_anti,k,r,T,call_put); V = (V1+V2)/2; end elseif (exotic == 3) % opsi barrier if (barrier_opt == 1) V1 = european_up_and_out_barrier_option(S,k,B,r,T,call_put); V2 = european_up_and_out_barrier_option(S_anti,k,B,r,T,call_put); V = (V1+V2)/2; elseif (barrier_opt == 2) V1 = european_up_and_in_barrier_option(S,k,B,r,T,call_put); V2 = european_up_and_in_barrier_option(S_anti,k,B,r,T,call_put); V = (V1+V2)/2; elseif (barrier_opt == 3) V1 = european_down_and_out_barrier_option(S,k,B,r,T,call_put); V2 = european_down_and_out_barrier_option(S_anti,k,B,r,T,call_put); V = (V1+V2)/2; elseif (barrier_opt == 4)
77
V1 = european_down_and_in_barrier_option(S,k,B,r,T,call_put); V2 = european_down_and_in_barrier_option(S_anti,k,B,r,T,call_put); V = (V1+V2)/2; end elseif (exotic == 4) % opsi lookback if (lookback_opt == 1) V1 = european_fixed_strike_lookback_option(S,k,r,T,call_put); V2 = european_fixed_strike_lookback_option(S_anti,k,r,T,call_put); V = (V1+V2)/2; elseif (lookback_opt == 2) V1 = european_floating_strike_lookback_option(S,k,r,T,call_put); V2 = european_floating_strike_lookback_option(S_anti,k,r,T,call_put); V = (V1+V2)/2; end end elseif (eu_am == 2) V = american_option(S,k,r,T); end
%Monte Carlo [aM,bM,se] = monte_carlo(V); %Output set(handles.se_output,'String',se); set(handles.op_output,'String',aM); set(handles.left_output,'String',aM - coni*se); set(handles.right_output,'String',aM + coni*se); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %end of the proses%%%%%%%%%%%%%%%%%%%%%%%%%% function run_button_ButtonDownFcn(hObject, eventdata, handles) function right_output_Callback(hObject, eventdata, handles) function right_output_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end
function start_input_Callback(hObject, eventdata, handles) sd = datenum(get(handles.start_input,'String'),'dd/mm/yyyy'); sd_temp = sd; ed = datenum(get(handles.exp_input,'String'),'dd/mm/yyyy'); if (ed-sd>=0) set(handles.life_input,'String',round((ed-sd)));
78
life = round(str2double(get(handles.life_input,'String'))); set(handles.T_input,'String',life/365); else set(handles.start_input,'String',datestr(sd_temp,'dd/mm/yyyy')); set(handles.life_input,'String','???'); set(handles.T_input,'String','???'); end
function start_input_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function exp_input_Callback(hObject, eventdata, handles) ed = datenum(get(handles.exp_input,'String'),'dd/mm/yyyy'); ed_temp = ed; sd = datenum(get(handles.start_input,'String'),'dd/mm/yyyy'); if (ed-sd>=0) set(handles.life_input,'String',round((ed-sd))); life = round(str2double(get(handles.life_input,'String'))); set(handles.T_input,'String',life/365); else set(handles.exp_input,'String',datestr(ed_temp,'dd/mm/yyyy')); set(handles.life_input,'String','???'); set(handles.T_input,'String','???'); end function exp_input_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function life_input_Callback(hObject, eventdata, handles) sd = datenum(get(handles.start_input,'String'),'dd/mm/yyyy'); ed = datenum(get(handles.exp_input,'String'),'dd/mm/yyyy'); life = round(str2double(get(handles.life_input,'String'))); set(handles.life_input,'String',life); set(handles.exp_input,'String',datestr(sd + life,'dd/mm/yyyy')); set(handles.T_input,'String',life/365); function life_input_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
79
end function confinf_list_Callback(hObject, eventdata, handles) se = str2double(get(handles.se_output,'String')); aM = str2double(get(handles.op_output,'String')); val = get(hObject,'Value'); str = get(hObject, 'String'); switch str{val}; case '80' set(handles.left_output,'String',aM - 1.28*se); set(handles.right_output,'String',aM + 1.28*se); case '90' set(handles.left_output,'String',aM - 1.645*se); set(handles.right_output,'String',aM + 1.645*se); case '95' set(handles.left_output,'String',aM - 1.96*se); set(handles.right_output,'String',aM + 1.96*se); case '99' set(handles.left_output,'String',aM - 2.58*se); set(handles.right_output,'String',aM + 2.58*se); end guidata(hObject,handles) function confinf_list_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function T_input_Callback(hObject, eventdata, handles) T = str2double(get(handles.T_input,'String')); life = round(T*365); set(handles.life_input,'String',life); T = life/365; set(handles.T_input,'String',T); sd = datenum(get(handles.start_input,'String'),'dd/mm/yyyy'); ed = datenum(get(handles.exp_input,'String'),'dd/mm/yyyy'); set(handles.exp_input,'String',datestr(sd + life,'dd/mm/yyyy'));
function standart_or_exotic_popup_Callback(hObject, eventdata, handles) val = get(hObject,'Value'); str = get(hObject, 'String'); switch str{val}; case 'Standard' set(handles.asian_popup,'Enable','off'); set(handles.asian_popup,'Visible','off'); set(handles.ex_popup,'Enable','off'); set(handles.ex_popup,'Visible','on');
80
set(handles.barrier_popup,'Enable','off'); set(handles.barrier_popup,'Visible','off'); set(handles.lookback_popup,'Enable','off'); set(handles.lookback_popup,'Visible','off'); set(handles.b_input,'Enable','off'); set(handles.text38,'Enable','off'); set(handles.text39,'Enable','off'); set(handles.european_or_american_popup,'Enable','on'); handles.exo = 1; case 'Asian' set(handles.asian_popup,'Enable','on'); set(handles.asian_popup,'Visible','on'); set(handles.ex_popup,'Enable','off'); set(handles.ex_popup,'Visible','off'); set(handles.barrier_popup,'Enable','off'); set(handles.barrier_popup,'Visible','off'); set(handles.lookback_popup,'Enable','off'); set(handles.lookback_popup,'Visible','off'); set(handles.b_input,'Enable','off'); set(handles.text38,'Enable','off'); set(handles.text39,'Enable','off'); set(handles.european_or_american_popup,'Enable','off'); handles.exo = 2; case 'Barrier' set(handles.asian_popup,'Enable','off'); set(handles.asian_popup,'Visible','off'); set(handles.ex_popup,'Enable','off'); set(handles.ex_popup,'Visible','off'); set(handles.barrier_popup,'Enable','on'); set(handles.barrier_popup,'Visible','on'); set(handles.lookback_popup,'Enable','off'); set(handles.lookback_popup,'Visible','off');
set(handles.b_input,'Enable','on'); set(handles.text38,'Enable','on'); set(handles.text39,'Enable','on'); set(handles.european_or_american_popup,'Enable','off');
81
handles.exo = 3; case 'Lookback' set(handles.asian_popup,'Enable','off'); set(handles.asian_popup,'Visible','off'); set(handles.ex_popup,'Enable','off'); set(handles.ex_popup,'Visible','off'); set(handles.barrier_popup,'Enable','off'); set(handles.barrier_popup,'Visible','off'); set(handles.lookback_popup,'Enable','on'); set(handles.lookback_popup,'Visible','on');
set(handles.b_input,'Enable','off'); set(handles.text38,'Enable','off'); set(handles.text39,'Enable','off'); set(handles.european_or_american_popup,'Enable','off'); handles.exo = 4; end guidata(hObject,handles) function standart_or_exotic_popup_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function ex_popup_Callback(hObject, eventdata, handles) function ex_popup_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function barrier_popup_Callback(hObject, eventdata, handles) val = get(hObject,'Value'); str = get(hObject, 'String'); switch str{val}; case 'Up and Out' handles.br_op = 1; case 'Up and In' handles.br_op = 2; case 'Down and Out' handles.br_op = 3;
82
case 'Down and In' handles.br_op = 4; end guidata(hObject,handles) function barrier_popup_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end
function asian_popup_Callback(hObject, eventdata, handles) val = get(hObject,'Value'); str = get(hObject, 'String'); switch str{val}; case 'Aritmatik Average Asset' handles.asian_op = 1; case 'Aritmatik Average Strike' handles.asian_op = 2; case 'Geometrik Average Asset' handles.asian_op = 3; case 'Geometrik Average Strike' handles.asian_op = 4; end guidata(hObject,handles) function asian_popup_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function b_input_Callback(hObject, eventdata, handles) function b_input_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function HV_button_Callback(hObject, eventdata, handles) val = get(handles.HV_button,'Value'); if (val == 0) set(handles.v_input,'Enable','on'); set(handles.v_input,'String',0.2); set(handles.browse_popup,'Enable','off');
83
set(handles.browse_popup,'Value',1); set(handles.browse_popup,'String',{'not set'}); elseif (val ==1) set(handles.v_input,'Enable','off'); fold = dir('*.csv'); convcel = struct2cell(fold); nama2 = convcel(1,:); set(handles.browse_popup,'Enable','on'); set(handles.browse_popup,'String',nama2); end function browse_popup_Callback(hObject, eventdata, handles) choose_str = get(handles.browse_popup,'String'); choose_val = get(handles.browse_popup,'Value'); choose = choose_str{choose_val}; data = csvread(choose,1,1); % open = data(:,1); % high = data(:,2); % low = data(:,3); close = data(:,4); data_text = textread(choose,'%s',-1); ed = datestr(datenum(data_text{3}(1:10),'yyyy-mm-dd'),'dd/mm/yyyy'); sd = datestr(datenum(data_text{end}(1:10),'yyyy-mm-dd'),'dd/mm/yyyy'); set(handles.awal_hv,'String',sd); set(handles.akhir_hv,'String',ed); pjg = length(close); set(handles.range_hv,'String',pjg); for i = 1:pjg-1; lognor(i) = log(close(i+1)/close(i)); end sdv = std(lognor); hv = sdv*sqrt(252); set(handles.v_input,'String',num2str(hv,'%6.4f')); function browse_popup_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end function k_input_Callback(hObject, eventdata, handles) function r_input_Callback(hObject, eventdata, handles) function k_input_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
84
function r_input_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
function M_input_Callback(hObject, eventdata, handles) function M_input_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function T_input_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
function lookback_popup_Callback(hObject, eventdata, handles) val = get(hObject,'Value'); str = get(hObject, 'String'); switch str{val}; case 'Fixed Strike' handles.lookback_op = 1; case 'Floating Strike' handles.lookback_op = 2; end guidata(hObject,handles) function lookback_popup_CreateFcn(hObject, eventdata, handles) if ispc set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end
85
Lampiran III Data historis saham YHOO Adj Date Open High Low Close Volume Close 9/14/2007 23.69 25 23.65 24.73 28868600 24.73 9/13/2007 23.6 23.96 23.6 23.72 10309000 23.72 9/12/2007 23.64 23.94 23.53 23.56 16553700 23.56 9/11/2007 23.31 23.84 23.31 23.71 17207500 23.71 9/10/2007 23.85 23.85 23.1 23.3 15246000 23.3 9/7/2007 23.76 24.05 23.6 23.76 12591900 23.76 9/6/2007 24.22 24.32 23.62 24.15 13922100 24.15 9/5/2007 24.1 24.4 23.91 24.1 23071000 24.1 9/4/2007 23.3 24.5 23.2 23.97 43598600 23.97 8/31/2007 22.81 22.83 22.51 22.73 13052500 22.73 8/30/2007 22.49 22.91 22.38 22.61 18172500 22.61 8/29/2007 22.6 22.69 22.27 22.55 24599900 22.55 8/28/2007 22.95 23.1 22.5 22.52 18030600 22.52 8/27/2007 23.59 23.76 23.01 23.03 16523800 23.03 8/24/2007 23.03 23.73 23.03 23.59 11191100 23.59 8/23/2007 23.35 23.36 22.95 23.13 15603000 23.13 8/22/2007 23.22 23.52 23.18 23.23 18763700 23.23 8/21/2007 23.25 23.48 22.91 23.04 25962900 23.04 8/20/2007 23.64 23.74 23.18 23.34 13338900 23.34 8/17/2007 23.26 23.63 22.76 23.54 19528200 23.54 8/16/2007 23 23.15 22.5 22.76 29652200 22.76 8/15/2007 23.56 24 23.25 23.32 18767700 23.32 8/14/2007 24.69 24.7 23.69 23.72 18707100 23.72 8/13/2007 24.21 24.74 24.01 24.57 21317600 24.57 8/10/2007 23.93 24.22 23.52 23.94 22939800 23.94 8/9/2007 23.67 24.45 23.51 23.8 24052500 23.8 8/8/2007 23.46 23.87 23.43 23.87 17198000 23.87 8/7/2007 22.75 23.7 22.69 23.44 20075300 23.44 8/6/2007 23.03 23.15 22.44 22.97 28948000 22.97 8/3/2007 23.2 23.39 22.87 22.92 19702100 22.92 8/2/2007 22.65 23.7 22.65 23.36 21098900 23.36 8/1/2007 23.17 23.4 22.85 23.25 22030400 23.25 7/31/2007 23.88 23.93 23.24 23.25 21575800 23.25 7/30/2007 23.55 23.88 23.38 23.62 20976600 23.62 7/27/2007 23.98 24.49 23.47 23.49 35783800 23.49 7/26/2007 24.4 24.49 23.62 24.03 33373300 24.03 7/25/2007 25.01 25.32 24.59 24.68 21882400 24.68 7/24/2007 24.8 25.34 24.73 24.84 28981000 24.84
86
7/23/2007 7/20/2007 7/19/2007 7/18/2007 7/17/2007 7/16/2007 7/13/2007 7/12/2007 7/11/2007 7/10/2007 7/9/2007 7/6/2007 7/5/2007 7/3/2007 7/2/2007 6/29/2007 6/28/2007 6/27/2007 6/26/2007 6/25/2007 6/22/2007 6/21/2007 6/20/2007 6/19/2007 6/18/2007 6/15/2007 6/14/2007 6/13/2007 6/12/2007 6/11/2007 6/8/2007 6/7/2007 6/6/2007 6/5/2007 6/4/2007 6/1/2007 5/31/2007 5/30/2007 5/29/2007 5/25/2007 5/24/2007 5/23/2007 5/22/2007 5/21/2007
25.43 25.7 26.32 26.07 26.74 26.48 26.87 26.7 27.03 27.09 26.92 27.01 26.92 26.95 27.19 27.21 27.44 27.51 27.73 27.6 27.68 27.69 27.89 29.4 27.72 27.49 27.38 27.12 27.3 27.27 27.02 27.34 28.05 28.4 28.6 28.9 28.76 28.19 28.36 28.44 28.65 29.1 29.33 29.62
25.46 25.89 26.34 26.72 27.8 26.74 26.97 26.97 27.05 27.57 27.33 27.14 27.14 27.25 27.27 27.38 27.49 27.66 28.18 27.77 27.79 27.94 28.17 29.4 28.34 27.52 27.64 27.41 27.66 27.52 27.45 27.73 28.11 28.59 28.78 29.13 28.85 28.38 28.73 28.73 28.88 29.37 29.35 29.86
24.98 25.2 25.92 26.02 26.7 26.13 26.5 26.34 26.55 26.96 26.82 26.93 26.9 26.9 26.76 26.93 27.12 27.4 27.36 27.34 27.31 27.55 27.66 27.54 27.5 27.19 27.15 26.61 26.98 27.15 26.96 26.98 27.3 28.1 28.4 28.61 28.49 28 28.2 28.34 28.25 28.53 28.78 29.32
24.99 26631500 25.35 38056100 26.03 29537900 26.2 65125900 27.53 53656100 26.7 30804500 26.58 18522700 26.96 20082300 26.69 21970700 26.97 24635500 27.2 17515800 27.1 12284500 26.99 16071900 27 11643400 26.86 21011000 27.13 13842500 27.25 17124500 27.58 13997000 27.71 25324000 27.64 21232200 27.38 33796900 27.67 17885800 27.66 33496400 27.63 65967500 28.12 70919400 27.31 23816900 27.3 18919400 27.38 31210700 27.05 22203600 27.35 14856500 27.39 18618500 26.98 34232300 27.44 33508200 28.23 20494800 28.59 13428800 28.78 12398800 28.7 15859100 28.38 16046800 28.4 13981500 28.58 10334600 28.41 19122900 28.61 27964400 28.92 19131300 29.35 18955900
24.99 25.35 26.03 26.2 27.53 26.7 26.58 26.96 26.69 26.97 27.2 27.1 26.99 27 26.86 27.13 27.25 27.58 27.71 27.64 27.38 27.67 27.66 27.63 28.12 27.31 27.3 27.38 27.05 27.35 27.39 26.98 27.44 28.23 28.59 28.78 28.7 28.38 28.4 28.58 28.41 28.61 28.92 29.35
87
5/18/2007 5/17/2007 5/16/2007 5/15/2007 5/14/2007 5/11/2007 5/10/2007 5/9/2007 5/8/2007 5/7/2007 5/4/2007 5/3/2007 5/2/2007 5/1/2007 4/30/2007 4/27/2007 4/26/2007 4/25/2007 4/24/2007 4/23/2007 4/20/2007 4/19/2007 4/18/2007 4/17/2007 4/16/2007 4/13/2007 4/12/2007 4/11/2007 4/10/2007 4/9/2007 4/5/2007 4/4/2007 4/3/2007 4/2/2007 3/30/2007 3/29/2007 3/28/2007 3/27/2007 3/26/2007 3/23/2007 3/22/2007 3/21/2007 3/20/2007
28.9 28.99 28.89 29.16 29.79 29.62 30.52 30.17 30.24 30.13 33.27 28.25 27.72 28.25 28.32 28.35 27.98 28.22 28.03 27.53 27.86 28.1 28.42 31.98 31.68 31.15 31.26 31.65 31.64 32.01 32 31.61 31.41 31.22 31.21 31.71 31.45 31.56 31.25 31.33 31.36 30.33 30
29.8 29.13 29.37 29.42 30 30.08 30.69 30.44 31.1 30.98 33.61 28.5 28.26 28.35 28.5 28.86 28.65 28.27 28.26 28.14 27.86 28.23 28.9 32.14 31.79 31.5 31.42 31.73 32.02 32.24 32.09 31.87 32 31.4 31.6 31.73 31.7 31.66 31.74 31.7 31.44 31.39 30.35
28.78 28.49 28.25 28.75 29.08 29.53 29.61 29.95 30.21 29.86 29.58 28.01 27.72 27.53 28 28.17 27.73 27.68 27.69 27.37 27.37 27.46 27.89 31.71 31.24 30.96 31.1 30.9 31.6 31.6 31.72 31.48 31.41 30.93 31.02 30.83 31.25 31.24 31.24 31.16 30.85 30.21 29.94
29.75 35487200 28.57 23535000 29.21 32944800 28.81 22226800 29.31 20895900 30.05 13838800 29.7 26570200 30.22 23533100 30.41 28018200 30.38 41243900 30.98 2.46E+08 28.18 20119500 28.12 16911800 27.73 18310900 28.04 17596300 28.34 21097000 28.49 32331000 28.06 35568600 28.02 25964000 27.88 27262400 27.46 39123300 27.51 45664700 28.31 1.28E+08 32.09 43223800 31.61 14359100 31.41 12006300 31.21 13904800 31.17 16141100 31.69 12797600 31.64 12408000 31.96 13878100 31.62 7836200 31.72 12324600 31.28 8668800 31.29 9425000 31.34 13815000 31.41 13162500 31.55 9403100 31.66 12907000 31.36 12727900 31.26 12989800 31.29 26667300 30.33 12203800
29.75 28.57 29.21 28.81 29.31 30.05 29.7 30.22 30.41 30.38 30.98 28.18 28.12 27.73 28.04 28.34 28.49 28.06 28.02 27.88 27.46 27.51 28.31 32.09 31.61 31.41 31.21 31.17 31.69 31.64 31.96 31.62 31.72 31.28 31.29 31.34 31.41 31.55 31.66 31.36 31.26 31.29 30.33
88