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

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

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

origin: OpenGamma/Strata

/**
 * Returns the formatted string version of the currency pair.
 * <p>
 * The format is '${baseCurrency}/${counterCurrency}'.
 * 
 * @return the formatted string
 */
@Override
@ToString
public String toString() {
 return base.getCode() + "/" + counter.getCode();
}
origin: OpenGamma/Strata

@Override
public Set<String> tokens(CurrencyParameterSensitivity sensitivity) {
 return ImmutableSet.of(
   sensitivity.getCurrency().getCode().toLowerCase(Locale.ENGLISH),
   sensitivity.getMarketDataName().getName().toLowerCase(Locale.ENGLISH));
}
origin: OpenGamma/Strata

private boolean matchesToken(CurrencyParameterSensitivity sensitivity, String token) {
 return token.equalsIgnoreCase(sensitivity.getCurrency().getCode()) ||
   token.equalsIgnoreCase(sensitivity.getMarketDataName().getName());
}
origin: OpenGamma/Strata

private Stream<String> tokensForSensitivity(CurrencyParameterSensitivity sensitivity) {
 return ImmutableSet.of(
   sensitivity.getCurrency().getCode(),
   sensitivity.getMarketDataName().getName())
   .stream()
   .map(v -> v.toLowerCase(Locale.ENGLISH));
}
origin: OpenGamma/Strata

@Override
public EvaluationResult evaluate(
  CurrencyParameterSensitivity sensitivity,
  CalculationFunctions functions,
  String firstToken,
  List<String> remainingTokens) {
 if (firstToken.equalsIgnoreCase(sensitivity.getCurrency().getCode()) ||
   firstToken.equalsIgnoreCase(sensitivity.getMarketDataName().getName())) {
  return EvaluationResult.success(sensitivity, remainingTokens);
 } else {
  return invalidTokenFailure(sensitivity, firstToken);
 }
}
origin: OpenGamma/Strata

public void test_parse_String() {
 Currency test = Currency.parse("GBP");
 assertEquals(test.getCode(), "GBP");
 assertSame(test, Currency.GBP);
}
origin: OpenGamma/Strata

public void test_parse_String_lowerCase() {
 Currency test = Currency.parse("gbp");
 assertEquals(test.getCode(), "GBP");
 assertSame(test, Currency.GBP);
}
origin: OpenGamma/Strata

public void test_of_String() {
 Currency test = Currency.of("SEK");
 assertEquals(test.getCode(), "SEK");
 assertSame(test, Currency.of("SEK"));
}
origin: OpenGamma/Strata

public void test_of_String_unknownCurrencyCreated() {
 Currency test = Currency.of("AAA");
 assertEquals(test.getCode(), "AAA");
 assertEquals(test.getMinorUnitDigits(), 0);
 assertSame(test, Currency.of("AAA"));
}
origin: OpenGamma/Strata

public void test_parse_String_unknownCurrencyCreated() {
 Currency test = Currency.parse("zyx");
 assertEquals(test.getCode(), "ZYX");
 assertEquals(test.getMinorUnitDigits(), 0);
 assertSame(test, Currency.of("ZYX"));
}
origin: OpenGamma/Strata

public void test_of_String_historicCurrency() {
 Currency test = Currency.of("BEF");
 assertEquals(test.getCode(), "BEF");
 assertEquals(test.getMinorUnitDigits(), 2);
 assertEquals(test.getTriangulationCurrency(), Currency.EUR);
 assertSame(test, Currency.of("BEF"));
}
origin: OpenGamma/Strata

public void test_explainPresentValue() {
 ExplainMap explain = LEG_PRICER.explainPresentValue(CAP_LEG, RATES_PROVIDER, VOLATILITIES);
 assertEquals(explain.get(ExplainKey.ENTRY_TYPE).get(), "CmsLeg");
 assertEquals(explain.get(ExplainKey.PAY_RECEIVE).get().toString(), "Receive");
 assertEquals(explain.get(ExplainKey.PAYMENT_CURRENCY).get().getCode(), "EUR");
 assertEquals(explain.get(ExplainKey.START_DATE).get(), LocalDate.of(2015, 10, 21));
 assertEquals(explain.get(ExplainKey.END_DATE).get(), LocalDate.of(2020, 10, 21));
 assertEquals(explain.get(ExplainKey.INDEX).get().toString(), "EUR-EURIBOR-1100-5Y");
 assertEquals(explain.get(ExplainKey.PRESENT_VALUE).get().getAmount(), 39728.51321029542);
 
 List<ExplainMap> paymentPeriods = explain.get(ExplainKey.PAYMENT_PERIODS).get();
 assertEquals(paymentPeriods.size(), 5);
 //Test First Period
 ExplainMap cmsPeriod0 = paymentPeriods.get(0);
 assertEquals(cmsPeriod0.get(ExplainKey.ENTRY_TYPE).get(), "CmsCapletPeriod");
 assertEquals(cmsPeriod0.get(ExplainKey.STRIKE_VALUE).get(), 0.0125d);
 assertEquals(cmsPeriod0.get(ExplainKey.NOTIONAL).get().getAmount(), 1000000d);
 assertEquals(cmsPeriod0.get(ExplainKey.PAYMENT_DATE).get(), LocalDate.of(2016, 10, 21));
 assertEquals(cmsPeriod0.get(ExplainKey.DISCOUNT_FACTOR).get(), 0.9820085531995826d);
 assertEquals(cmsPeriod0.get(ExplainKey.START_DATE).get(), LocalDate.of(2015, 10, 21));
 assertEquals(cmsPeriod0.get(ExplainKey.END_DATE).get(), LocalDate.of(2016, 10, 21));
 assertEquals(cmsPeriod0.get(ExplainKey.FIXING_DATE).get(), LocalDate.of(2015, 10, 19));
 assertEquals(cmsPeriod0.get(ExplainKey.ACCRUAL_YEAR_FRACTION).get(), 1.0166666666666666d);
 double forwardSwapRate = PRICER_SWAP.parRate(CAP_LEG.getCmsPeriods().get(0).getUnderlyingSwap(), RATES_PROVIDER);
 assertEquals(cmsPeriod0.get(ExplainKey.FORWARD_RATE).get(), forwardSwapRate);
 CurrencyAmount pv = PERIOD_PRICER.presentValue(CAP_LEG.getCmsPeriods().get(0), RATES_PROVIDER, VOLATILITIES);
 assertEquals(cmsPeriod0.get(ExplainKey.PRESENT_VALUE).get(), pv);
}
origin: OpenGamma/Strata

 csv.writeCell(pmd instanceof DatedParameterMetadata ? ((DatedParameterMetadata) pmd).getDate().toString() : "");
csv.writeCell(paramSens.getCurrency().getCode());
csv.writeCell(BigDecimal.valueOf(value).toPlainString());
csv.writeLine(additionalCells);
com.opengamma.strata.basics.currencyCurrencygetCode

Javadoc

Gets the three letter ISO code.

Popular methods of Currency

  • equals
    Checks if this currency equals another currency. The comparison checks the three letter currency cod
  • 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

  • Making http post requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • getExternalFilesDir (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • JTable (javax.swing)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • 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