GithubHelp home page GithubHelp logo

fixer's Introduction

Fixer.io API Client

This project provides a Java client for the Fixer.io API.

Contribution

The extent to which this implementation covers the Fixer.io API is driven by our immediate needs:

  • Supported Symbols Endpoint
  • Latest Rates Endpoint
  • Historical Rates Endpoint
  • Specify Symbols
  • Changing Base Currency
  • Convert Endpoint
  • Time-Series Endpoint
  • Fluctuation Endpoint

As can be seen from the above, this project is not completed in terms of the API coverage. In addition, error handling can be improved and tests extended. Hence, outside contributors are most welcome and we are happy to review your suggestions in the form of a pull request.

Setup

Gradle dependency:

implementation 'com.aaaccell:fixer:VERSION'

or Maven dependency:

<dependency>
  <groupId>com.aaaccell</groupId>
  <artifactId>fixer</artifactId>
  <version>VERSION</version>
</dependency>

Usage

It is recommended to use the FixerRequestBuilder to form requests:

FixerRequestBuilder builder = builder("API_KEY");

Supported Symbols Endpoint

SymbolsResponse response = builder
    .symbols()
    .call();

Convert Endpoint

ConvertResponse response = builder
    .convert()
    .withDate(LocalDate.parse("2019-01-01"))
    .withAmount(BigDecimal.valueOf(1))
    .fromCurrency("CHF")
    .toCurrency("EUR")
    .call();

Time-Series Endpoint

TimeSeriesResponse response = builder
    .timeSeries()
    .withBase("CHF")
    .forSymbols("EUR", "USD")
    .withStartDate("2012-05-01")
    .withEndDate("2012-05-05")
    .call();

Time-Series Endpoint (segmented)

Given the fact that the fixer.io API only allows to retrieve a time-series for a maximum period of 1 year, we provide a request segmentation such that multiple 1-year periods are requested concurrently and their responses combined into a single response.

In this example a total of 3 requests are submitted.

TimeSeriesResponse r = builder
    .timeSeries()
    .withBase("CHF")
    .forSymbols("EUR", "USD")
    .withStartDate("2012-05-01")
    .withEndDate("2014-05-05")
    .call();

Additional examples

Can be found under tests.

Tests

Note that an API key is to be provided either by setting the environment variable FIXER_API_KEY or the JVM parameter fixerApiKey.

./gradlew check

fixer's People

Contributors

mjuchli avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.