%% Use Asset Monte-Carlo Pricer and Bachelier Model to Price American Option for Vanilla Instrument
% This example shows the workflow to price an American option for a Vanilla instrument when you use a Bachelier model and an AssetMonteCarlo pricing method.
%% Create Vanilla Instrument Object
% Use fininstrument to create a Vanilla instrument object.

VanillaOpt = fininstrument("Vanilla",'Strike',105,'ExerciseDate',datetime(2022,9,15),'OptionType',"call",'ExerciseStyle',"american",'Name',"vanilla_option")

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

BachelierModel = finmodel("Bachelier","Volatility",0.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 AssetMonteCarlo Pricer Object
% Use finpricer to create an AssetMonteCarlo pricer object and use the ratecurve object for the 'DiscountCurve' name-value pair argument.

outPricer = finpricer("AssetMonteCarlo",'DiscountCurve',myRC,"Model",BachelierModel,'SpotPrice',150,'simulationDates',datetime(2022,9,15))

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

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

% Copyright 2020 The MathWorks, Inc.