17 using MathNet.Numerics.Distributions;
41 : base(name, option, riskFreeRateModel, dividendYieldModel, mirrorOption, optionModel, ivModel)
56 : this($
"Gamma({option},{mirrorOption},{GetOptionModel(optionModel, option.ID.OptionStyle)})", option, riskFreeRateModel,
57 dividendYieldModel, mirrorOption, optionModel, ivModel)
71 public Gamma(
string name,
Symbol option, PyObject riskFreeRateModel, PyObject dividendYieldModel,
Symbol mirrorOption =
null,
73 : base(name, option, riskFreeRateModel, dividendYieldModel, mirrorOption, optionModel, ivModel)
86 public Gamma(
Symbol option, PyObject riskFreeRateModel, PyObject dividendYieldModel,
Symbol mirrorOption =
null,
88 : this($
"Gamma({option},{mirrorOption},{GetOptionModel(optionModel, option.ID.OptionStyle)})", option, riskFreeRateModel,
89 dividendYieldModel, mirrorOption, optionModel, ivModel)
105 : base(name, option, riskFreeRateModel, dividendYield, mirrorOption, optionModel, ivModel)
120 : this($
"Gamma({option},{mirrorOption},{GetOptionModel(optionModel, option.ID.OptionStyle)})", option, riskFreeRateModel,
121 dividendYield, mirrorOption, optionModel, ivModel)
135 public Gamma(
string name,
Symbol option, PyObject riskFreeRateModel, decimal dividendYield = 0.0m,
Symbol mirrorOption =
null,
137 : base(name, option, riskFreeRateModel, dividendYield, mirrorOption, optionModel, ivModel)
150 public Gamma(
Symbol option, PyObject riskFreeRateModel, decimal dividendYield = 0.0m,
Symbol mirrorOption =
null,
152 : this($
"Gamma({option},{mirrorOption},{GetOptionModel(optionModel, option.ID.OptionStyle)})", option, riskFreeRateModel,
153 dividendYield, mirrorOption, optionModel, ivModel)
167 public Gamma(
string name,
Symbol option, decimal riskFreeRate = 0.05m, decimal dividendYield = 0.0m,
Symbol mirrorOption =
null,
169 : base(name, option, riskFreeRate, dividendYield, mirrorOption, optionModel, ivModel)
182 public Gamma(
Symbol option, decimal riskFreeRate = 0.05m, decimal dividendYield = 0.0m,
Symbol mirrorOption =
null,
184 : this($
"Gamma({option},{mirrorOption},{GetOptionModel(optionModel, option.ID.OptionStyle)})", option, riskFreeRate, dividendYield,
185 mirrorOption, optionModel, ivModel)
195 var strike = (
double)
Strike;
196 var timeTillExpiryDouble = (double)timeTillExpiry;
206 var norm =
new Normal();
210 result = norm.Density(-d1) / underlyingPrice / Math.Max(iv, 0.01) / Math.Sqrt(timeTillExpiryDouble);
223 var sU = underlyingPrice * upFactor * upFactor;
224 var sD = underlyingPrice / upFactor / upFactor;
242 var gammaU = (fU - fM) / (sU - underlyingPrice);
243 var gammaD = (fM - fD) / (underlyingPrice - sD);
249 throw new Exception(
"Unrecognized Option Pricing Model");
252 return Convert.ToDecimal(result);