www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/PriceaBarrierEuropeanDownOutCallOptionUsingtheBlackScholExample.m

    %% Price an European Barrier Down Out Call Option   

%% 
% Compute the price of an European barrier down out call option using the following data: 
Rates = 0.035;
Settle = '01-Jan-2015';
Maturity = '01-jan-2016';
Compounding = -1;
Basis = 1;  

%% 
% Define a |RateSpec|. 
RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, 'EndDates', Maturity, ...
'Rates', Rates, 'Compounding', Compounding, 'Basis', Basis)  

%% 
% Define a |StockSpec|. 
AssetPrice = 50;
Volatility = 0.30;
StockSpec = stockspec(Volatility, AssetPrice)  

%% 
% Calculate the price of an European barrier down out call option using the
% Black-Scholes option pricing model. 
Strike = 50;
OptSpec = 'call';
Barrier = 45;
BarrierSpec = 'DO';

Price = barrierbybls(RateSpec, StockSpec, OptSpec, Strike, Settle,...
Maturity,  BarrierSpec, Barrier)