/** * Gets the currency of the floating rate. * * @return the currency * @throws IllegalArgumentException if unable to return an index, which should * only happen if the system is not configured correctly */ public default Currency getCurrency() { return toFloatingRateIndex().getCurrency(); }
/** * Creates an instance 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 FxIndexObservation of(FxIndex index, LocalDate fixingDate, ReferenceData refData) { LocalDate maturityDate = index.calculateMaturityFromFixing(fixingDate, refData); return new FxIndexObservation(index, fixingDate, maturityDate); }
/** * Gets the FX index. * * @return the FX index */ public FxIndex getIndex() { return observation.getIndex(); }
public void test_of() { OvernightIndexObservation test = OvernightIndexObservation.of(GBP_SONIA, FIXING_DATE, REF_DATA); assertEquals(test.getIndex(), GBP_SONIA); assertEquals(test.getFixingDate(), FIXING_DATE); assertEquals(test.getPublicationDate(), PUBLICATION_DATE); assertEquals(test.getEffectiveDate(), EFFECTIVE_DATE); assertEquals(test.getMaturityDate(), MATURITY_DATE); assertEquals(test.getCurrency(), GBP_SONIA.getCurrency()); assertEquals(test.toString(), "OvernightIndexObservation[GBP-SONIA on 2016-02-22]"); }
public void coverage() { coverPrivateConstructor(PriceIndices.class); coverImmutableBean((ImmutableBean) PriceIndices.US_CPI_U); coverBeanEquals((ImmutableBean) PriceIndices.US_CPI_U, ImmutablePriceIndex.builder() .name("Test") .region(Country.AR) .currency(Currency.ARS) .publicationFrequency(Frequency.P6M) .build()); }
/** * Gets the fixing date. * * @return the fixing date */ public LocalDate getFixingDate() { // fixing date is the same for both observations return shortObservation.getFixingDate(); }
/** * Gets the effective date. * * @return the effective date */ public LocalDate getEffectiveDate() { return observation.getEffectiveDate(); }
/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(ImmutablePriceIndex beanToCopy) { this.name = beanToCopy.getName(); this.region = beanToCopy.getRegion(); this.currency = beanToCopy.getCurrency(); this.active = beanToCopy.isActive(); this.publicationFrequency = beanToCopy.getPublicationFrequency(); }
/** * Gets the convention name, such as 'GBP-LIBOR-3M'. * <p> * This will default to the name of the index if not specified. * * @return the convention name */ @Override public String getName() { return name != null ? name : index.getName(); }
/** * Gets the Ibor index that the sensitivity refers to. * * @return the Ibor index */ public IborIndex getIndex() { return observation.getIndex(); }
/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(ImmutableFloatingRateName beanToCopy) { this.externalName = beanToCopy.getExternalName(); this.indexName = beanToCopy.getIndexName(); this.type = beanToCopy.getType(); this.fixingDateOffsetDays = beanToCopy.fixingDateOffsetDays; }
/** * 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(); }
@Override public ImmutablePriceIndex build() { return new ImmutablePriceIndex( name, region, currency, active, publicationFrequency); }
@Override public FxIndexObservation build() { return new FxIndexObservation( index, fixingDate, maturityDate); }
/** * Returns a builder that allows this bean to be mutated. * @return the mutable builder, not null */ Builder toBuilder() { return new Builder(this); }
/** * Returns the name of the index. * * @return the name of the index */ @Override public String toString() { return getName(); }
/** * Returns the name of the index. * * @return the name of the index */ @Override public String toString() { return getName(); }
/** * Returns a builder used to create an instance of the bean. * @return the builder, not null */ public static ImmutableFxIndex.Builder builder() { return new ImmutableFxIndex.Builder(); }
/** * Returns a builder that allows this bean to be mutated. * @return the mutable builder, not null */ public Builder toBuilder() { return new Builder(this); }