/// <summary> /// Compute a Volatility using a bootstrapped engine and the set of identifying parameters /// </summary> /// <param name="engineHandle">The engine handle to the engines group to use</param> /// <param name="strike">The strike at which to compute the volatility</param> /// <param name="baseDate">The base date.</param> /// <param name="targets">The target dates to compute the volatilities at</param> /// <returns></returns> public IList <decimal> BootstrapComputeVolatility(string engineHandle, decimal strike, DateTime baseDate, DateTime[] targets) { if (!_volCurveEngines.ContainsKey(engineHandle)) { throw new ArgumentException( $"The engine: {engineHandle} is not present. The volatility cannot be computed."); } //// Set up the parameters to use for this Computation var engines = _volCurveEngines[engineHandle]; if (engines == null) { return(null); } // Isolate the correct engine from the engine group - fixed strike case if (!engines.ContainsKey(strike)) { throw new ArgumentException($"The strike value: {strike} is not valid for this Bootstrapper."); } var result = new List <Decimal>(); var engine = engines[strike]; if (engine != null) { foreach (var date in targets) { var time = new DateTimePoint1D(baseDate, date); var value = (decimal)engine.GetValue(time.GetX()); result.Add(value); } return(result); } return(null); }
///<summary> ///</summary> ///<param name="valuationDate"></param> ///<param name="expirationAsDate"></param> ///<param name="strike"></param> ///<returns></returns> public double GetValueByExpiryDateAndStrike(DateTime valuationDate, DateTime expirationAsDate, double strike) { //IPoint time = new DateTimePoint1D(baseDate, expirationAsDate); //IPoint point = new Point2D(time.GetX(), strike); //return Interpolator.Value(point); var value = 0d; if (PricingStructureEvolutionType == PricingStructureEvolutionType.ForwardToSpot) { var time = new DateTimePoint1D(valuationDate, expirationAsDate); IPoint point = new Point2D(time.GetX(), strike); value = Value(point); return(value); } if (PricingStructureEvolutionType == PricingStructureEvolutionType.SpotToForward) { var time = new DateTimePoint1D(GetBaseDate(), expirationAsDate); IPoint point = new Point2D(time.GetX(), strike); value = Value(point); return(value); } return(value); }