//------------------------------------------------------------------------- /// <summary> /// Calculates the price of the Ibor future product. /// <para> /// The price of the product is the price on the valuation date. /// /// </para> /// </summary> /// <param name="future"> the future </param> /// <param name="ratesProvider"> the rates provider </param> /// <returns> the price of the product, in decimal form </returns> public virtual double price(ResolvedIborFuture future, RatesProvider ratesProvider) { IborIndexRates rates = ratesProvider.iborIndexRates(future.Index); double forward = rates.rate(future.IborRate.Observation); return(1.0 - forward); }
public virtual void test_rateSensitivity() { RatesProvider mockProv = mock(typeof(RatesProvider)); IborIndexRates mockRates3M = mock(typeof(IborIndexRates)); IborIndexRates mockRates6M = mock(typeof(IborIndexRates)); when(mockProv.iborIndexRates(GBP_LIBOR_3M)).thenReturn(mockRates3M); when(mockProv.iborIndexRates(GBP_LIBOR_6M)).thenReturn(mockRates6M); when(mockRates3M.ratePointSensitivity(GBP_LIBOR_3M_OBS)).thenReturn(SENSITIVITY3); when(mockRates6M.ratePointSensitivity(GBP_LIBOR_6M_OBS)).thenReturn(SENSITIVITY6); IborInterpolatedRateComputation ro = IborInterpolatedRateComputation.of(GBP_LIBOR_3M, GBP_LIBOR_6M, FIXING_DATE, REF_DATA); ForwardIborInterpolatedRateComputationFn obsFn = ForwardIborInterpolatedRateComputationFn.DEFAULT; LocalDate fixingEndDate3M = GBP_LIBOR_3M_OBS.MaturityDate; LocalDate fixingEndDate6M = GBP_LIBOR_6M_OBS.MaturityDate; double days3M = fixingEndDate3M.toEpochDay() - FIXING_DATE.toEpochDay(); //nb days in 3M fixing period double days6M = fixingEndDate6M.toEpochDay() - FIXING_DATE.toEpochDay(); //nb days in 6M fixing period double daysCpn = ACCRUAL_END_DATE.toEpochDay() - FIXING_DATE.toEpochDay(); double weight3M = (days6M - daysCpn) / (days6M - days3M); double weight6M = (daysCpn - days3M) / (days6M - days3M); IborRateSensitivity sens3 = IborRateSensitivity.of(GBP_LIBOR_3M_OBS, weight3M); IborRateSensitivity sens6 = IborRateSensitivity.of(GBP_LIBOR_6M_OBS, weight6M); PointSensitivities expected = PointSensitivities.of(ImmutableList.of(sens3, sens6)); PointSensitivityBuilder test = obsFn.rateSensitivity(ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE, mockProv); assertEquals(test.build(), expected); }
public virtual void test_rateSensitivity_finiteDifference() { double eps = 1.0e-7; RatesProvider mockProv = mock(typeof(RatesProvider)); IborIndexRates mockRates3M = mock(typeof(IborIndexRates)); IborIndexRates mockRates6M = mock(typeof(IborIndexRates)); when(mockProv.iborIndexRates(GBP_LIBOR_3M)).thenReturn(mockRates3M); when(mockProv.iborIndexRates(GBP_LIBOR_6M)).thenReturn(mockRates6M); when(mockRates3M.rate(GBP_LIBOR_3M_OBS)).thenReturn(RATE3); when(mockRates6M.rate(GBP_LIBOR_6M_OBS)).thenReturn(RATE6); when(mockRates3M.ratePointSensitivity(GBP_LIBOR_3M_OBS)).thenReturn(SENSITIVITY3); when(mockRates6M.ratePointSensitivity(GBP_LIBOR_6M_OBS)).thenReturn(SENSITIVITY6); IborInterpolatedRateComputation ro = IborInterpolatedRateComputation.of(GBP_LIBOR_3M, GBP_LIBOR_6M, FIXING_DATE, REF_DATA); ForwardIborInterpolatedRateComputationFn obs = ForwardIborInterpolatedRateComputationFn.DEFAULT; PointSensitivityBuilder test = obs.rateSensitivity(ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE, mockProv); IborIndexRates mockRatesUp3M = mock(typeof(IborIndexRates)); when(mockRatesUp3M.rate(GBP_LIBOR_3M_OBS)).thenReturn(RATE3 + eps); IborIndexRates mockRatesDw3M = mock(typeof(IborIndexRates)); when(mockRatesDw3M.rate(GBP_LIBOR_3M_OBS)).thenReturn(RATE3 - eps); IborIndexRates mockRatesUp6M = mock(typeof(IborIndexRates)); when(mockRatesUp6M.rate(GBP_LIBOR_6M_OBS)).thenReturn(RATE6 + eps); IborIndexRates mockRatesDw6M = mock(typeof(IborIndexRates)); when(mockRatesDw6M.rate(GBP_LIBOR_6M_OBS)).thenReturn(RATE6 - eps); RatesProvider mockProvUp3M = mock(typeof(RatesProvider)); when(mockProvUp3M.iborIndexRates(GBP_LIBOR_3M)).thenReturn(mockRatesUp3M); when(mockProvUp3M.iborIndexRates(GBP_LIBOR_6M)).thenReturn(mockRates6M); RatesProvider mockProvDw3M = mock(typeof(RatesProvider)); when(mockProvDw3M.iborIndexRates(GBP_LIBOR_3M)).thenReturn(mockRatesDw3M); when(mockProvDw3M.iborIndexRates(GBP_LIBOR_6M)).thenReturn(mockRates6M); RatesProvider mockProvUp6M = mock(typeof(RatesProvider)); when(mockProvUp6M.iborIndexRates(GBP_LIBOR_3M)).thenReturn(mockRates3M); when(mockProvUp6M.iborIndexRates(GBP_LIBOR_6M)).thenReturn(mockRatesUp6M); RatesProvider mockProvDw6M = mock(typeof(RatesProvider)); when(mockProvDw6M.iborIndexRates(GBP_LIBOR_3M)).thenReturn(mockRates3M); when(mockProvDw6M.iborIndexRates(GBP_LIBOR_6M)).thenReturn(mockRatesDw6M); double rateUp3M = obs.rate(ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE, mockProvUp3M); double rateDw3M = obs.rate(ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE, mockProvDw3M); double senseExpected3M = 0.5 * (rateUp3M - rateDw3M) / eps; double rateUp6M = obs.rate(ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE, mockProvUp6M); double rateDw6M = obs.rate(ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE, mockProvDw6M); double senseExpected6M = 0.5 * (rateUp6M - rateDw6M) / eps; assertEquals(test.build().Sensitivities.get(0).Sensitivity, senseExpected3M, eps); assertEquals(test.build().Sensitivities.get(1).Sensitivity, senseExpected6M, eps); }
//------------------------------------------------------------------------- // query the forward rate private double forwardRate(ResolvedIborFixingDeposit product, RatesProvider provider) { IborIndexRates rates = provider.iborIndexRates(product.FloatingRate.Index); // 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.FloatingRate.Observation)); }
public virtual PointSensitivityBuilder rateSensitivity(IborAveragedRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider) { IborIndexRates rates = provider.iborIndexRates(computation.Index); // combine the weighted sensitivity to each fixing // omit fixed rates as they have no sensitivity to a curve return(computation.Fixings.Where(fixing => !fixing.FixedRate.Present).Select(fixing => weightedSensitivity(fixing, computation.TotalWeight, rates)).Aggregate(PointSensitivityBuilder.none(), PointSensitivityBuilder.combinedWith)); }
//------------------------------------------------------------------------- public virtual double rate(IborAveragedRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider) { IborIndexRates rates = provider.iborIndexRates(computation.Index); // take (rate * weight) for each fixing and divide by total weight double weightedRate = computation.Fixings.Select(fixing => this.weightedRate(fixing, rates)).Sum(); return(weightedRate / computation.TotalWeight); }
public virtual double explainRate(IborRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider, ExplainMapBuilder builder) { IborIndexRates rates = provider.iborIndexRates(computation.Index); double rate = rates.explainRate(computation.Observation, builder, child => { }); builder.put(ExplainKey.COMBINED_RATE, rate); return(rate); }
//------------------------------------------------------------------------- public virtual void test_price() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.IborRates = mockIbor; when(mockIbor.rate(FUTURE.IborRate.Observation)).thenReturn(RATE); assertEquals(PRICER_TRADE.price(FUTURE_TRADE, prov), 1.0 - RATE, TOLERANCE_PRICE); }
//------------------------------------------------------------------------- public virtual void test_parSpreadSensitivity() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.IborRates = mockIbor; PointSensitivities sensiExpected = PRICER_PRODUCT.priceSensitivity(FUTURE, prov); PointSensitivities sensiComputed = PRICER_TRADE.parSpreadSensitivity(FUTURE_TRADE, prov); assertTrue(sensiComputed.equalWithTolerance(sensiExpected, TOLERANCE_PRICE_DELTA)); }
//------------------------------------------------------------------------- public virtual void test_priceSensitivity() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.IborRates = mockIbor; PointSensitivities sensiExpected = PointSensitivities.of(IborRateSensitivity.of(FUTURE.IborRate.Observation, -1d)); PointSensitivities sensiComputed = PRICER.priceSensitivity(FUTURE, prov); assertTrue(sensiComputed.equalWithTolerance(sensiExpected, TOLERANCE_PRICE_DELTA)); }
public virtual double explainRate(IborAveragedRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider, ExplainMapBuilder builder) { IborIndexRates rates = provider.iborIndexRates(computation.Index); foreach (IborAveragedFixing fixing in computation.Fixings) { rates.explainRate(fixing.Observation, builder, child => child.put(ExplainKey.WEIGHT, fixing.Weight)); } double rate = this.rate(computation, startDate, endDate, provider); builder.put(ExplainKey.COMBINED_RATE, rate); return(rate); }
//------------------------------------------------------------------------- public virtual double rate(IborInterpolatedRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider) { IborIndexObservation obs1 = computation.ShortObservation; IborIndexObservation obs2 = computation.LongObservation; IborIndexRates rates1 = provider.iborIndexRates(obs1.Index); IborIndexRates rates2 = provider.iborIndexRates(obs2.Index); double rate1 = rates1.rate(obs1); double rate2 = rates2.rate(obs2); DoublesPair weights = this.weights(obs1, obs2, endDate); return(((rate1 * weights.First) + (rate2 * weights.Second)) / (weights.First + weights.Second)); }
//------------------------------------------------------------------------- public virtual void test_presentValueSensitivity() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.IborRates = mockIbor; PointSensitivities sensiPrice = PRICER_PRODUCT.priceSensitivity(FUTURE, prov); PointSensitivities sensiPresentValueExpected = sensiPrice.multipliedBy(FUTURE.Notional * FUTURE.AccrualFactor * FUTURE_TRADE.Quantity); PointSensitivities sensiPresentValueComputed = PRICER_TRADE.presentValueSensitivity(FUTURE_TRADE, prov); assertTrue(sensiPresentValueComputed.equalWithTolerance(sensiPresentValueExpected, TOLERANCE_PV_DELTA)); }
public virtual void test_rateSensitivity() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.IborRates = mockIbor; when(mockIbor.ratePointSensitivity(GBP_LIBOR_3M_COMP.Observation)).thenReturn(SENSITIVITY); ForwardIborRateComputationFn obsFn = ForwardIborRateComputationFn.DEFAULT; assertEquals(obsFn.rateSensitivity(GBP_LIBOR_3M_COMP, ACCRUAL_START_DATE, ACCRUAL_END_DATE, prov), SENSITIVITY); }
//------------------------------------------------------------------------- public virtual void test_parSpread_after_trade_date() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.IborRates = mockIbor; prov.ValuationDate = FUTURE_TRADE.TradedPrice.get().TradeDate.plusDays(1); when(mockIbor.rate(FUTURE.IborRate.Observation)).thenReturn(RATE); double lastClosingPrice = 0.99; double parSpreadExpected = PRICER_TRADE.price(FUTURE_TRADE, prov) - lastClosingPrice; double parSpreadComputed = PRICER_TRADE.parSpread(FUTURE_TRADE, prov, lastClosingPrice); assertEquals(parSpreadComputed, parSpreadExpected, TOLERANCE_PRICE); }
static DiscountingFraTradePricerTest() { DiscountFactors mockDf = mock(typeof(DiscountFactors)); IborIndexRates mockIbor = mock(typeof(IborIndexRates)); RATES_PROVIDER = new SimpleRatesProvider(VAL_DATE, mockDf); RATES_PROVIDER.IborRates = mockIbor; IborIndexObservation obs = ((IborRateComputation)RFRA.FloatingRate).Observation; IborRateSensitivity sens = IborRateSensitivity.of(obs, 1d); when(mockIbor.ratePointSensitivity(obs)).thenReturn(sens); when(mockIbor.rate(obs)).thenReturn(FORWARD_RATE); when(mockDf.discountFactor(RFRA.PaymentDate)).thenReturn(DISCOUNT_FACTOR); }
public virtual void price_from_env() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.IborRates = mockIbor; when(mockIbor.rate(OPTION.UnderlyingFuture.IborRate.Observation)).thenReturn(RATE); double futurePrice = 1.0 - RATE; double optionPriceExpected = OPTION_PRICER.price(OPTION, prov, VOL_SIMPLE_MONEY_PRICE, futurePrice); double optionPriceComputed = OPTION_PRICER.price(OPTION, prov, VOL_SIMPLE_MONEY_PRICE); assertEquals(optionPriceComputed, optionPriceExpected, TOLERANCE_PRICE); }
// ---------- present value sensitivity ---------- public virtual void presentValueSensitivity_from_env() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.IborRates = mockIbor; when(mockIbor.rate(OPTION.UnderlyingFuture.IborRate.Observation)).thenReturn(RATE); PointSensitivities psProduct = OPTION_PRODUCT_PRICER.priceSensitivityRatesStickyStrike(OPTION, prov, VOL_SIMPLE_MONEY_PRICE); PointSensitivities psExpected = psProduct.multipliedBy(OPTION_PRODUCT_PRICER.marginIndex(OPTION, 1) * OPTION_QUANTITY); PointSensitivities psComputed = OPTION_TRADE_PRICER.presentValueSensitivityRates(FUTURE_OPTION_TRADE, prov, VOL_SIMPLE_MONEY_PRICE); assertTrue(psComputed.equalWithTolerance(psExpected, TOLERANCE_PV_DELTA)); }
public virtual void priceSensitivityNormalVolatility_from_env() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.IborRates = mockIbor; when(mockIbor.rate(OPTION.UnderlyingFuture.IborRate.Observation)).thenReturn(RATE); double futurePrice = 1.0 - RATE; IborFutureOptionSensitivity optionVegaExpected = OPTION_PRICER.priceSensitivityModelParamsVolatility(OPTION, prov, VOL_SIMPLE_MONEY_PRICE, futurePrice); IborFutureOptionSensitivity optionVegaComputed = OPTION_PRICER.priceSensitivityModelParamsVolatility(OPTION, prov, VOL_SIMPLE_MONEY_PRICE); assertTrue(optionVegaExpected.compareKey(optionVegaComputed) == 0); assertEquals(optionVegaComputed.Sensitivity, optionVegaExpected.Sensitivity, TOLERANCE_PRICE_DELTA); }
public virtual void presentValue_from_env() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(VAL_DATE); prov.IborRates = mockIbor; when(mockIbor.rate(OPTION.UnderlyingFuture.IborRate.Observation)).thenReturn(RATE); double lastClosingPrice = 0.0150; CurrencyAmount pvComputed = OPTION_TRADE_PRICER.presentValue(FUTURE_OPTION_TRADE, prov, VOL_SIMPLE_MONEY_PRICE, lastClosingPrice); double optionPrice = OPTION_PRODUCT_PRICER.price(OPTION, prov, VOL_SIMPLE_MONEY_PRICE); double pvExpected = (OPTION_PRODUCT_PRICER.marginIndex(OPTION, optionPrice) - OPTION_PRODUCT_PRICER.marginIndex(OPTION, lastClosingPrice)) * OPTION_QUANTITY; assertEquals(pvComputed.Amount, pvExpected, TOLERANCE_PV); }
public virtual void priceSensitivityStickyStrike_from_env() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.IborRates = mockIbor; when(mockIbor.rate(OPTION.UnderlyingFuture.IborRate.Observation)).thenReturn(RATE); PointSensitivities futurePriceSensitivity = OPTION_PRICER.FuturePricer.priceSensitivity(OPTION.UnderlyingFuture, prov); double delta = OPTION_PRICER.deltaStickyStrike(OPTION, prov, VOL_SIMPLE_MONEY_PRICE); PointSensitivities optionPriceSensitivityExpected = futurePriceSensitivity.multipliedBy(delta); PointSensitivities optionPriceSensitivityComputed = OPTION_PRICER.priceSensitivityRatesStickyStrike(OPTION, prov, VOL_SIMPLE_MONEY_PRICE); assertTrue(optionPriceSensitivityExpected.equalWithTolerance(optionPriceSensitivityComputed, TOLERANCE_PRICE_DELTA)); }
// ---------- present value normal vol sensitivity ---------- public virtual void presentvalue_normalVolSensitivity_from_env() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.IborRates = mockIbor; when(mockIbor.rate(OPTION.UnderlyingFuture.IborRate.Observation)).thenReturn(RATE); IborFutureOptionSensitivity psProduct = OPTION_PRODUCT_PRICER.priceSensitivityModelParamsVolatility(OPTION, prov, VOL_SIMPLE_MONEY_PRICE); IborFutureOptionSensitivity psExpected = psProduct.withSensitivity(psProduct.Sensitivity * OPTION_PRODUCT_PRICER.marginIndex(OPTION, 1) * OPTION_QUANTITY); IborFutureOptionSensitivity psComputed = OPTION_TRADE_PRICER.presentValueSensitivityModelParamsVolatility(FUTURE_OPTION_TRADE, prov, VOL_SIMPLE_MONEY_PRICE); assertTrue(psExpected.compareKey(psComputed) == 0); assertEquals(psComputed.Sensitivity, psExpected.Sensitivity, TOLERANCE_PV_DELTA); }
public virtual double explainRate(IborInterpolatedRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider, ExplainMapBuilder builder) { IborIndexObservation obs1 = computation.ShortObservation; IborIndexObservation obs2 = computation.LongObservation; DoublesPair weights = this.weights(obs1, obs2, endDate); IborIndexRates rates1 = provider.iborIndexRates(obs1.Index); IborIndexRates rates2 = provider.iborIndexRates(obs2.Index); rates1.explainRate(obs1, builder, child => child.put(ExplainKey.WEIGHT, weights.First)); rates2.explainRate(obs2, builder, child => child.put(ExplainKey.WEIGHT, weights.Second)); double rate = this.rate(computation, startDate, endDate, provider); builder.put(ExplainKey.COMBINED_RATE, rate); return(rate); }
public virtual PointSensitivityBuilder rateSensitivity(IborInterpolatedRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider) { // computes the dates related to the underlying deposits associated to the indices IborIndexObservation obs1 = computation.ShortObservation; IborIndexObservation obs2 = computation.LongObservation; DoublesPair weights = this.weights(obs1, obs2, endDate); double totalWeight = weights.First + weights.Second; IborIndexRates ratesIndex1 = provider.iborIndexRates(obs1.Index); PointSensitivityBuilder sens1 = ratesIndex1.ratePointSensitivity(obs1).multipliedBy(weights.First / totalWeight); IborIndexRates ratesIndex2 = provider.iborIndexRates(obs2.Index); PointSensitivityBuilder sens2 = ratesIndex2.ratePointSensitivity(obs2).multipliedBy(weights.Second / totalWeight); return(sens1.combinedWith(sens2)); }
public virtual void test_presentValue_on_trade_date() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.IborRates = mockIbor; prov.ValuationDate = FUTURE_TRADE.TradedPrice.get().TradeDate; when(mockIbor.rate(FUTURE.IborRate.Observation)).thenReturn(RATE); double lastClosingPrice = 1.025; DiscountingIborFutureTradePricer pricerFn = DiscountingIborFutureTradePricer.DEFAULT; double expected = ((1.0 - RATE) - FUTURE_TRADE.TradedPrice.get().Price) * FUTURE.AccrualFactor * FUTURE.Notional * FUTURE_TRADE.Quantity; CurrencyAmount computed = pricerFn.presentValue(FUTURE_TRADE, prov, lastClosingPrice); assertEquals(computed.Amount, expected, TOLERANCE_PV); assertEquals(computed.Currency, FUTURE.Currency); }
// ---------- price ---------- public virtual void price_from_future_price() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.IborRates = mockIbor; when(mockIbor.rate(OPTION.UnderlyingFuture.IborRate.Observation)).thenReturn(RATE); double futurePrice = 0.9875; double strike = OPTION.StrikePrice; double timeToExpiry = ACT_365F.relativeYearFraction(VAL_DATE, OPTION.ExpiryDate); double priceSimpleMoneyness = strike - futurePrice; double normalVol = PARAMETERS_PRICE.zValue(timeToExpiry, priceSimpleMoneyness); EuropeanVanillaOption option = EuropeanVanillaOption.of(strike, timeToExpiry, OPTION.PutCall); NormalFunctionData normalPoint = NormalFunctionData.of(futurePrice, 1.0, normalVol); double optionPriceExpected = NORMAL_FUNCTION.getPriceFunction(option).apply(normalPoint); double optionPriceComputed = OPTION_PRICER.price(OPTION, prov, VOL_SIMPLE_MONEY_PRICE, futurePrice); assertEquals(optionPriceComputed, optionPriceExpected, TOLERANCE_PRICE); }
// query the forward rate sensitivity private PointSensitivityBuilder forwardRateSensitivity(ResolvedIborFixingDeposit product, RatesProvider provider) { IborIndexRates rates = provider.iborIndexRates(product.FloatingRate.Index); return(rates.rateIgnoringFixingsPointSensitivity(product.FloatingRate.Observation)); }
// Compute the weighted sensitivity for one IborAverageFixing. private PointSensitivityBuilder weightedSensitivity(IborAveragedFixing fixing, double totalWeight, IborIndexRates rates) { return(rates.ratePointSensitivity(fixing.Observation).multipliedBy(fixing.Weight / totalWeight)); }
public virtual PointSensitivityBuilder rateSensitivity(IborRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider) { IborIndexRates rates = provider.iborIndexRates(computation.Index); return(rates.ratePointSensitivity(computation.Observation)); }
//------------------------------------------------------------------------- public virtual double rate(IborRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider) { IborIndexRates rates = provider.iborIndexRates(computation.Index); return(rates.rate(computation.Observation)); }