/** * Gets the Ibor index that the future is based on. * * @return the Ibor index */ public IborIndex getIndex() { return iborRate.getIndex(); }
/** * Gets the Ibor index. * * @return the ibor index */ public IborIndex getIndex() { return iborRate.getIndex(); }
@Override public void collectIndices(ImmutableSet.Builder<Index> builder) { builder.add(getIndex()); }
/** * Gets the currency of the Ibor index. * * @return the currency of the index */ public Currency getCurrency() { return getIndex().getCurrency(); }
/** * Gets the fixing date-time of the index. * * @return the fixing date-time */ public ZonedDateTime getFixingDateTime() { return iborRate.getIndex().calculateFixingDateTime(iborRate.getFixingDate()); }
@ImmutablePreBuild private static void preBuild(Builder builder) { if (builder.iborRate != null) { if (builder.accrualFactor == 0d && builder.iborRate.getIndex().getTenor().isMonthBased()) { builder.accrualFactor(builder.iborRate.getIndex().getTenor().getPeriod().toTotalMonths() / 12d); } if (builder.currency == null) { builder.currency = builder.iborRate.getIndex().getCurrency(); } } }
@Override public double rate( IborRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider) { IborIndexRates rates = provider.iborIndexRates(computation.getIndex()); return rates.rate(computation.getObservation()); }
@Override public PointSensitivityBuilder rateSensitivity( IborRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider) { IborIndexRates rates = provider.iborIndexRates(computation.getIndex()); return rates.ratePointSensitivity(computation.getObservation()); }
@Override public double explainRate( IborRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider, ExplainMapBuilder builder) { IborIndexRates rates = provider.iborIndexRates(computation.getIndex()); double rate = rates.explainRate(computation.getObservation(), builder, child -> {}); builder.put(ExplainKey.COMBINED_RATE, rate); return rate; }
private double forwardRate(ResolvedIborFixingDeposit product, RatesProvider provider) { IborIndexRates rates = provider.iborIndexRates(product.getFloatingRate().getIndex()); // The IborFixingDeposit are fictitious instruments to anchor the beginning of the IborIndex forward curve. // By using the 'rateIgnoringTimeSeries' method (instead of 'rate') we ensure that only the forward curve is involved. return rates.rateIgnoringFixings(product.getFloatingRate().getObservation()); }
private PointSensitivityBuilder forwardRateSensitivity(ResolvedIborFixingDeposit product, RatesProvider provider) { IborIndexRates rates = provider.iborIndexRates(product.getFloatingRate().getIndex()); return rates.rateIgnoringFixingsPointSensitivity(product.getFloatingRate().getObservation()); }
@ImmutablePreBuild private static void preBuild(Builder builder) { if (builder.iborRate != null) { IborIndex index = builder.iborRate.getIndex(); if (builder.currency == null) { builder.currency = index.getCurrency(); } } if (builder.paymentDate == null) { builder.paymentDate = builder.endDate; } if (builder.unadjustedStartDate == null) { builder.unadjustedStartDate = builder.startDate; } if (builder.unadjustedEndDate == null) { builder.unadjustedEndDate = builder.endDate; } ArgChecker.isFalse(builder.caplet != null && builder.floorlet != null, "Only caplet or floorlet must be set, not both"); ArgChecker.isFalse(builder.caplet == null && builder.floorlet == null, "Either caplet or floorlet must be set"); }
public void test_of() { IborRateComputation test = IborRateComputation.of(USD_LIBOR_3M, date(2016, 2, 18), REF_DATA); IborIndexObservation obs = IborIndexObservation.of(USD_LIBOR_3M, date(2016, 2, 18), REF_DATA); IborRateComputation expected = IborRateComputation.of(obs); assertEquals(test, expected); assertEquals(test.getCurrency(), USD); assertEquals(test.getIndex(), obs.getIndex()); assertEquals(test.getFixingDate(), obs.getFixingDate()); assertEquals(test.getEffectiveDate(), obs.getEffectiveDate()); assertEquals(test.getMaturityDate(), obs.getMaturityDate()); assertEquals(test.getYearFraction(), obs.getYearFraction()); }
ExplainMap explainObs = explain.get(ExplainKey.OBSERVATIONS).get().get(0); IborRateComputation floatingRate = (IborRateComputation) fraExp.getFloatingRate(); assertEquals(explainObs.get(ExplainKey.INDEX).get(), floatingRate.getIndex()); assertEquals(explainObs.get(ExplainKey.FIXING_DATE).get(), floatingRate.getFixingDate()); assertEquals(explainObs.get(ExplainKey.INDEX_VALUE).get(), FORWARD_RATE, TOLERANCE);
if (i == j) { fixingDate = observation.getFixingDate(); index = observation.getIndex(); when(obsFuncUp.rate(observation, period.getStartDate(), period.getEndDate(), provNew)).thenReturn(rate + eps); when(obsFuncDown.rate(observation, period.getStartDate(), period.getEndDate(), provNew))