class OvernightIndexObservation implements IndexObservation, ImmutableBean, Serializable {

  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();
  }

  private  OvernightIndexObservation(
      OvernightIndex index,
      LocalDate fixingDate,
      LocalDate publicationDate,
      LocalDate effectiveDate,
      LocalDate maturityDate,
      double yearFraction);

}