@Override public ZeroRateSensitivity zeroRatePointSensitivity(double yearFraction, Currency sensitivityCurrency) { double discountFactor = discountFactor(yearFraction); return ZeroRateSensitivity.of(currency, yearFraction, sensitivityCurrency, -discountFactor * yearFraction); }
@Override public ZeroRateSensitivity zeroRatePointSensitivity(double yearFraction, Currency sensitivityCurrency) { double discountFactor = discountFactor(yearFraction); return ZeroRateSensitivity.of(currency, yearFraction, sensitivityCurrency, -discountFactor * yearFraction); }
@Override public ZeroRateSensitivity zeroRatePointSensitivity(double yearFraction, Currency sensitivityCurrency) { double discountFactor = discountFactor(yearFraction); return ZeroRateSensitivity.of(currency, yearFraction, sensitivityCurrency, -discountFactor * yearFraction); }
private DiscountFactors createDiscountFactors(DiscountFactors originalDsc, Curve bumpedCurve) { if (originalDsc instanceof ZeroRateDiscountFactors) { return ZeroRateDiscountFactors.of(originalDsc.getCurrency(), originalDsc.getValuationDate(), bumpedCurve); } else if (originalDsc instanceof SimpleDiscountFactors) { return SimpleDiscountFactors.of(originalDsc.getCurrency(), originalDsc.getValuationDate(), bumpedCurve); } throw new IllegalArgumentException("Not supported"); }
private Curve getCurve(DiscountFactors discountFactors) { if (discountFactors instanceof SimpleDiscountFactors) { return ((SimpleDiscountFactors) discountFactors).getCurve(); } if (discountFactors instanceof ZeroRateDiscountFactors) { return ((ZeroRateDiscountFactors) discountFactors).getCurve(); } if (discountFactors instanceof ZeroRatePeriodicDiscountFactors) { return ((ZeroRatePeriodicDiscountFactors) discountFactors).getCurve(); } throw new IllegalArgumentException("Unsupported DiscountFactors type"); }
public void test_zeroRatePointSensitivityWithSpread_sensitivityCurrency_smallYearFraction() { ZeroRateDiscountFactors test = ZeroRateDiscountFactors.of(GBP, DATE_VAL, CURVE); ZeroRateSensitivity expected = ZeroRateSensitivity.of(GBP, 0d, USD, -0d); assertEquals(test.zeroRatePointSensitivityWithSpread(DATE_VAL, USD, SPREAD, PERIODIC, 2), expected); }
private Curve checkDiscountFactors(DiscountFactors discountFactors) { if (discountFactors instanceof ZeroRateDiscountFactors) { return ((ZeroRateDiscountFactors) discountFactors).getCurve(); } else if (discountFactors instanceof SimpleDiscountFactors) { return ((SimpleDiscountFactors) discountFactors).getCurve(); } throw new IllegalArgumentException("Not supported"); }
@Override public Double apply(Double t) { return baseDiscountFactors.zeroRate(t); } };
/** * Obtains the underlying {@code ZeroRateSensitivity}. * <p> * This creates the zero rate sensitivity object by omitting the repo group. * * @return the point sensitivity object */ public ZeroRateSensitivity createZeroRateSensitivity() { return ZeroRateSensitivity.of(curveCurrency, yearFraction, currency, sensitivity); }
/** * Gets the valuation date. * <p> * The raw data in this provider is calibrated for this date. * * @return the valuation date */ public LocalDate getValuationDate() { return discountFactors.getValuationDate(); }
/** * Gets the currency of the curve for which the sensitivity is computed. * * @return the curve currency */ public Currency getCurveCurrency() { return zeroRateSensitivity.getCurveCurrency(); }
/** * Gets the time that was queried, expressed as a year fraction. * * @return the year fraction */ public double getYearFraction() { return zeroRateSensitivity.getYearFraction(); }
/** * Returns a new instance with a different curve. * * @param curve the new curve * @return the new instance */ public SimpleDiscountFactors withCurve(Curve curve) { return new SimpleDiscountFactors(currency, valuationDate, curve); }
/** * Returns a new instance with a different curve. * * @param curve the new curve * @return the new instance */ public ZeroRateDiscountFactors withCurve(Curve curve) { return new ZeroRateDiscountFactors(currency, valuationDate, curve); }
@Override public ZeroRateSensitivity build() { return new ZeroRateSensitivity( curveCurrency, yearFraction, currency, sensitivity); }
@Override public ZeroRatePeriodicDiscountFactors build() { return new ZeroRatePeriodicDiscountFactors( currency, valuationDate, curve); }
@Override public Double apply(Double t) { return counterDiscountFactors.zeroRate(t); } };
/** * Obtains the underlying {@code ZeroRateSensitivity}. * <p> * This creates the zero rate sensitivity object by omitting the legal entity group. * * @return the point sensitivity object */ public ZeroRateSensitivity createZeroRateSensitivity() { return ZeroRateSensitivity.of(curveCurrency, yearFraction, currency, sensitivity); }
/** * Gets the valuation date. * <p> * The raw data in this provider is calibrated for this date. * * @return the valuation date */ public LocalDate getValuationDate() { return discountFactors.getValuationDate(); }
@Override public SimpleDiscountFactors build() { return new SimpleDiscountFactors( currency, valuationDate, curve); }