WebSocket price feed
One WebSocket connection streams ticks for the symbols you subscribe to, as the broker’s MT5 server publishes them.
- Subscribe and unsubscribe by symbol at any time
- Each tick carries bid, ask and broker-server time
- Connection limits per plan, shown below
Subscribe to three symbols
// Server-side: keep the key out of browser code.
const ws = new WebSocket('wss://pricefeedpro.com/ws/v1/stream?api_key=' + process.env.PFP_API_KEY);
ws.onopen = () => ws.send(JSON.stringify({ action: 'subscribe', symbols: ["EURUSD","XAUUSD","BTCUSD"] }));
ws.onmessage = (e) => {
const msg = JSON.parse(e.data);
if (msg.type === 'tick') console.log(msg.symbol, msg.bid, msg.ask, msg.time);
};Plan limits (live from the API)
| Plan | Price / month | Symbols | Requests / min | WebSocket connections |
|---|---|---|---|---|
| free | Free | 3 | 60 | 5 |
| basic | $29.99 | 20 | 60 | 20 |
| pro | $99.99 | 100 | 300 | 50 |
| enterprise | $299.99 | Unlimited | 9,999 | 100 |
Source: a broker’s live MT5 server. Prices are broker quotes, not an exchange consolidated feed.