/// <summary> /// Creates a {@code IborAveragedFixing} from the fixing date, calculating the weight /// from the number of days in the reset period. /// <para> /// This implements the standard approach to average weights, which is to set each /// weight to the actual number of days between the start and end of the reset period. /// /// </para> /// </summary> /// <param name="observation"> the Ibor observation </param> /// <param name="startDate"> the start date of the reset period </param> /// <param name="endDate"> the end date of the reset period </param> /// <param name="fixedRate"> the fixed rate for the fixing date, optional, may be null </param> /// <returns> the weighted fixing information </returns> public static IborAveragedFixing ofDaysInResetPeriod(IborIndexObservation observation, LocalDate startDate, LocalDate endDate, double?fixedRate) { ArgChecker.notNull(observation, "observation"); ArgChecker.notNull(startDate, "startDate"); ArgChecker.notNull(endDate, "endDate"); return(IborAveragedFixing.builder().observation(observation).fixedRate(fixedRate).weight(endDate.toEpochDay() - startDate.toEpochDay()).build()); }
private IborAveragedFixing(IborIndexObservation observation, double?fixedRate, double weight) { JodaBeanUtils.notNull(observation, "observation"); this.observation = observation; this.fixedRate = fixedRate; this.weight = weight; }
/// <summary> /// Test present value sensitivity for AFMA FRA discounting method. /// </summary> public virtual void test_presentValueSensitivity_AFMA() { RateComputationFn<RateComputation> mockObs = mock(typeof(RateComputationFn)); DiscountFactors mockDf = mock(typeof(DiscountFactors)); SimpleRatesProvider simpleProv = new SimpleRatesProvider(VAL_DATE, mockDf); ResolvedFra fraExp = RFRA_AFMA; double forwardRate = 0.05; double discountRate = 0.025; double paymentTime = 0.3; double discountFactor = Math.Exp(-discountRate * paymentTime); LocalDate fixingDate = FRA_AFMA.StartDate; IborIndexObservation obs = IborIndexObservation.of(FRA.Index, fixingDate, REF_DATA); PointSensitivityBuilder sens = IborRateSensitivity.of(obs, 1d); when(mockDf.discountFactor(fraExp.PaymentDate)).thenReturn(discountFactor); when(mockDf.zeroRatePointSensitivity(fraExp.PaymentDate)).thenReturn(ZeroRateSensitivity.of(fraExp.Currency, paymentTime, -discountFactor * paymentTime)); when(mockObs.rateSensitivity(fraExp.FloatingRate, fraExp.StartDate, fraExp.EndDate, simpleProv)).thenReturn(sens); when(mockObs.rate(fraExp.FloatingRate, FRA_AFMA.StartDate, FRA_AFMA.EndDate, simpleProv)).thenReturn(forwardRate); DiscountingFraProductPricer test = new DiscountingFraProductPricer(mockObs); PointSensitivities sensitivity = test.presentValueSensitivity(fraExp, simpleProv); double eps = 1.e-7; double fdDscSense = dscSensitivity(RFRA_AFMA, forwardRate, discountFactor, paymentTime, eps); double fdSense = presentValueFwdSensitivity(RFRA_AFMA, forwardRate, discountFactor, eps); ImmutableList<PointSensitivity> sensitivities = sensitivity.Sensitivities; assertEquals(sensitivities.size(), 2); IborRateSensitivity sensitivity0 = (IborRateSensitivity) sensitivities.get(0); assertEquals(sensitivity0.Index, FRA_AFMA.Index); assertEquals(sensitivity0.Observation.FixingDate, fixingDate); assertEquals(sensitivity0.Sensitivity, fdSense, FRA_AFMA.Notional * eps); ZeroRateSensitivity sensitivity1 = (ZeroRateSensitivity) sensitivities.get(1); assertEquals(sensitivity1.Currency, FRA_AFMA.Currency); assertEquals(sensitivity1.YearFraction, paymentTime); assertEquals(sensitivity1.Sensitivity, fdDscSense, FRA_AFMA.Notional * eps); }
/// <summary> /// Computes cash flow equivalent of Ibor leg. /// <para> /// The return type is {@code ResolvedSwapLeg} in which individual payments are /// represented in terms of {@code NotionalExchange}. /// /// </para> /// </summary> /// <param name="iborLeg"> the Ibor leg </param> /// <param name="ratesProvider"> the rates provider </param> /// <returns> the cash flow equivalent </returns> public static ResolvedSwapLeg cashFlowEquivalentIborLeg(ResolvedSwapLeg iborLeg, RatesProvider ratesProvider) { ArgChecker.isTrue(iborLeg.Type.Equals(SwapLegType.IBOR), "Leg type should be IBOR"); ArgChecker.isTrue(iborLeg.PaymentEvents.Empty, "PaymentEvent should be empty"); IList <NotionalExchange> paymentEvents = new List <NotionalExchange>(); foreach (SwapPaymentPeriod paymentPeriod in iborLeg.PaymentPeriods) { ArgChecker.isTrue(paymentPeriod is RatePaymentPeriod, "rate payment should be RatePaymentPeriod"); RatePaymentPeriod ratePaymentPeriod = (RatePaymentPeriod)paymentPeriod; ArgChecker.isTrue(ratePaymentPeriod.AccrualPeriods.size() == 1, "rate payment should not be compounding"); RateAccrualPeriod rateAccrualPeriod = ratePaymentPeriod.AccrualPeriods.get(0); CurrencyAmount notional = ratePaymentPeriod.NotionalAmount; LocalDate paymentDate = ratePaymentPeriod.PaymentDate; IborIndexObservation obs = ((IborRateComputation)rateAccrualPeriod.RateComputation).Observation; IborIndex index = obs.Index; LocalDate fixingStartDate = obs.EffectiveDate; double fixingYearFraction = obs.YearFraction; double beta = (1d + fixingYearFraction * ratesProvider.iborIndexRates(index).rate(obs)) * ratesProvider.discountFactor(paymentPeriod.Currency, paymentPeriod.PaymentDate) / ratesProvider.discountFactor(paymentPeriod.Currency, fixingStartDate); double ycRatio = rateAccrualPeriod.YearFraction / fixingYearFraction; NotionalExchange payStart = NotionalExchange.of(notional.multipliedBy(beta * ycRatio), fixingStartDate); NotionalExchange payEnd = NotionalExchange.of(notional.multipliedBy(-ycRatio), paymentDate); paymentEvents.Add(payStart); paymentEvents.Add(payEnd); } ResolvedSwapLeg leg = ResolvedSwapLeg.builder().paymentEvents(paymentEvents).payReceive(PayReceive.RECEIVE).type(SwapLegType.OTHER).build(); return(leg); }
public virtual void test_rateSensitivity() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.IborRates = mockIbor; IList <IborAveragedFixing> fixings = new List <IborAveragedFixing>(); double totalWeight = 0.0d; for (int i = 0; i < OBSERVATIONS.Length; i++) { IborIndexObservation obs = OBSERVATIONS[i]; IborAveragedFixing fixing = IborAveragedFixing.builder().observation(obs).weight(WEIGHTS[i]).build(); fixings.Add(fixing); totalWeight += WEIGHTS[i]; when(mockIbor.ratePointSensitivity(obs)).thenReturn(SENSITIVITIES[i]); } PointSensitivities expected = PointSensitivities.of(ImmutableList.of(IborRateSensitivity.of(OBSERVATIONS[0], WEIGHTS[0] / totalWeight), IborRateSensitivity.of(OBSERVATIONS[1], WEIGHTS[1] / totalWeight), IborRateSensitivity.of(OBSERVATIONS[2], WEIGHTS[2] / totalWeight), IborRateSensitivity.of(OBSERVATIONS[3], WEIGHTS[3] / totalWeight))); IborAveragedRateComputation ro = IborAveragedRateComputation.of(fixings); ForwardIborAveragedRateComputationFn obsFn = ForwardIborAveragedRateComputationFn.DEFAULT; PointSensitivityBuilder test = obsFn.rateSensitivity(ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE, prov); assertEquals(test.build(), expected); }
private IborInterpolatedRateComputation(IborIndexObservation shortObservation, IborIndexObservation longObservation) { JodaBeanUtils.notNull(shortObservation, "shortObservation"); JodaBeanUtils.notNull(longObservation, "longObservation"); this.shortObservation = shortObservation; this.longObservation = longObservation; validate(); }
//------------------------------------------------------------------------- /// <summary> /// Creates an instance from two indices and fixing date. /// <para> /// The indices may be passed in any order. /// /// </para> /// </summary> /// <param name="index1"> the first index </param> /// <param name="index2"> the second index </param> /// <param name="fixingDate"> the fixing date </param> /// <param name="refData"> the reference data to use when resolving holiday calendars </param> /// <returns> the interpolated rate computation </returns> public static IborInterpolatedRateComputation of(IborIndex index1, IborIndex index2, LocalDate fixingDate, ReferenceData refData) { bool inOrder = indicesInOrder(index1, index2, fixingDate); IborIndexObservation obs1 = IborIndexObservation.of(index1, fixingDate, refData); IborIndexObservation obs2 = IborIndexObservation.of(index2, fixingDate, refData); return(new IborInterpolatedRateComputation(inOrder ? obs1 : obs2, inOrder ? obs2 : obs1)); }
private IborRateSensitivity(IborIndexObservation observation, Currency currency, double sensitivity) { JodaBeanUtils.notNull(observation, "observation"); JodaBeanUtils.notNull(currency, "currency"); this.observation = observation; this.currency = currency; this.sensitivity = sensitivity; }
//------------------------------------------------------------------------- public double rate(IborIndexObservation observation) { if (!observation.FixingDate.isAfter(ValuationDate)) { return(historicRate(observation)); } return(rateIgnoringFixings(observation)); }
//------------------------------------------------------------------------- public PointSensitivityBuilder ratePointSensitivity(IborIndexObservation observation) { LocalDate fixingDate = observation.FixingDate; LocalDate valuationDate = ValuationDate; if (fixingDate.isBefore(valuationDate) || (fixingDate.Equals(valuationDate) && fixings.get(fixingDate).HasValue)) { return(PointSensitivityBuilder.none()); } return(IborRateSensitivity.of(observation, 1d)); }
public double rateIgnoringFixings(IborIndexObservation observation) { LocalDate fixingStartDate = observation.EffectiveDate; LocalDate fixingEndDate = observation.MaturityDate; double accrualFactor = observation.YearFraction; // simply compounded forward rate from discount factors double dfStart = discountFactors.discountFactor(fixingStartDate); double dfEnd = discountFactors.discountFactor(fixingEndDate); return((dfStart / dfEnd - 1) / accrualFactor); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 122345516: // observation this.observation = (IborIndexObservation)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public virtual void test_rateSensitivity_finiteDifference() { IborIndexRates mockIbor = mock(typeof(IborIndexRates)); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.IborRates = mockIbor; double eps = 1.0e-7; int nDates = OBSERVATIONS.Length; IList <IborAveragedFixing> fixings = new List <IborAveragedFixing>(); for (int i = 0; i < nDates; i++) { IborIndexObservation obs = OBSERVATIONS[i]; IborAveragedFixing fixing = IborAveragedFixing.builder().observation(obs).weight(WEIGHTS[i]).build(); fixings.Add(fixing); when(mockIbor.ratePointSensitivity(obs)).thenReturn(SENSITIVITIES[i]); } IborAveragedRateComputation ro = IborAveragedRateComputation.of(fixings); ForwardIborAveragedRateComputationFn obsFn = ForwardIborAveragedRateComputationFn.DEFAULT; PointSensitivityBuilder test = obsFn.rateSensitivity(ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE, prov); for (int i = 0; i < nDates; ++i) { IborIndexRates mockIborUp = mock(typeof(IborIndexRates)); SimpleRatesProvider provUp = new SimpleRatesProvider(); provUp.IborRates = mockIborUp; IborIndexRates mockIborDw = mock(typeof(IborIndexRates)); SimpleRatesProvider provDw = new SimpleRatesProvider(); provDw.IborRates = mockIborDw; for (int j = 0; j < nDates; ++j) { if (i == j) { when(mockIborUp.rate(OBSERVATIONS[j])).thenReturn(FIXING_VALUES[j] + eps); when(mockIborDw.rate(OBSERVATIONS[j])).thenReturn(FIXING_VALUES[j] - eps); } else { when(mockIborUp.rate(OBSERVATIONS[j])).thenReturn(FIXING_VALUES[j]); when(mockIborDw.rate(OBSERVATIONS[j])).thenReturn(FIXING_VALUES[j]); } } double rateUp = obsFn.rate(ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE, provUp); double rateDw = obsFn.rate(ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE, provDw); double resExpected = 0.5 * (rateUp - rateDw) / eps; assertEquals(test.build().Sensitivities.get(i).Sensitivity, resExpected, eps); } }
public virtual void test_rate() { LocalDate fixingDate = OBSERVATIONS[0].FixingDate; LocalDateDoubleTimeSeries timeSeries = LocalDateDoubleTimeSeries.of(fixingDate, FIXING_VALUES[0]); LocalDateDoubleTimeSeries rates = LocalDateDoubleTimeSeries.builder().put(OBSERVATIONS[1].FixingDate, FIXING_VALUES[1]).put(OBSERVATIONS[2].FixingDate, FIXING_VALUES[2]).put(OBSERVATIONS[3].FixingDate, FIXING_VALUES[3]).build(); IborIndexRates mockIbor = new TestingIborIndexRates(GBP_LIBOR_3M, fixingDate, rates, timeSeries); SimpleRatesProvider prov = new SimpleRatesProvider(fixingDate); prov.IborRates = mockIbor; IList <IborAveragedFixing> fixings = new List <IborAveragedFixing>(); double totalWeightedRate = 0.0d; double totalWeight = 0.0d; for (int i = 0; i < OBSERVATIONS.Length; i++) { IborIndexObservation obs = OBSERVATIONS[i]; IborAveragedFixing fixing = IborAveragedFixing.builder().observation(obs).weight(WEIGHTS[i]).build(); fixings.Add(fixing); totalWeightedRate += FIXING_VALUES[i] * WEIGHTS[i]; totalWeight += WEIGHTS[i]; } double rateExpected = totalWeightedRate / totalWeight; IborAveragedRateComputation ro = IborAveragedRateComputation.of(fixings); ForwardIborAveragedRateComputationFn obsFn = ForwardIborAveragedRateComputationFn.DEFAULT; double rateComputed = obsFn.rate(ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE, prov); assertEquals(rateComputed, rateExpected, TOLERANCE_RATE); // explain ExplainMapBuilder builder = ExplainMap.builder(); assertEquals(obsFn.explainRate(ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE, prov, builder), rateExpected, TOLERANCE_RATE); ExplainMap built = builder.build(); assertEquals(built.get(ExplainKey.OBSERVATIONS).Present, true); assertEquals(built.get(ExplainKey.OBSERVATIONS).get().size(), OBSERVATIONS.Length); for (int i = 0; i < 4; i++) { ExplainMap childMap = built.get(ExplainKey.OBSERVATIONS).get().get(i); assertEquals(childMap.get(ExplainKey.FIXING_DATE), (OBSERVATIONS[i].FixingDate)); assertEquals(childMap.get(ExplainKey.INDEX), GBP_LIBOR_3M); assertEquals(childMap.get(ExplainKey.INDEX_VALUE), FIXING_VALUES[i]); assertEquals(childMap.get(ExplainKey.WEIGHT), WEIGHTS[i]); assertEquals(childMap.get(ExplainKey.FROM_FIXING_SERIES), i == 0 ? true : null); } assertEquals(built.get(ExplainKey.COMBINED_RATE), rateExpected); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case -496986608: // shortObservation this.shortObservation = (IborIndexObservation)newValue; break; case -684321776: // longObservation this.longObservation = (IborIndexObservation)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public virtual void test_rate_IborAverageRateComputation() { double mockRate = 0.0123d; RateComputationFn <IborAveragedRateComputation> mockIborAve = mock(typeof(RateComputationFn)); LocalDate[] fixingDates = new LocalDate[] { date(2014, 6, 30), date(2014, 7, 7), date(2014, 7, 14), date(2014, 7, 21) }; double[] weights = new double[] { 0.10d, 0.20d, 0.30d, 0.40d }; IList <IborAveragedFixing> fixings = new List <IborAveragedFixing>(); for (int i = 0; i < fixingDates.Length; i++) { IborAveragedFixing fixing = IborAveragedFixing.builder().observation(IborIndexObservation.of(GBP_LIBOR_3M, fixingDates[i], REF_DATA)).weight(weights[i]).build(); fixings.Add(fixing); } IborAveragedRateComputation ro = IborAveragedRateComputation.of(fixings); when(mockIborAve.rate(ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE, MOCK_PROV)).thenReturn(mockRate); DispatchingRateComputationFn test = new DispatchingRateComputationFn(MOCK_IBOR_EMPTY, MOCK_IBOR_INT_EMPTY, mockIborAve, MOCK_ON_CPD_EMPTY, MOCK_ON_AVE_EMPTY, MOCK_ON_AVE_DLY_EMPTY, MOCK_INF_MON_EMPTY, MOCK_INF_INT_EMPTY, MOCK_INF_BOND_MON_EMPTY, MOCK_INF_BOND_INT_EMPTY); assertEquals(test.rate(ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE, MOCK_PROV), mockRate, 0d); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 122345516: // observation this.observation_Renamed = (IborIndexObservation)newValue; break; case 747425396: // fixedRate this.fixedRate_Renamed = (double?)newValue; break; case -791592328: // weight this.weight_Renamed = (double?)newValue.Value; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 122345516: // observation this.observation = (IborIndexObservation)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); }
// historic rate private double historicRate(IborIndexObservation observation) { LocalDate fixingDate = observation.FixingDate; double? fixedRate = fixings.get(fixingDate); if (fixedRate.HasValue) { return(fixedRate.Value); } else if (fixingDate.isBefore(ValuationDate)) { // the fixing is required if (fixings.Empty) { throw new System.ArgumentException(Messages.format("Unable to get fixing for {} on date {}, no time-series supplied", index, fixingDate)); } throw new System.ArgumentException(Messages.format("Unable to get fixing for {} on date {}", index, fixingDate)); } else { return(rateIgnoringFixings(observation)); } }
/// <summary> /// Computes cash flow equivalent and sensitivity of Ibor leg. /// <para> /// The return type is a map of {@code NotionalExchange} and {@code PointSensitivityBuilder}. /// /// </para> /// </summary> /// <param name="iborLeg"> the Ibor leg </param> /// <param name="ratesProvider"> the rates provider </param> /// <returns> the cash flow equivalent and sensitivity </returns> public static ImmutableMap <Payment, PointSensitivityBuilder> cashFlowEquivalentAndSensitivityIborLeg(ResolvedSwapLeg iborLeg, RatesProvider ratesProvider) { ArgChecker.isTrue(iborLeg.Type.Equals(SwapLegType.IBOR), "Leg type should be IBOR"); ArgChecker.isTrue(iborLeg.PaymentEvents.Empty, "PaymentEvent should be empty"); IDictionary <Payment, PointSensitivityBuilder> res = new Dictionary <Payment, PointSensitivityBuilder>(); foreach (SwapPaymentPeriod paymentPeriod in iborLeg.PaymentPeriods) { ArgChecker.isTrue(paymentPeriod is RatePaymentPeriod, "rate payment should be RatePaymentPeriod"); RatePaymentPeriod ratePaymentPeriod = (RatePaymentPeriod)paymentPeriod; ArgChecker.isTrue(ratePaymentPeriod.AccrualPeriods.size() == 1, "rate payment should not be compounding"); RateAccrualPeriod rateAccrualPeriod = ratePaymentPeriod.AccrualPeriods.get(0); CurrencyAmount notional = ratePaymentPeriod.NotionalAmount; LocalDate paymentDate = ratePaymentPeriod.PaymentDate; IborIndexObservation obs = ((IborRateComputation)rateAccrualPeriod.RateComputation).Observation; IborIndex index = obs.Index; LocalDate fixingStartDate = obs.EffectiveDate; double fixingYearFraction = obs.YearFraction; double factorIndex = (1d + fixingYearFraction * ratesProvider.iborIndexRates(index).rate(obs)); double dfPayment = ratesProvider.discountFactor(paymentPeriod.Currency, paymentPeriod.PaymentDate); double dfStart = ratesProvider.discountFactor(paymentPeriod.Currency, fixingStartDate); double beta = factorIndex * dfPayment / dfStart; double ycRatio = rateAccrualPeriod.YearFraction / fixingYearFraction; Payment payStart = Payment.of(notional.multipliedBy(beta * ycRatio), fixingStartDate); Payment payEnd = Payment.of(notional.multipliedBy(-ycRatio), paymentDate); double factor = ycRatio * notional.Amount / dfStart; PointSensitivityBuilder factorIndexSensi = ratesProvider.iborIndexRates(index).ratePointSensitivity(obs).multipliedBy(fixingYearFraction * dfPayment * factor); PointSensitivityBuilder dfPaymentSensitivity = ratesProvider.discountFactors(paymentPeriod.Currency).zeroRatePointSensitivity(paymentPeriod.PaymentDate).multipliedBy(factorIndex * factor); PointSensitivityBuilder dfStartSensitivity = ratesProvider.discountFactors(paymentPeriod.Currency).zeroRatePointSensitivity(fixingStartDate).multipliedBy(-factorIndex * dfPayment * factor / dfStart); res[payStart] = factorIndexSensi.combinedWith(dfPaymentSensitivity).combinedWith(dfStartSensitivity); res[payEnd] = PointSensitivityBuilder.none(); } return(ImmutableMap.copyOf(res)); }
//------------------------------------------------------------------------- /// <summary> /// Creates a {@code IborAveragedFixing} from the fixing date with a weight of 1. /// </summary> /// <param name="observation"> the Ibor observation </param> /// <returns> the unweighted fixing information </returns> public static IborAveragedFixing of(IborIndexObservation observation) { return(of(observation, null)); }
/// <summary> /// Obtains an instance from the observation and sensitivity value, /// specifying the currency of the value. /// </summary> /// <param name="observation"> the rate observation, including the fixing date </param> /// <param name="sensitivityCurrency"> the currency of the sensitivity </param> /// <param name="sensitivity"> the value of the sensitivity </param> /// <returns> the point sensitivity object </returns> public static IborRateSensitivity of(IborIndexObservation observation, Currency sensitivityCurrency, double sensitivity) { return(new IborRateSensitivity(observation, sensitivityCurrency, sensitivity)); }
public double rateIgnoringFixings(IborIndexObservation observation) { double relativeYearFraction = this.relativeYearFraction(observation.MaturityDate); return(curve.yValue(relativeYearFraction)); }
/// <summary> /// Creates an instance from the two underlying index observations. /// <para> /// The two observations must be for two different indexes in the same currency on the same fixing date. /// The index with the shorter tenor must be passed as the first argument. /// /// </para> /// </summary> /// <param name="shortObservation"> the short underlying index observation </param> /// <param name="longObservation"> the long underlying index observation </param> /// <returns> the rate computation </returns> /// <exception cref="IllegalArgumentException"> if the indices are not short, then long </exception> public static IborInterpolatedRateComputation of(IborIndexObservation shortObservation, IborIndexObservation longObservation) { return(new IborInterpolatedRateComputation(shortObservation, longObservation)); }
/// <summary> /// Creates a {@code IborAveragedFixing} from the fixing date, calculating the weight /// from the number of days in the reset period. /// <para> /// This implements the standard approach to average weights, which is to set each /// weight to the actual number of days between the start and end of the reset period. /// /// </para> /// </summary> /// <param name="observation"> the Ibor observation </param> /// <param name="startDate"> the start date of the reset period </param> /// <param name="endDate"> the end date of the reset period </param> /// <returns> the weighted fixing information </returns> public static IborAveragedFixing ofDaysInResetPeriod(IborIndexObservation observation, LocalDate startDate, LocalDate endDate) { return(ofDaysInResetPeriod(observation, startDate, endDate, null)); }
/// <summary> /// Creates a {@code IborAveragedFixing} from the fixing date with a weight of 1. /// </summary> /// <param name="observation"> the Ibor observation </param> /// <param name="fixedRate"> the fixed rate for the fixing date, optional, may be null </param> /// <returns> the unweighted fixing information </returns> public static IborAveragedFixing of(IborIndexObservation observation, double?fixedRate) { return(IborAveragedFixing.builder().observation(observation).fixedRate(fixedRate).build()); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(IborAveragedFixing beanToCopy) { this.observation_Renamed = beanToCopy.Observation; this.fixedRate_Renamed = beanToCopy.fixedRate; this.weight_Renamed = beanToCopy.Weight; }
public PointSensitivityBuilder rateIgnoringFixingsPointSensitivity(IborIndexObservation observation) { return(IborRateSensitivity.of(observation, 1d)); }
//----------------------------------------------------------------------- /// <summary> /// Sets the Ibor index observation to use to determine a rate for the reset period. </summary> /// <param name="observation"> the new value, not null </param> /// <returns> this, for chaining, not null </returns> public Builder observation(IborIndexObservation observation) { JodaBeanUtils.notNull(observation, "observation"); this.observation_Renamed = observation; return(this); }
/// <summary> /// Creates an instance from the underlying index observation. /// </summary> /// <param name="underlyingObservation"> the underlying index observation </param> /// <returns> the rate computation </returns> public static IborRateComputation of(IborIndexObservation underlyingObservation) { return(new IborRateComputation(underlyingObservation)); }