FX rates loader

The FX rates loader is used to load FX rates into the system. It is one of a number of loaders included in Strata.

Loader

FX rates can be loaded using the FxRatesCsvLoader

ResourceLocator locator = ResourceLocator.ofFile(filename);
Map<FxRateId, FxRate> fxRates = FxRatesCsvLoader.load(valuationDate, locator);

Format

The FX rates file is a simple CSV-formatted file with the following header row:

Valuation Date,Currency Pair,Value

The columns may be specified in any order, however this is the recommended order. The meaning of each column is as follows:

Field Description
Valuation Date The valuation date to which the rate corresponds, in the format yyyy-MM-dd.
Currency Pair The currency pair, in the format “EUR/USD”.
Value The numeric FX rate.

Example

This example file specifies two FX rates on two different dates.

Valuation Date, Currency Pair, Value
2016-01-22,     EUR/USD,       1.11
2016-01-22,     GBP/USD,       1.31
2016-01-23,     EUR/USD,       1.12
2016-01-23,     GBP/USD,       1.32

Note that Microsoft Excel prefers the CSV file to have no spaces after the comma.