%% Price Multiple Asian Instruments Using a Black-Scholes Model and Turnbull-Wakeman Pricer
% This example shows the workflow to price multiple fixed-strike Asian instruments when you use a BlackScholes model and a TurnbullWakeman pricing method.
%% Create Asian Instrument Object
% Use fininstrument to create an Asian instrument object for three Asian instruments.

AsianOpt = fininstrument("Asian",'ExerciseDate',datetime([2022,9,15; 2022,10,15; 2022,11,15]),'Strike',[1000 ; 2000 ; 3000],'OptionType',"put",'Name',"asian_option")

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

BlackScholesModel = finmodel("BlackScholes",'Volatility',.2)

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

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

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

outPricer = finpricer("analytic",'DiscountCurve',myRC,'Model',BlackScholesModel,'SpotPrice',1000,'PricingMethod',"TurnbullWakeman")

%% Price Asian Instruments
% Use price to compute the prices and sensitivities for the Asian instruments.

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

% Copyright 2021 The MathWorks, Inc.