A script that asks a broker for the current price every second through a REST request gets a snapshot that is, on average, half a second old before any network delay. Add the request round trip, and the price in hand can be a full second behind the market.
A WebSocket connection works differently. The server pushes each update as it happens over a connection that stays open. The delay shrinks to little more than the network travel time.
For anyone building a tool that reacts to price, that difference is large. A spread logger can survive on polling. An entry trigger cannot.
Several details trip people up. Some brokers throttle the update rate on streaming feeds, so the stream isn't every tick. Some drop connections after a period and the script must reconnect cleanly. Some send heartbeats that need answers.
Worth testing is the gap between the streamed price and the platform's own price at the same instant. Differences of a few hundred milliseconds are common, and they matter.
Has switching from polling to streaming changed the quality of a script's decisions?
WebSockets versus REST polling: the price feed that is always a little old
-
Shadow Trader
- Posts: 5438
- Joined: Wed Sep 09, 2026 5:19 pm