private CurrencyParameterSensitivity parameterSensitivity(FxOptionSensitivity point) { double expiry = point.Expiry; UnitParameterSensitivity unitSens = curve.yValueParameterSensitivity(expiry); return(unitSens.multipliedBy(point.Currency, point.Sensitivity)); }
private CurrencyParameterSensitivity parameterSensitivity(IborFutureOptionSensitivity point) { double simpleMoneyness = moneynessOnPrice ? point.StrikePrice - point.FuturePrice : point.FuturePrice - point.StrikePrice; UnitParameterSensitivity unitSens = surface.zValueParameterSensitivity(point.Expiry, simpleMoneyness); return(unitSens.multipliedBy(point.Currency, point.Sensitivity)); }
private CurrencyParameterSensitivity parameterSensitivity(IborCapletFloorletSensitivity point) { double expiry = point.Expiry; double strike = point.Strike; UnitParameterSensitivity unitSens = surface.zValueParameterSensitivity(expiry, strike); return(unitSens.multipliedBy(point.Currency, point.Sensitivity)); }
private CurrencyParameterSensitivity parameterSensitivity(BondFutureOptionSensitivity pointSensitivity) { double logMoneyness = Math.Log(pointSensitivity.StrikePrice / pointSensitivity.FuturePrice); double expiryTime = pointSensitivity.Expiry; UnitParameterSensitivity unitSens = surface.zValueParameterSensitivity(expiryTime, logMoneyness); return(unitSens.multipliedBy(pointSensitivity.Currency, pointSensitivity.Sensitivity)); }
private CurrencyParameterSensitivity parameterSensitivity(SwaptionSensitivity point) { double expiry = point.Expiry; double tenor = point.Tenor; UnitParameterSensitivity unitSens = surface.zValueParameterSensitivity(expiry, tenor); return(unitSens.multipliedBy(point.Currency, point.Sensitivity)); }
public CurrencyParameterSensitivities parameterSensitivity(ZeroRateSensitivity pointSens) { double yearFraction = pointSens.YearFraction; UnitParameterSensitivity unitSens = curve.yValueParameterSensitivity(yearFraction); CurrencyParameterSensitivity curSens = unitSens.multipliedBy(pointSens.Currency, pointSens.Sensitivity); return(CurrencyParameterSensitivities.of(curSens)); }
private CurrencyParameterSensitivity parameterSensitivity(FxOptionSensitivity point) { double expiry = point.Expiry; double strike = point.CurrencyPair.isInverse(currencyPair) ? 1d / point.Strike : point.Strike; UnitParameterSensitivity unitSens = surface.zValueParameterSensitivity(expiry, strike); return(unitSens.multipliedBy(point.Currency, point.Sensitivity)); }
private CurrencyParameterSensitivity parameterSensitivity(SwaptionSensitivity point) { double expiry = point.Expiry; double moneyness = point.Strike - point.Forward; UnitParameterSensitivity unitSens = surface.zValueParameterSensitivity(expiry, moneyness); return(unitSens.multipliedBy(point.Currency, point.Sensitivity)); }
//------------------------------------------------------------------------- public CurrencyParameterSensitivities parameterSensitivity(IborRateSensitivity pointSensitivity) { LocalDate maturityDate = pointSensitivity.Observation.MaturityDate; double relativeYearFraction = this.relativeYearFraction(maturityDate); UnitParameterSensitivity unitSensitivity = curve.yValueParameterSensitivity(relativeYearFraction); CurrencyParameterSensitivity sensitivity = unitSensitivity.multipliedBy(pointSensitivity.Currency, pointSensitivity.Sensitivity); return(CurrencyParameterSensitivities.of(sensitivity)); }
//------------------------------------------------------------------------- public CurrencyParameterSensitivities parameterSensitivity(ZeroRateSensitivity pointSens) { double yearFraction = pointSens.YearFraction; double rp = curve.yValue(yearFraction); double rcBar = 1.0; double rpBar = 1.0 / (1 + rp / frequency) * rcBar; UnitParameterSensitivity unitSens = curve.yValueParameterSensitivity(yearFraction).multipliedBy(rpBar); CurrencyParameterSensitivity curSens = unitSens.multipliedBy(pointSens.Currency, pointSens.Sensitivity); return(CurrencyParameterSensitivities.of(curSens)); }
//------------------------------------------------------------------------- public CurrencyParameterSensitivities parameterSensitivity(ZeroRateSensitivity pointSens) { double yearFraction = pointSens.YearFraction; if (Math.Abs(yearFraction) < EFFECTIVE_ZERO) { return(CurrencyParameterSensitivities.empty()); // Discount factor in 0 is always 1, no sensitivity. } double discountFactor = this.discountFactor(yearFraction); UnitParameterSensitivity unitSens = curve.yValueParameterSensitivity(yearFraction); CurrencyParameterSensitivity curSens = unitSens.multipliedBy(-1d / (yearFraction * discountFactor)).multipliedBy(pointSens.Currency, pointSens.Sensitivity); return(CurrencyParameterSensitivities.of(curSens)); }
public UnitParameterSensitivity yValueParameterSensitivity(double x) { int i = seasonalityIndex(x); double adjustment = seasonality.get(i); double derivativeFactor = 0d; if (adjustmentType.Equals(ShiftType.ABSOLUTE)) { derivativeFactor = 1d; } else if (adjustmentType.Equals(ShiftType.SCALED)) { derivativeFactor = adjustment; } else { throw new System.ArgumentException("ShiftType " + adjustmentType + " is not supported for sensitivities"); } // remove the first point from the underlying sensitivity UnitParameterSensitivity u = underlying.yValueParameterSensitivity(x); UnitParameterSensitivity u2 = UnitParameterSensitivity.of(u.MarketDataName, u.ParameterMetadata.subList(1, u.ParameterMetadata.size()), u.Sensitivity.subArray(1)); return(u2.multipliedBy(derivativeFactor)); }