Skip to content

Commit 00d37cc

Browse files
committed
Readme
1 parent c2643d0 commit 00d37cc

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed

README.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Fixer.io API Client
2+
3+
This project provides a client to the [Fixer.io](https://fixer.io/) API.
4+
5+
## Contribution
6+
7+
The extent to which this implementation covers the Fixer.io API is driven by our immediate needs:
8+
9+
- [x] Supported Symbols Endpoint
10+
- [ ] Latest Rates Endpoint
11+
- [ ] Historical Rates Endpoint
12+
- [ ] Specify Symbols
13+
- [ ] Changing Base Currency
14+
- [x] Convert Endpoint
15+
- [x] Time-Series Endpoint
16+
- [ ] Fluctuation Endpoint
17+
18+
As can be seen from the above, this project is not completed in terms of the API coverage.
19+
In addition, error handling can be improved and tests extended.
20+
Hence, outside contributors are most welcome and we are happy to review your suggestions in the form of a pull request.
21+
22+
## Setup
23+
24+
**Gradle dependency:**
25+
26+
```
27+
implementation 'com.aaaccell:fixer:VERSION'
28+
```
29+
30+
or **Maven dependency:**
31+
32+
```
33+
<dependency>
34+
<groupId>com.aaaccell</groupId>
35+
<artifactId>fixer</artifactId>
36+
<version>VERSION</version>
37+
</dependency>
38+
```
39+
40+
## Tests
41+
42+
Note that an API key is to be provided either by setting the environment variable `FIXER_API_KEY` or the JVM parameter `fixerApiKey`.
43+
44+
```
45+
./gradlew check
46+
```
47+
48+
## Usage
49+
50+
It is recommended to use the **FixerRequestBuilder** to form requests:
51+
```
52+
FixerRequestBuilder builder = builder("API_KEY");
53+
```
54+
55+
**Supported Symbols Endpoint**
56+
```
57+
SymbolsResponse response = builder
58+
.symbols()
59+
.call();
60+
```
61+
62+
**Convert Endpoint**
63+
```
64+
ConvertResponse response = builder
65+
.convert()
66+
.withDate(LocalDate.parse("2019-01-01"))
67+
.withAmount(BigDecimal.valueOf(1))
68+
.fromCurrency("CHF")
69+
.toCurrency("EUR")
70+
.call();
71+
```
72+
73+
**Time-Series Endpoint**
74+
75+
```
76+
TimeSeriesResponse response = builder
77+
.timeSeries()
78+
.withBase("CHF")
79+
.forSymbols("EUR", "USD")
80+
.withStartDate("2012-05-01")
81+
.withEndDate("2012-05-05")
82+
.call();
83+
```
84+
85+
**Time-Series Endpoint (segmented)**
86+
87+
Given the fact that the fixer.io API only allows to retrieve a time-series for a maximum period of 1 year,
88+
we provide a request segmentation such that multiple 1-year periods are requested concurrently and their responses combined into a single response.
89+
90+
In this example a total of 3 requests are submitted.
91+
92+
```
93+
TimeSeriesResponse r = builder
94+
.timeSeries()
95+
.withBase("CHF")
96+
.forSymbols("EUR", "USD")
97+
.withStartDate("2012-05-01")
98+
.withEndDate("2014-05-05")
99+
.call();
100+
```
101+
102+
Additional examples can be found in the [tests](https://github.com/aaaccell/fixer/tree/master/src/test/java/com/aaaccell/fixer).

0 commit comments

Comments
 (0)