Skip navigation links
com.opengamma.strata.basics.currency

Interface FxRateProvider

• Method Summary

All Methods
Modifier and Type Method and Description
default double convert(double amount, Currency fromCurrency, Currency toCurrency)
Converts an amount in a currency to an amount in a different currency using this rate.
double fxRate(Currency baseCurrency, Currency counterCurrency)
Gets the FX rate for the specified currency pair.
default double fxRate(CurrencyPair currencyPair)
Gets the FX rate for the specified currency pair.
• Method Detail

• convert

default double convert(double amount,
Currency fromCurrency,
Currency toCurrency)
Converts an amount in a currency to an amount in a different currency using this rate.

The currencies must both be included in the currency pair of this rate.

Parameters:
amount - an amount in fromCurrency
fromCurrency - the currency of the amount
toCurrency - the currency into which the amount should be converted
Returns:
the amount converted into toCurrency
Throws:
IllegalArgumentException - if either of the currencies aren't included in the currency pair of this rate
• fxRate

double fxRate(Currency baseCurrency,
Currency counterCurrency)
Gets the FX rate for the specified currency pair.

The rate returned is the rate from the base currency to the counter currency as defined by this formula: (1 * baseCurrency = fxRate * counterCurrency).

Parameters:
baseCurrency - the base currency, to convert from
counterCurrency - the counter currency, to convert to
Returns:
the FX rate for the currency pair
Throws:
RuntimeException - if no FX rate could be found
• fxRate

default double fxRate(CurrencyPair currencyPair)
Gets the FX rate for the specified currency pair.

The rate returned is the rate from the base currency to the counter currency as defined by this formula: (1 * baseCurrency = fxRate * counterCurrency).

Parameters:
currencyPair - the ordered currency pair defining the rate required
Returns:
the FX rate for the currency pair
Throws:
RuntimeException - if no FX rate could be found
Skip navigation links

Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.