Latest Endpoint - lico/jFixer GitHub Wiki
The most basic usage is the following:
FixerApiLoader fixerApiLoader = (baseUrl, accessKey, baseCurrency);
List<ExchangeRate> rates = fixerApiLoader.getLatest();
You can narrow down the list of currencies you want to get by providing a comma separated string:
List<ExchangeRate> rates = fixerApiLoader.getLatest("USD,JPY,CAD");
Or you can use a List:
List<String> symList = Arrays.asList(new String[] {"CHF", "JPY"});
List<ExchangeRate> rates = fixerApiLoader.getLatest(arrayListOfCurrencies);
If symbols is null or emtpy, the method returns all supported currencies.
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 all supported currencies and for the default base currency
List<ExchangeRate> rates = fixerApiLoader.getLatest();
// Get latest rates for the provided list of supported currencies and for the default base currency
List<ExchangeRate> rates = fixerApiLoader.getLatest(List<String> listOfCurrencies);
// Get latest rates for the provided comma separated string of supported currencies and for the default base currency
List<ExchangeRate> rates = fixerApiLoader.getLatest(String stringOfCurrencies);
// Get latest rates for the provided list of supported currencies and for the provided base currency
List<ExchangeRate> rates = fixerApiLoader.getLatest(List<String> listOfCurrencies, String baseCurrency);
// Get latest rates for the provided comma separated string of supported currencies and for the provided base currency
List<ExchangeRate> rates = fixerApiLoader.getLatest(String stringOfCurrencies, String baseCurrency);