GithubHelp home page GithubHelp logo

forex-proxy's Introduction

ForexProxy

A web service that acts as a proxy to the real foreign exchange service, one-frame.

Running the service

Using docker

docker-compose up

Using Maven wrapper

From the project root run the following command

./mvnw spring-boot:run

In a new terminal window/tab, run one-frame using docker

docker run -p 8085:8080 paidyinc/one-frame

Usage

GET /rates

Get the latest currency rates.

Resource URL

http://localhost:8080/rates?pair={currency_pair_0}&pair={currency_pair_1}&...pair={currency_pair_n}

Parameters

  • pair - Required query parameter that is the concatenation of two different currency codes, e.g. USDJPY. One or more pairs per request are allowed.

Example request

Using a browser or any REST client.

http://localhost:8080/rates?pair=USDJPY

Example response

[
  {
    "from": "USD",
    "to": "JPY",
    "bid": 0.5098366425706436,
    "ask": 0.13104034760723204,
    "price": 0.32043849508893785,
    "time_stamp": "2022-09-10T06:31:01.002Z"
  }
]

Limitations

one-frame can only accept 1000 requests per day. To alleviate this issue, ForexProxy will cache each requested currency pair. When a 429 (Too Many Requests) is returned by one-frame or any error for that matter, ForexProxy will try to get that currency pair from the cache.

This however is not foolproof. If a currency pair is requested and one-frame returns an error and the pair does not exist in cache, then an error will be returned to the user.

To make ForexProxy more resilient, there needs to be a background worker that would build all the combinations of all currency pairs and store them in cache.
However due to time, this is not implemented.

Tests

To run the tests, from the project root run the following command

./mvnw test

forex-proxy's People

Watchers

Herry Kurniawan 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.