Real Time Finance is a simple websocket public API to get real-time stock prices. The following markets are available at the moment :
- Forex
- US and European stocks companies (around 10K stocks)
npm install ws
Use stock symbol to receive datas. In this example we use EURUSD (forex), GBPUSD (forex), AAPL (apple - nasdaq), MSFT (microsoft - nasdaq) and MC.PA (lvmh - cac40)
const WebSocket = require('ws');
const ws = new WebSocket("wss://api.realtimefinance.io", {
rejectUnauthorized: false // use only if you are behind a firewall
});
const message = {
event: "subscribe",
data: ['EURUSD','GBPUSD','AAPL','MSFT','MC.PA']
};
ws.on("open", function open() {
ws.send(JSON.stringify(message));
});
ws.on("message", function incoming(data) {
console.log(data);
});
Here after you can find JSON list with symbols :
Further infos: https://realtimefinance.io