FX Rate

The FX exchange rate service provides a currency conversion between any provided currency by using one of the following:

  • Direct conversion.
  • Reverse conversion.
  • Conversion via a defined pivot currency.

The service is intended to be customizable or even replaced with a tailor-made one.

IfRates service

This is the core of the service. The IFxRates bean exposes all the services needed to provide the exchange rate. The default implementation is provided by the class FxRates, it takes the exchanges rates in the store “FXRates” and supplies the direct or reverse rate. The pivot currency is provided on the constructor and is used if neither a direct nor a reverse rate has been found. Any Atoti plugins that implement IFXRatesAware can use the FX rate service.

FXRates store

The store is indexed by BaseCcy, CounterCcy, and AsOfDate.

Store Field Key CanBeNull Type Description
BaseCcy Y String The left side of the currency pair
CounterCcy Y String The right side of the currency pair
FxRate Double Forex rate between the two currencies
AsOfDate Y LOCALDATE[yyyy-mm-dd] Timestamp (at close of business) for the data

API

getFxRate

This is the main service method that returns the FX rate to go from the baseCcy to the counterCcy.

The formula is:

$$Value_{counterCcy} = Value_{baseCcy} * FX_{counterCcy/baseCcy}$$.

Param Type Description
datastore IDatabaseVersion Datastore version to get the FX Rates from.
asOfDate LocalDate AsOf Date
baseCcy String Base currency (USD for the USD/EUR rate)
counterCcy String Quote currency (EUR for the USD/EUR rate)
maxFallbackDays int Maximum number of iterations to step through date
dateInfo IDateShift The way to shift the date if needed
activePivot IActivePivot Atoti Server instance
leafCoordinates List Coordinates extracted from additional FX Rates Level Info

getAvailableCurrencies

This service provides the list of all the known currencies. It fills the display currency analysis hierarchy.

updateLeafCoordinatesFunction

This function is used in the case of a custom implementation to specify the way to fill the leafCoordinates parameter. It also specifies additional levels to retrieve as a leaf in order to fill the parameter.

Post Processors

We provide three different post-processors:

  • FXRate provides the FX rate corresponding to the current location.
  • FX converts an underlying scalar measure from the baseCcy to the counterCcy.
  • FXVector converts an underlying vector of measures from the baseCcy to the counterCcy.

These post-processors uses the IfRates service to get the exchange rate and the FXRates store tick for the real time update.

Display CCY hierarchy

A display currency analysis hierarchy is also provided to select the display currency used for the counterCcy parameter. For a description, see FxHierarchy.