This is backend application that provides three endpoints. It uses API from NBP.
way 1 - run it with Java
- Download release
- Run it with:
java -jar simple.currency.rate.api-0.0.1-SNAPSHOT.jar
way 2 - run it with Docker
- Pull my docker image:
docker pull osik2000/simple-currency-rate-api
- Run it with:
docker run -p 8080:8080 -d osik2000/simple-currency-rate-api
- Given a date (formatted YYYY-MM-DD) and a currency code (list: https://nbp.pl/en/statistic-and-financial-reporting/rates/table-a/), provide its average exchange rate.
- Given a currency code and the number of last quotations N (N <= 255), provide the max and min average value (every day has a different average).
- Given a currency code and the number of last quotations N (N <= 255), provide the major difference between the buy and ask rate (every day has different rates).
run app with Java/Docker
java -jar simple.currency.rate.api-0.0.1-SNAPSHOT.jar
or
docker run -p 8080:8080 -d osik2000/simple-currency-rate-api
Endpoints can be tested with
Postman app.
-
put
http://localhost:8080/exchanges/{CURRENCY_CODE}?date=YYYY-MM-DD
to postman (method GET) to get average exchange rate for specific date and currency. -
put
http://localhost:8080/extremum/{CURRENCY_CODE}?quotations={N<=255}
to postman (method GET) to get min and max rate for specific currency and last N quotations. -
put
http://localhost:8080/majordifference/{CURRENCY_CODE}?date=YYYY-MM-DD
to postman (method GET) to get major difference between the buy and ask rate for specific currency and last N quotations.
Here are some examples which presents uses of endpoints (you can test it with Postman).
http://localhost:8080/exchanges/gbp?date=2012-01-02
http://localhost:8080/extremum/gbp?quotations=5
http://localhost:8080/majordifference/GBP?quotations=5
This endpoints return exact data as NBP Api (Json)
example:
{
"table":"A",
"currency":"funt szterling",
"code":"GBP",
"rates":
[{"no":"1/A/NBP/2012","effectiveDate":"2012-01-02","mid":5.348}]
}