REST vs Streaming Forex APIs
Each of the two kinds of API provided by Live-Rates have their strengths and weaknesses. Know what is the best for you
Live-Rates provides two types of APIs, both of which share the same purpose of providing real-time low latency financial data to developers (forex, commodities, indexes, etc.).
By early 2019, the only available output used to be the REST API, but since then, the offer has been extended to also include the Streaming API in most subscription plans.
In this short article we will describe the main characteristics, strengths and weaknesses of both approaches.
Rest API
The REST API is very easy to use. Its implementation is always just an HTTP Get request, and can be used with virtually any technology stack that uses the Internet.
The cons of this approach are that a new request needs to be made every time the user wants / needs to fetch new data, which would cause extra bandwidth usage. In addition, some data may be lost between requests, as only one request can be made per second and data can be updated up to 3x per second.
The REST API is recommended for users who are looking for an easy implementation and who may lose price peaks.
Streaming API
The Streaming API (built with socket.io) can be accessed through any of the Node.js or PHP libraries.
The advantage of this approach is that only a single long-lasting connection is established with the server, and then the prices are sent automatically, saving many resources and bandwidth. Because the server always sends updated data to the client, there is no risk of losing peaks of currency between requests.
The Streaming API is recommended for advanced users who are looking for efficiency in their applications / solutions and can not lose a single PIP.
If you have doubts regarding what is the best approach for your case, contact our support center