Historical Endpoint - lico/jFixer GitHub Wiki
The most basic usage is the following:
FixerApiLoader fixerApiLoader = (baseUrl, accessKey, baseCurrency);
List<ExchangeRate> rates = fixerApiLoader.getHistorical("2018-07-22", "CHF,JPY");
where:
- date can be a LocalDate or a string object (in format yyyy-MM-dd in this later case)
- symbols is a comma separated string (eg: "CHF,JPY") or a list of currency symbols. If symbols is null or emtpy, the method returns all supported currencies.
A FixerException is thrown in case the date is invalid.
The API returns a list of ExchangeRate object which basically contain a few methods:
rate.getBaseCurrency(); // the base currency, eg: EUR
rate.getTargetCurrency(); // the target currency, eg: JPY
rate.getRate(); // a double value of the rate, eg: 1.3547
rate.getDate(); // the date of the exchange rate in the format, yyyy-MM-dd, eg: 2018-07-22
rate.getTimestamp(); // a LocalDateTime object that holds the timestamp returned by Fixer.io, that is the date of execution
Below are all methods for the Endpoint Latest:
// Get latest rates for the specified date, all supported currencies and the default base currency
List<ExchangeRate> rates = fixerApiLoader.getHistorical(String date);
// Get latest rates for the specified date, the specified string of supported currencies and the default base currency
List<ExchangeRate> rates = fixerApiLoader.getHistorical(String date, String stringOfCurrencies);
// Get latest rates for the specified date, the specified string of supported currencies and the specified base currency
List<ExchangeRate> rates = fixerApiLoader.getHistorical(String date, String stringOfCurrencies, String baseCurrency);
// Get latest rates for the specified date, all supported currencies and the default base currency
List<ExchangeRate> rates = fixerApiLoader.getHistorical(LocalDate date);
// Get latest rates for the specified date, the specified list of supported currencies and the default base currency
List<ExchangeRate> rates = fixerApiLoader.getHistorical(LocalDate date, List<String> listOfCurrencies);
// Get latest rates for the specified date, the specified list of supported currencies and the specified base currency
List<ExchangeRate> rates = fixerApiLoader.getHistorical(LocalDate date, List<String> listOfCurrencies, String baseCurrency);