Menu

Live Odds API in Node.js: Build a WebSocket Odds Tracker
📰

Live Odds API in Node.js: Build a WebSocket Odds Tracker

DEV Community: node·Markus·5 days ago
#IAfflhFP
#devtonodejs#devto#dev#const#odds
Reading 0:00
15s threshold

This guide builds a small Node.js script that follows in-play odds for one football league over a WebSocket. It keeps the latest match-winner price from every bookmaker in memory, prints a line whenever the best price for home, draw or away changes, and after a disconnect it resumes from where it stopped, so the table stays current.

It is about 230 lines and uses the official Node.js SDK plus ws . If you are still deciding between polling and streaming, read Live Odds API: Polling vs WebSocket Streaming first. For the same ideas in Python, see the client in Odds Feed API: How It Works and How to Pick a Provider .

What the tracker does

Lists the live matches in the league over REST.

Takes a REST snapshot of their odds, together with the stream position that snapshot matches.

Opens the WebSocket from that position, filtered to one league, live matches only and one market.

Replaces the stored prices for a match and bookmaker on every update, and prints the best price per outcome when it moves.

Reconnects…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.