%% Use finpricer to Create ConzeViswanathan Pricer
% This example shows the workflow to create a BlackScholes model and ratecurve object to use with a ConzeViswanathan pricing method.
%
%% Create BlackScholes Model Object
% Use finmodel to create a BlackScholes model object.

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

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

Settle = datetime(2020,9,15);
Type = 'zero';
ZeroTimes = [calmonths(6) calyears([1 2 3 4 5 7 10 20 30])]';
ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307]';
ZeroDates = Settle + ZeroTimes;
 
myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates)

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

outPricer = finpricer("analytic",'Model',BlackScholesModel,'DiscountCurve',myRC,'SpotPrice',950,'DividendValue',2.5,'DividendType',"continuous",'PricingMethod',"ConzeViswanathan")

% Copyright 2019 The MathWorks, Inc.