%% Use Ikeda-Kunitomo Pricer and Black-Scholes Model to Price Double Barrier Instrument
% This example shows the workflow to price a DoubleBarrier instrument when you use a BlackScholes model and an IkedaKunitomo pricing method.
%% Create DoubleBarrier Instrument Object
% Use fininstrument to create a DoubleBarrier instrument object.

DoubleBarrierOpt = fininstrument("DoubleBarrier",'Strike',100,'ExerciseDate',datetime(2020,8,15),'OptionType',"call",'ExerciseStyle',"European",'BarrierType',"DKO",'BarrierValue',[110 80],'Name',"doublebarrier_option")

%
%% Create BlackScholes Model Object
% Use finmodel to create a BlackScholes model object.

BlackScholesModel = finmodel("BlackScholes","Volatility",.3)

%% Create ratecurve Object
% Create a flat ratecurve object using ratecurve.

Settle = datetime(2017,9,15);
Maturity = datetime(2023,9,15);
Rate = 0.035;
myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',12)

%% Create IkedaKunitomo Pricer Object
% Use finpricer to create an IkedaKunitomo pricer object and use the ratecurve object for the 'DiscountCurve' name-value pair argument.

outPricer = finpricer("Analytic","DiscountCurve",myRC,"Model",BlackScholesModel,'SpotPrice',100,'Curvature',[0.03 -0.03],'DividendValue',0.029,"PricingMethod","IkedaKunitomo")

%% Price DoubleBarrier Instrument
% Use price to compute the price and sensitivities for the DoubleBarrier instrument.

[Price, outPR] = price(outPricer,DoubleBarrierOpt,["all"])
outPR.Results 

% Copyright 2020 The MathWorks, Inc.