Today, we will discuss a topic that you may not have previously considered: the significance of maintaining proper synchronization of your operating system’s clock. But what relevance does the clock on my computer have to my trading activities? Quite a bit… let us explore this further.
Let us assume that I am trading a mini NASDAQ futures contract (NQ) at the Chicago Mercantile Exchange (CME). This asset is generally more volatile than a mini S&P 500 contract (ES). It is not uncommon to observe fluctuations of 20 points in less than one second, which equates to $400.
Now, let us contemplate the journey of data from the moment a transaction is recorded at the Chicago Exchange until it reaches your trading platform on your computer or at the VPS you rent. The data is timestamped at the CME with microsecond precision (and it is possible that soon we will be discussing nanoseconds).
The CME invests significantly to ensure that it accurately records the timing of trades, as this is of utmost importance. Various protocols exist to ensure that the servers within a network maintain synchronized time. One such protocol is the Network Time Protocol (NTP). This protocol facilitates a global synchronization system that originates from atomic clocks, extends to servers linked to those clocks, and further to additional servers connected to those primary servers. The Sonar project has estimated that there are currently approximately 1.5 million NTP servers in operation. Your operating system attempts to synchronize its time with one of these NTP servers. Below, you will find an illustrative figure depicting the stratification of NTP servers.
Returning to the topic, in order for you to see data regarding a transaction executed at the CME on your platform, a Market Data server receives this information from the exchange and propagates it to your platform over the internet. This transmission takes time to reach your computer and is influenced by numerous factors, including your local connection, the structure of your network, internet traffic, and so forth. How could you determine the latency with which you receive this information? This is an important question, as we aim to understand our minimum reaction time to market movements!
The answer is straightforward: take the time from your PC and subtract it from the timestamp recorded for the transaction you are observing at the CME. If your local clock is synchronized with the CME clock, you will know the latency of your Market Data. Do you understand? In practice, you are reacting to the “NOW” that occurred a few milliseconds ago. But how many milliseconds?
You can be assured that the CME’s time is synchronized with an error of only a few microseconds relative to an atomic clock (the first level in the figure above). However, is your PC’s clock precise enough to allow you to perform this simple subtraction accurately?
The answer is no! However, I will teach you how to keep your PC’s clock synchronized so that you can measure the latency of your Market Data effectively!
Synchronizing Your PC's Clock
I have some news for you: the hardware in your PC is not as reliable as you might think. Its clock has very low precision. This is generally not an issue for most everyday applications of an operating system running low-criticality local applications.
However, over the course of a day, you may accumulate several milliseconds of delay, which can add up to seconds over just a few days. These delays can continue to accumulate over time, potentially reaching minutes or more.
Fortunately, the operating system includes a service that queries an NTP server, which is synchronized with UTC (Coordinated Universal Time), and updates your PC’s clock accordingly!
Would you like to learn how to synchronize your clock? I will bypass the section on how to do this in a basic manner (as most people do, but not you, the trader!), since that method is insufficient for accurately synchronizing your local time.
Let us proceed directly to the demonstration on how you should effectively maintain synchronization of your clock.
Synchronizing Your Clock with Greater Precision (NetTime Service)
In the United States, the NIST (National Institute of Standards and Technology) provides resources related to time synchronization. On their website, there is a comprehensive list of links to companies and software that offer synchronization services.
Most of these options are commercial products from various companies; however, there are also some generous individuals who provide free compiled programs that comply with the NTP standard and implement synchronization algorithms.
One such option is NetTime, originally developed by Graham Mainwaring in 1997 and currently maintained by Mark Griffiths (www.timesynctool.com).
To use it, simply download the compiled file (exe, stable version) and execute it. This will install a service on your machine that runs continuously and periodically synchronizes your clock.
With this setup, your clock will be synchronized with an accuracy of just a few milliseconds relative to the UTC standard!
Accessing and Configuring NetTime
- In the status bar of your Windows system, you will see a yellow clock icon representing the NetTime program. When you hover your mouse over the icon, you will see the date/time when your clock was last synchronized
- Click on the NetTime icon, and you will be able to view the program’s panel. There, you can enable or disable the synchronization service and access the program’s settings.
- By clicking on “Settings,” you will be directed to the configuration screen, where you can define the update interval for your clock with the servers listed in the table. In my case, I have set the update to occur every 15 minutes.
Measuring Market Data Latency with LagMeter
Now we can accurately measure the latency of the Market Data we use! At NeoTraderBot, we have developed a free indicator called LagMeter, which enables you to check the latency of your Market Data. Simply click the button below to be redirected to the download page.
If you are still curious about the origins of latency, feel free to watch the video below.