/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(OvernightAveragedRateComputation beanToCopy) { this.index = beanToCopy.getIndex(); this.fixingCalendar = beanToCopy.getFixingCalendar(); this.startDate = beanToCopy.getStartDate(); this.endDate = beanToCopy.getEndDate(); this.rateCutOffDays = beanToCopy.getRateCutOffDays(); }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 100346066: // index return ((OvernightAveragedRateComputation) bean).getIndex(); case 394230283: // fixingCalendar return ((OvernightAveragedRateComputation) bean).getFixingCalendar(); case -2129778896: // startDate return ((OvernightAveragedRateComputation) bean).getStartDate(); case -1607727319: // endDate return ((OvernightAveragedRateComputation) bean).getEndDate(); case -92095804: // rateCutOffDays return ((OvernightAveragedRateComputation) bean).getRateCutOffDays(); } return super.propertyGet(bean, propertyName, quiet); }
this.rates = rates; LocalDate startFixingDate = computation.getStartDate(); LocalDate endFixingDateP1 = computation.getEndDate(); this.cutoffOffset = computation.getRateCutOffDays() > 1 ? computation.getRateCutOffDays() : 1; double accrualFactorAccumulated = 0d;
HolidayCalendar calendar = computation.getFixingCalendar(); LocalDate startFixingDate = computation.getStartDate(); LocalDate endFixingDateP1 = computation.getEndDate(); LocalDate endFixingDate = calendar.previous(endFixingDateP1); LocalDate onRateEndDate = computation.calculateMaturityFromFixing(endFixingDate);
private double rateForward(OvernightAveragedRateComputation computation, OvernightIndexRates rates) { OvernightIndex index = computation.getIndex(); HolidayCalendar calendar = computation.getFixingCalendar(); LocalDate startFixingDate = computation.getStartDate(); LocalDate endFixingDateP1 = computation.getEndDate(); LocalDate endFixingDate = calendar.previous(endFixingDateP1); LocalDate onRateEndDate = computation.calculateMaturityFromFixing(endFixingDate); LocalDate onRateStartDate = computation.calculateEffectiveFromFixing(startFixingDate); LocalDate onRateNoCutOffEndDate = onRateEndDate; int cutoffOffset = computation.getRateCutOffDays() > 1 ? computation.getRateCutOffDays() : 1; double accumulatedInterest = 0.0d; double accrualFactorTotal = index.getDayCount().yearFraction(onRateStartDate, onRateEndDate); if (cutoffOffset > 1) { // Cut-off period LocalDate currentFixingDate = endFixingDate; OvernightIndexObservation lastIndexObs = null; double cutOffAccrualFactorTotal = 0d; for (int i = 1; i < cutoffOffset; i++) { currentFixingDate = calendar.previous(currentFixingDate); lastIndexObs = computation.observeOn(currentFixingDate); onRateNoCutOffEndDate = lastIndexObs.getMaturityDate(); cutOffAccrualFactorTotal += lastIndexObs.getYearFraction(); } double forwardRateCutOff = rates.rate(lastIndexObs); accumulatedInterest += cutOffAccrualFactorTotal * forwardRateCutOff; } // Approximated part accumulatedInterest += approximatedInterest(computation.observeOn(onRateStartDate), onRateNoCutOffEndDate, rates); // final rate return accumulatedInterest / accrualFactorTotal; }
LocalDate lastNonCutoffFixing = computation.getEndDate(); int cutoffOffset = computation.getRateCutOffDays() > 1 ? computation.getRateCutOffDays() : 1; double accumulatedInterest = 0.0d;
LocalDate lastNonCutoffFixing = computation.getEndDate(); int cutoffOffset = computation.getRateCutOffDays() > 1 ? computation.getRateCutOffDays() : 1; double accrualFactorTotal = 0.0d;