/** * Obtains an instance from the observation and sensitivity value. * <p> * The currency is defaulted from the index. * The end date will be the maturity date of the observation. * * @param observation the rate observation, including the fixing date * @param sensitivity the value of the sensitivity * @return the point sensitivity object */ public static OvernightRateSensitivity of(OvernightIndexObservation observation, double sensitivity) { return of(observation, observation.getCurrency(), sensitivity); }
/** * Obtains an instance for a period observation of the index from the observation * and sensitivity value. * <p> * The currency is defaulted from the index. * * @param observation the rate observation, including the fixing date * @param endDate the end date of the period * @param sensitivity the value of the sensitivity * @return the point sensitivity object */ public static OvernightRateSensitivity ofPeriod( OvernightIndexObservation observation, LocalDate endDate, double sensitivity) { return ofPeriod(observation, endDate, observation.getCurrency(), sensitivity); }
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]"); }