public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 2100884654: // volatilitiesName this.volatilitiesName = (SwaptionVolatilitiesName)newValue; break; case -1289159373: // expiry this.expiry = (double?)newValue.Value; break; case 110246592: // tenor this.tenor = (double?)newValue.Value; break; case 1598929529: // sensitivityType this.sensitivityType = (SabrParameterType)newValue; break; case 575402001: // currency this.currency = (Currency)newValue; break; case 564403871: // sensitivity this.sensitivity = (double?)newValue.Value; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
private IborCapletFloorletSabrSensitivity(IborCapletFloorletVolatilitiesName volatilitiesName, double expiry, SabrParameterType sensitivityType, Currency currency, double sensitivity) { JodaBeanUtils.notNull(volatilitiesName, "volatilitiesName"); JodaBeanUtils.notNull(expiry, "expiry"); this.volatilitiesName = volatilitiesName; this.expiry = expiry; this.sensitivityType = sensitivityType; this.currency = currency; this.sensitivity = sensitivity; }
private SwaptionSabrSensitivity(SwaptionVolatilitiesName volatilitiesName, double expiry, double tenor, SabrParameterType sensitivityType, Currency currency, double sensitivity) { JodaBeanUtils.notNull(volatilitiesName, "volatilitiesName"); JodaBeanUtils.notNull(expiry, "expiry"); this.volatilitiesName = volatilitiesName; this.expiry = expiry; this.tenor = tenor; this.sensitivityType = sensitivityType; this.currency = currency; this.sensitivity = sensitivity; }
private void assertSensitivity(PointSensitivities points, SabrParameterType type, double expected, double tol) { foreach (PointSensitivity point in points.Sensitivities) { SwaptionSabrSensitivity sens = (SwaptionSabrSensitivity)point; assertEquals(sens.Currency, USD); assertEquals(sens.VolatilitiesName, VOLS.Name); assertEquals(sens.Tenor, (double)TENOR_YEAR); if (sens.SensitivityType == type) { assertEquals(sens.Sensitivity, expected, NOTIONAL * tol); return; } } fail("Did not find sensitivity: " + type + " in " + points); }
//------------------------------------------------------------------------- /// <summary> /// Obtains an instance from the specified elements. /// </summary> /// <param name="volatilitiesName"> the name of the volatilities </param> /// <param name="expiry"> the time to expiry of the option as a year fraction </param> /// <param name="tenor"> the underlying swap tenor </param> /// <param name="sensitivityType"> the type of the sensitivity </param> /// <param name="sensitivityCurrency"> the currency of the sensitivity </param> /// <param name="sensitivity"> the value of the sensitivity </param> /// <returns> the sensitivity object </returns> public static SwaptionSabrSensitivity of(SwaptionVolatilitiesName volatilitiesName, double expiry, double tenor, SabrParameterType sensitivityType, Currency sensitivityCurrency, double sensitivity) { return(new SwaptionSabrSensitivity(volatilitiesName, expiry, tenor, sensitivityType, sensitivityCurrency, sensitivity)); }
private void assertSensitivity(PointSensitivities points1, PointSensitivities points2, SabrParameterType type, int factor) { // use ordinal() as a hack to find correct type assertEquals(points1.Sensitivities.get(type.ordinal()).Sensitivity, points2.Sensitivities.get(type.ordinal()).Sensitivity *factor, NOTIONAL * TOL); }
//------------------------------------------------------------------------- /// <summary> /// Obtains an instance from the specified elements. /// </summary> /// <param name="volatilitiesName"> the name of the volatilities </param> /// <param name="expiry"> the time to expiry of the option as a year fraction </param> /// <param name="sensitivityType"> the type of the sensitivity </param> /// <param name="sensitivityCurrency"> the currency of the sensitivity </param> /// <param name="sensitivity"> the value of the sensitivity </param> /// <returns> the sensitivity object </returns> public static IborCapletFloorletSabrSensitivity of(IborCapletFloorletVolatilitiesName volatilitiesName, double expiry, SabrParameterType sensitivityType, Currency sensitivityCurrency, double sensitivity) { return(new IborCapletFloorletSabrSensitivity(volatilitiesName, expiry, sensitivityType, sensitivityCurrency, sensitivity)); }