Tabnine Logo
Currency.equals
Code IndexAdd Tabnine to your IDE (free)

How to use
equals
method
in
com.opengamma.strata.basics.currency.Currency

Best Java code snippets using com.opengamma.strata.basics.currency.Currency.equals (Showing top 20 results out of 315)

origin: OpenGamma/Strata

/**
 * Checks if this currency pair is the inverse of the specified pair.
 * <p>
 * This could be used to check if an FX rate specified in one currency pair needs inverting.
 * 
 * @param other  the other currency pair
 * @return true if the currency is the inverse of the specified pair
 */
public boolean isInverse(CurrencyPair other) {
 ArgChecker.notNull(other, "currencyPair");
 return base.equals(other.counter) && counter.equals(other.base);
}
origin: OpenGamma/Strata

@Override
public BondFutureOptionSensitivity withCurrency(Currency currency) {
 if (this.currency.equals(currency)) {
  return this;
 }
 return new BondFutureOptionSensitivity(
   volatilitiesName, expiry, futureExpiryDate, strikePrice, futurePrice, currency, sensitivity);
}
origin: OpenGamma/Strata

@Override
public IborCapletFloorletSensitivity withCurrency(Currency currency) {
 if (this.currency.equals(currency)) {
  return this;
 }
 return new IborCapletFloorletSensitivity(volatilitiesName, expiry, strike, forward, currency, sensitivity);
}
origin: OpenGamma/Strata

@Override
public IborRateSensitivity withCurrency(Currency currency) {
 if (this.currency.equals(currency)) {
  return this;
 }
 return new IborRateSensitivity(observation, currency, sensitivity);
}
origin: OpenGamma/Strata

@Override
public OvernightRateSensitivity withCurrency(Currency currency) {
 if (this.currency.equals(currency)) {
  return this;
 }
 return new OvernightRateSensitivity(observation, endDate, currency, sensitivity);
}
origin: OpenGamma/Strata

@Override
public SwaptionSensitivity withCurrency(Currency currency) {
 if (this.currency.equals(currency)) {
  return this;
 }
 return new SwaptionSensitivity(volatilitiesName, expiry, tenor, strike, forward, currency, sensitivity);
}
origin: OpenGamma/Strata

@Override
public IborCapletFloorletSabrSensitivity withCurrency(Currency currency) {
 if (this.currency.equals(currency)) {
  return this;
 }
 return new IborCapletFloorletSabrSensitivity(volatilitiesName, expiry, sensitivityType, currency, sensitivity);
}
origin: OpenGamma/Strata

@Override
public IborFutureOptionSensitivity withCurrency(Currency currency) {
 if (this.currency.equals(currency)) {
  return this;
 }
 return new IborFutureOptionSensitivity(
   volatilitiesName, expiry, fixingDate, strikePrice, futurePrice, currency, sensitivity);
}
origin: OpenGamma/Strata

@Override
public double fxRate(Currency baseCurrency, Currency counterCurrency) {
 if (baseCurrency.equals(counterCurrency)) {
  return 1d;
 }
 throw new UnsupportedOperationException("FxRate not found: " + baseCurrency + "/" + counterCurrency);
}
origin: OpenGamma/Strata

/**
 * Checks if this multi-amount contains an amount for the specified currency.
 * 
 * @param currency  the currency to find
 * @return true if this amount contains a value for the currency
 */
public boolean contains(Currency currency) {
 ArgChecker.notNull(currency, "currency");
 return amounts.stream().anyMatch(ca -> ca.getCurrency().equals(currency));
}
origin: OpenGamma/Strata

@Override
public CurrencyAmountArray convertedTo(Currency resultCurrency, FxRateProvider fxRateProvider) {
 if (currency.equals(resultCurrency)) {
  return this;
 }
 double fxRate = fxRateProvider.fxRate(currency, resultCurrency);
 DoubleArray convertedValues = values.multipliedBy(fxRate);
 return new CurrencyAmountArray(resultCurrency, convertedValues);
}
origin: OpenGamma/Strata

@Override
public DummyPointSensitivity withCurrency(Currency currency) {
 if (this.currency.equals(currency)) {
  return this;
 }
 return new DummyPointSensitivity(curveCurrency, date, currency, sensitivity);
}
origin: OpenGamma/Strata

@ImmutableValidator
private void validate() {
 ArgChecker.isTrue(spreadFloatingLeg.getCurrency().equals(spreadLeg.getCurrency()),
   "Conventions must have same currency");
 ArgChecker.isTrue(spreadFloatingLeg.getCurrency().equals(flatFloatingLeg.getCurrency()),
   "Conventions must have same currency");
}
origin: OpenGamma/Strata

public void test_convertedTo_rateProvider_conversionSize1() {
 FxRateProvider provider = (ccy1, ccy2) -> {
  if (ccy1.equals(CCY1) && ccy2.equals(CCY2)) {
   return 2.5d;
  }
  throw new IllegalArgumentException();
 };
 MultiCurrencyAmount test = MultiCurrencyAmount.of(CA1);
 assertEquals(test.convertedTo(CCY2, provider), CurrencyAmount.of(CCY2, AMT1 * 2.5d));
}
origin: OpenGamma/Strata

