Help Center Blog Open An Account

What is the difference between UDP and TCP internet protocols as it relates to CME


If a CME data provider says he uses UDP as oppose to TCO, what is the difference?


First, we need some background on the two protocols. TCP is a high overhead protocol. If a packet is lost, a message is sent back to the sender saying, “send it again”. We know when a packet is lost because they have a sequence number. The sender resends the lost packet. The receiver, or client, then has to rearrange the packets so they are in the right order for further processing.

This leads to a trade-off of good and bad properties. The good property is that you never miss any data, assuming both client and server (sender) can keep up with missed packets. The bad property is that you incur “latency”. If you have to send the packet again, you have to wait for it and hold up all the other packets that are now out of order.

UDP is a low overhead protocol. If a packet is lost, it is forgotten. No rearranging of packets is needed. No incurred latency as you don’t wait for any resends. Also, if a packet is not lost but is bad, you know this too because a “checksum” tells you it is bad. The checksum is a sum of all bytes in the packet and is sent along with every packet.

This also leads to a trade-off. The good property is that you never incur latency. You also never increase traffic that your connection can’t handle. The bad property is that you never know what you missed, other than its place in the stream of data. The sequence number of the next good packet will tell you how many you missed, but not their contents. So all you can do is what is called “interpolation”. This is a mathematical estimation of the lost values. If the bar close went from 2 to 4 in three minutes, and you lost a packet in the middle, you can estimate it closed at 3. In reality it may have gone 2, 2, 4. But 3 is your best guess as you have no idea what it really did, and that is mathematically close to the highest probability. (There are actually additional algorithms that are higher probability but its beyond the scope of this answer. This simple type of interpolation stated here is called bi-linear).

In summary then, how do you decide which is better? Unfortunately that is in the eye of the beholder. Once you know what is taking place you can start to decide what is better for your trading situation. But it also depends on factors such as expected packet loss, both from your ISP as well as the data provider. Some data providers also pre-filter the data so they send less data, but this can be done both for TCP and UDP setups. The providers don’t go out of their way to tell you about this, but it happens under the hood. You can always ask, and the ones that don’t pre-filter usually tell you all about it! It is their badge of honor and good marketing.

Assuming you are going across the internet, then if you receive tick data with a provider that is not pre-filtering, then UDP is probably better. That is if you are trading at minute or higher time-frame. In this case a missed tick is most likely not critical to your trading, and lower latency of UDP is a real advantage. Rithmic is a good non pre-filtered provider of market data.