/** * Obtains an instance from currency pair, reference currency, reference date and sensitivity * value. * * <p>The sensitivity currency is defaulted to be a currency of the currency pair that is not the * reference currency. * * @param currencyPair the currency pair * @param referenceCurrency the reference currency * @param referenceDate the reference date * @param sensitivity the value of the sensitivity * @return the point sensitivity object */ public static FxForwardSensitivity of( CurrencyPair currencyPair, Currency referenceCurrency, LocalDate referenceDate, double sensitivity) { boolean inverse = referenceCurrency.equals(currencyPair.getCounter()); CurrencyPair pair = inverse ? currencyPair.inverse() : currencyPair; Currency sensitivityCurrency = pair.getCounter(); return new FxForwardSensitivity( currencyPair, referenceCurrency, referenceDate, sensitivityCurrency, sensitivity); }
/** * Gets the currency counter to the reference currency. * * <p>The currency pair contains two currencies. One is the reference currency. This method * returns the other. * * @return the counter currency */ public Currency getReferenceCounterCurrency() { boolean inverse = referenceCurrency.equals(currencyPair.getBase()); return inverse ? currencyPair.getCounter() : currencyPair.getBase(); }