public double impliedVolatility(double targetValue, GeneralizedBlackScholesProcess process, double accuracy, int maxEvaluations, double minVol, double maxVol)
{
if (!(!isExpired()))
{
throw new ApplicationException("option expired");
}
SimpleQuote volQuote = new SimpleQuote();
GeneralizedBlackScholesProcess newProcess = ImpliedVolatilityHelper.clone(process, volQuote);
// engines are built-in for the time being
IPricingEngine engine = null;
switch (exercise_.type())
{
case Exercise.Type.European:
engine = new AnalyticBarrierEngine(newProcess);
break;
case Exercise.Type.American:
case Exercise.Type.Bermudan:
throw new ApplicationException("Engine not available for non-European barrier option");
default:
throw new ApplicationException("unknown exercise type");
}
return(ImpliedVolatilityHelper.calculate(this, engine, volQuote, targetValue, accuracy, maxEvaluations, minVol, maxVol));
}