-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpredbyAmerican.m
18 lines (18 loc) · 915 Bytes
/
SpredbyAmerican.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function [PriceFD, DeltaFD, GammaFD] = SpredbyAmerican(Price1,Price2,num1,num2,Strike,Vol1,Vol2,Div1,Div2,Corr,Settle,Maturity,RiskFreeRate,OptSpec)
price1 = num1*Price1;
price2 = num2*Price2;
Compounding = -1;
Basis = 1;
RateSpec = intenvset('ValuationDate', Settle, 'StartDates', Settle, ...
'EndDates', Maturity, 'Rates', RiskFreeRate, 'Compounding', ...
Compounding, 'Basis', Basis);
StockSpec1 = stockspec(Vol1, price1, 'Continuous', Div1);
StockSpec2 = stockspec(Vol2, price2, 'Continuous', Div2);
OutSpec = {'Price', 'Delta', 'Gamma'};
[PriceFD, DeltaFD, GammaFD, PriceGrid, AssetPrice1,AssetPrice2] = ...
spreadsensbyfd(RateSpec, StockSpec1, StockSpec2, Settle, ...
Maturity, OptSpec, Strike, Corr, 'OutSpec', OutSpec, ...
'PriceGridSize', [500 500], 'TimeGridSize', 100, ...
'AssetPriceMin', [0 0], 'AssetPriceMax', [10e7 10e7], ...
'AmericanOpt', 1);
end