コード例 #1
0
 @Override
 public Optional<Currency> defaultReportingCurrency(FxSwapTrade target) {
   Currency base = target.getProduct().getNearLeg().getBaseCurrencyAmount().getCurrency();
   Currency counter = target.getProduct().getNearLeg().getCounterCurrencyAmount().getCurrency();
   CurrencyPair marketConventionPair = CurrencyPair.of(base, counter).toConventional();
   return Optional.of(marketConventionPair.getBase());
 }
コード例 #2
0
 /**
  * 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();
 }
コード例 #3
0
ファイル: BaseProvider.java プロジェクト: iamking1987/Strata
 /**
  * Gets the FX rate for the specified currency pair on the valuation date.
  *
  * <p>The rate returned is the rate from the base currency to the counter currency as defined by
  * this formula: {@code (1 * baseCurrency = fxRate * counterCurrency)}.
  *
  * @param currencyPair the ordered currency pair defining the rate required
  * @return the current FX rate for the currency pair
  * @throws IllegalArgumentException if the rate is not available
  */
 @Override
 public default double fxRate(CurrencyPair currencyPair) {
   return fxRate(currencyPair.getBase(), currencyPair.getCounter());
 }