OvernightIndexObservation cutoffIndexObs = indexObsList.get(nbPeriods - 1 - i); OvernightIndexObservation updatedIndexObs = cutoffIndexObs.toBuilder() .fixingDate(fixingIndexObs.getFixingDate()) .publicationDate(fixingIndexObs.getPublicationDate()) .build(); indexObsList.set(nbPeriods - 1 - i, updatedIndexObs);
/** * Creates an {@code IborRateObservation} from an index and fixing date. * <p> * The reference data is used to find the maturity date from the fixing date. * * @param index the index * @param fixingDate the fixing date * @param refData the reference data to use when resolving holiday calendars * @return the rate observation */ public static OvernightIndexObservation of(OvernightIndex index, LocalDate fixingDate, ReferenceData refData) { LocalDate publicationDate = index.calculatePublicationFromFixing(fixingDate, refData); LocalDate effectiveDate = index.calculateEffectiveFromFixing(fixingDate, refData); LocalDate maturityDate = index.calculateMaturityFromEffective(effectiveDate, refData); return OvernightIndexObservation.builder() .index(index) .fixingDate(fixingDate) .publicationDate(publicationDate) .effectiveDate(effectiveDate) .maturityDate(maturityDate) .yearFraction(index.getDayCount().yearFraction(effectiveDate, maturityDate)) .build(); }
/** * Creates an observation object for the specified fixing date. * * @param fixingDate the fixing date * @return the index observation */ public default OvernightIndexObservation observeOn(LocalDate fixingDate) { LocalDate publicationDate = calculatePublicationFromFixing(fixingDate); LocalDate effectiveDate = calculateEffectiveFromFixing(fixingDate); LocalDate maturityDate = calculateMaturityFromEffective(effectiveDate); return OvernightIndexObservation.builder() .index(getIndex()) .fixingDate(fixingDate) .publicationDate(publicationDate) .effectiveDate(effectiveDate) .maturityDate(maturityDate) .yearFraction(getIndex().getDayCount().yearFraction(effectiveDate, maturityDate)) .build(); }
@Override public OvernightIndexObservation.Builder builder() { return new OvernightIndexObservation.Builder(); }
/** * Returns a builder that allows this bean to be mutated. * @return the mutable builder, not null */ public Builder toBuilder() { return new Builder(this); }
/** * Returns a builder used to create an instance of the bean. * @return the builder, not null */ public static OvernightIndexObservation.Builder builder() { return new OvernightIndexObservation.Builder(); }