Giter Site home page Giter Site logo

interview's Introduction

Solution to the Paidy take home exercise

Assumptions regarding the requirements

  • Tokens are like api keys, meaning they do not expire and don't need to be refreshed. We can then store them in an environment variable.
  • The test token is safe to embed in code, for example to write some tests against the OneFrame API.
  • Only currencies provided in Currency.scala are supported (even if OneFrame supports more).
  • Rates from OneFrame come up-to-date, meaning we can cache them for 5 minutes and not break the 5 minutes requirement.

Caching

Description

In order to help fulfill 10,000 requests for a single token we are going to use a Redis cache to store the results from OneFrame. We will expire keys after 5 minutes to make sure rates stay up-to-date (at most 5 minutes old).

We will fetch all pairs in one single OneFrame request in order to minimize the impact on the quota.

Analysis

We have 9 supported currencies. If we optimize the case where from and to currencies are equal, this means there are 9 * 8 = 72 possible pairs. So our Redis cache will contain that number of entries.

Assuming we fetch every 5 minutes, and noting that a day has 1440 minutes, we will need 1440 / 5 = 288 requests to OneFrame per day, which does not exceed the quota.

Running the application

In order to run the application, execute the following commands:

cd forex-mtl

sudo chmod +x run.sh

./run.sh

Running the tests

To run the tests, execute:

cd forex-mtl

sudo chmod +x test.sh

./test.sh

interview's People

Contributors

leusgalvan avatar pjan avatar kitsuneninetails avatar irving-santiago avatar hakimatpaidy avatar agutteridge avatar abalonperin avatar cchantep avatar filippo-diotalevi-paidy avatar gvolpe avatar paulroseau avatar ikorn avatar

Watchers

James Cloos 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.