Skip to content

figield/currencyConverter

Repository files navigation

Currency Converter Service

Challenge

Java REST application for the currency conversion.

Task with "CLIENT" described functionalities/Use Cases is :

Using https://exchangeratesapi.io/ API as source of data create Exchange Rate Service that will offer following functionality:

  • Will allow a South African Republic national to check how much he has to pay for INPUT amount of Norwegian Krone

  • Allow an American to Calculate average price of Brazilian Real between 12/24/2017 and 12/27/2017

  • Will display currency with highest stability in price quoted against Croatian Kuna for GIVEN period

Assumptions :

Current exchange rates served by exchangeratesapi.io are changed every 60 seconds

https://exchangeratesapi.io/ can serve up to 100 requests per second and your service needs to serve up to a 1000

You have up to 5 machines you can use to run necessary systems

Historical data doesn’t change

In your current setup you don’t have ability to create a persistent storage

Prerequisites and Solution

  • Code: Java 8, Spring Boot, Spring Web Framework, Gradle
  • Cache: Ehcache
  • Functional tests: Spock, Groovy, Spring Mock MVC
  • Algorithm used to calculate the highest stability in price: Standard Deviation
  • Deployed: AWS (Maybe it is still here)
  • Performance tests: LOCUST and custom tests in Python
  • Solution time: 3 days

Running application locally

  • use gradle: ./gradlew bootJar (or use already prepared currencyExchangeService-0.1.1.jar)
  • java -jar build/libs/currencyExchangeService-0.1.1.jar

Requests examples ready to play with on localhost

Running performance tests

  • use Python and pip3 to install Flask and Locustio
  • run dedicated script in performance directory: ./performance/run_tests.py

Number of users Response times Total requests per second

Table with LOCUST performance results summary

Load tests results

What left?

  • More tests - unit and functional tests
  • Code refactoring

About

Java REST application for currency conversion

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors