%% Price a European Double Knock-Out Call Option
% Compute the price of a European for a double knock-out (down and out-up and out) call option using the following data:

Rate = 0.05;
Settle = '01-Jun-2018';
Maturity = '01-Dec-2018';
Basis = 1;

%
% Define a RateSpec.

RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, 'EndDates', Maturity,'Rates', Rate, 'Compounding', -1, 'Basis', Basis);

%
% Define a StockSpec.

AssetPrice = 100; 
Volatility = 0.25;
StockSpec = stockspec(Volatility, AssetPrice);

% Define the double barrier option.

LBarrier = 80; 
UBarrier = 130; 
Barrier = [UBarrier LBarrier];
BarrierSpec = 'DKO';
OptSpec = 'Call';
Strike = 110;

%
% Compute price of option using flat boundaries.

PriceFlat = dblbarrierbybls(RateSpec, StockSpec, OptSpec, Strike, Settle, Maturity, BarrierSpec, Barrier)

% Compute price of option using two curved boundaries.

Curvature = [0.05 -0.05];
PriceCurved = dblbarrierbybls(RateSpec, StockSpec, OptSpec, Strike, Settle, Maturity, BarrierSpec, Barrier, 'Curvature', Curvature)

%
% Copyright 2018 The MathWorks, Inc.