@ImmutableValidator
private void validate() {
 if (pair.getBase().equals(pair.getCounter()) && !rates.stream().allMatch(v -> v == 1d)) {
  throw new IllegalArgumentException("Conversion rate between identical currencies must be one");
 }
}
origin: OpenGamma/Strata

@ImmutableValidator
private void validate() {
 if (baseCurrencyPayment.getCurrency().equals(counterCurrencyPayment.getCurrency())) {
  throw new IllegalArgumentException("Payments must have different currencies");
 }
 if ((baseCurrencyPayment.getAmount() != 0d || counterCurrencyPayment.getAmount() != 0d) &&
   Math.signum(baseCurrencyPayment.getAmount()) != -Math.signum(counterCurrencyPayment.getAmount())) {
  throw new IllegalArgumentException("Payments must have different signs");
 }
 ArgChecker.inOrderOrEqual(baseCurrencyPayment.getDate(), counterCurrencyPayment.getDate(),
   "baseCurrencyPayment.date", "counterCurrencyPayment.date");
}
origin: OpenGamma/Strata

@ImmutableValidator
private void validate() {
 ArgChecker.inOrderNotEqual(
   nearLeg.getPaymentDate(), farLeg.getPaymentDate(), "nearLeg.paymentDate", "farLeg.paymentDate");
 if (!nearLeg.getBaseCurrencyAmount().getCurrency().equals(farLeg.getBaseCurrencyAmount().getCurrency()) ||
   !nearLeg.getCounterCurrencyAmount().getCurrency().equals(farLeg.getCounterCurrencyAmount().getCurrency())) {
  throw new IllegalArgumentException("Legs must have the same currency pair");
 }
 if (signum(nearLeg.getBaseCurrencyAmount().getAmount()) == signum(farLeg.getBaseCurrencyAmount().getAmount())) {
  throw new IllegalArgumentException("Legs must have payments flowing in opposite directions");
 }
}
origin: OpenGamma/Strata

/**
 * Gets the non-deliverable currency.
 * <p>
 * Returns the currency that is not the settlement currency.
 * 
 * @return the currency that is not to be settled
 */
public Currency getNonDeliverableCurrency() {
 Currency base = agreedFxRate.getPair().getBase();
 return base.equals(getSettlementCurrency()) ? agreedFxRate.getPair().getCounter() : base;
}
origin: OpenGamma/Strata

@Override
public double rateFxSpotSensitivity(Currency baseCurrency, LocalDate referenceDate) {
 ArgChecker.isTrue(
   currencyPair.contains(baseCurrency), "Currency {} invalid for CurrencyPair {}", baseCurrency, currencyPair);
 boolean inverse = baseCurrency.equals(currencyPair.getCounter());
 double dfCcyBaseAtMaturity = baseCurrencyDiscountFactors.discountFactor(referenceDate);
 double dfCcyCounterAtMaturity = counterCurrencyDiscountFactors.discountFactor(referenceDate);
 double forwardRateDelta = dfCcyBaseAtMaturity / dfCcyCounterAtMaturity;
 return inverse ? 1d / forwardRateDelta : forwardRateDelta;
}
origin: OpenGamma/Strata

@ImmutableValidator
private void validate() {
 ArgChecker.isTrue(
   fixedLeg.getCurrency().equals(floatingLeg.getCurrency()),
   Messages.format(
     "Swap leg conventions must have same currency but found {} and {}, conventions {} and {}",
     fixedLeg.getCurrency(),
     floatingLeg.getCurrency(),
     fixedLeg,
     floatingLeg));
}
com.opengamma.strata.basics.currencyCurrencyequals

Javadoc

Checks if this currency equals another currency.

The comparison checks the three letter currency code.

Popular methods of Currency

  • getCode
    Gets the three letter ISO code.
  • getMinorUnitDigits
    Gets the number of digits in the minor unit. For example, 'USD' will return 2, indicating that there
  • of
    Obtains an instance for the specified ISO-4217 three letter currency code. A currency is uniquely id
  • parse
    Parses a string to obtain a Currency. The parse is identical to #of(String) except that it will conv
  • compareTo
    Compares this currency to another. The comparison sorts alphabetically by the three letter currency
  • getTriangulationCurrency
    Gets the preferred triangulation currency. When obtaining a market quote for a currency, the triangu
  • roundMinorUnits
    Rounds the specified amount according to the minor units. For example, 'USD' has 2 minor digits, so
  • toString
    Returns a string representation of the currency, which is the three letter code.
  • <init>
    Restricted constructor, called only by CurrencyProperties.
  • addCode
  • getAvailableCurrencies
    Obtains the set of configured currencies. This contains all the currencies that have been defined in
  • hashCode
    Returns a suitable hash code for the currency.
  • getAvailableCurrencies,
  • hashCode

Popular in Java

  • Creating JSON documents from java classes using gson
  • putExtra (Intent)
  • setScale (BigDecimal)
  • notifyDataSetChanged (ArrayAdapter)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • ImageIO (javax.imageio)
  • JTable (javax.swing)
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now