ICOnator / ICOnator-backend

ICOnator backend applications and commons
Apache License 2.0
26 stars 1 forks source link

Rates add REST Endpoint request exchange rates #14

Open kabl opened 6 years ago

kabl commented 6 years ago

Why communicate with the Rates over a Queue? I guess if you request a FX Rate you expect to receive the response immediately. A blocking HTTP GET gives you that feature. In addition HTTP interfaces are more easy to integrate.

Add a REST interface to request FX rates for a specific time. Always work with UTC time in request and response.

Example:

GET https://HOST/api/fx/time?time=2018-05-02T13:51:45Z

{"id":82,"utcTime":"2018-05-02T13:51:19Z","btcUsd":9068.6,"ethUsd":673.01,"btcChf":9028.6982,"ethChf":670.0488,"btcEur":7549.6095,"ethEur":560.2808}
gsmachado commented 6 years ago

Hello @kabl

It's a good idea providing a REST API interface to fetch rates of different cryptocurrencies or fiat currencies. Such interface can provide an easier way for operators to fetch rates. I added a "feature" label to further develop it. Thanks.

However, I think you totally overlooked the code since we are not using (yet) amqp in the whole rates application! Thus, the question "Why communicate with the Rates over a Queue?" does hold true at the present moment, at all. But, we are planning to use it.

So, related to the previous paragraph: Your statement "In addition HTTP interfaces are easier to integrate" is indeed true. But, this project aims not to provide the easiest or the fastest way to integrate to our interfaces. We aim to be reliable. One of the backbone parts of the ICOnator project is the AMQP 0.9.1 protocol, in which we add events which should be processed by consumers. We believe that this is a more scalable approach -- without relying on HTTP load balancers, but relying on a queue broker server.

Thanks once again!