Why High-frequency trading Systems use PTP instead of NTP?

Takaaki Kurihara
4 min readJun 8, 2021

--

Photo by Adora Goodenough on Unsplash

Introduction

Time is important in the trading system. Because, without the correct time, accurate analysis is not possible. Time is even more important in HFT. HFT makes high-frequency trading in a short time. It’s a world of 1 microsecond, and 1 nanosecond, not 1 millisecond.

Unit of time

Let’s review the unit of time before talking about NTP and PTP.

  • Seconds (s)
  • Milliseconds (ms)
  • Microseconds (µs)
  • Nanoseconds (ns)
1 s   = 1,000 ms  = 1,000,000 µs = 1,000,000,000 ns
0.1 s = 100 ms = 100,000 µs = 100,000,000 ns
0.01 s = 10 ms = 10,000 µs = 10,000,000 ns
0.001 s = 1 ms = 1,000 µs = 1,000,000 ns
0.0001 s = 0.1 ms = 100 µs = 100,000 ns
0.00001 s = 0.01 ms = 10 µs = 10,000 ns
0.000001 s = 0.001 ms = 1 µs = 1,000 ns
  • For 1 second and 10 seconds, 1 second is 10 times faster.
  • For 1ms and 10ms, 1ms is 10 times faster.
  • For 1 microsecond and 10 microseconds, 1 microsecond is 10 times faster

What is NTP?

NTP is used for many time synchronizations and has the following features:

  • NTP stands for Network Time Protocol.
  • The goal is to achieve synchronization accuracy of a few milliseconds.
  • Sync your device over the internet
  • There is a leap second

leap second

If the rotation of the earth continues to be slow or fast, the time difference between the time determined by the rotation of the earth and the time determined by the atomic clock will increase. In such a case, “leap second” is implemented to correct the time lag.

X : 59 : 58
X : 59 : 59
X : 59 : 60 <- leap second
X : 00 : 00
X : 00 : 01

Announced leap seconds to date

2016  Dec 31   +1
2015 Jun 30 +1
2012 Jun 30 +1
2008 Dec 31 +1
2005 Dec 31 +1
1998 Dec 31 +1
1997 Jun 30 +1
1995 Dec 31 +1
1994 Jun 30 +1
1993 Jun 30 +1
(snip)

What is PTP?

PTP is used in environments that require time accuracy, such as trading systems, and has the following features:

  • PTP stands for Precision Time Protocol.
  • Achieved synchronization accuracy in sub-milliseconds, assuming use within a LAN
  • Requires PTP switch(BC mode is generally required)
  • Physical server NIC for hardware synchronization. A virtual guest operating system is not available due to PTP hardware synchronization

PTP Hardware time stamp and Software time stamp

Hardware time stamp:
PTP synchronizes the system with an accuracy of tens of minutes within a millisecond. When using PTP, it’s usually a hardware timestamp. It requires hardware such as NIC.

Software time stamp:
PTP synchronizes system with accuracy within tens of milliseconds. This is a way to sync without dedicated hardware.

How to use PTP

PTP is not available in the cloud like AWS, GCP or Azure. You need a bare metal server in your data center. There are two ways to use the services of the data center and to set up a Grand Master.

(1)Use the PTP service of the data center

Equinix Precision Time
https://docs.equinix.com/en-us/Content/Edge-Services/EPT/EPT.htm

(2)Set up a GPS for the data center and set up a GrandMaster

GrandMaster is a time server for PTP. By installing GrandMaster in the rack, you can use 1PPS and 10MHz OutPut. Then you can use the oscilloscope to calculate the time.

Time synchronization comparison

Time synchronization comparison

Clock synchronization under MIFID II

MiFID stands for Markets in Financial Instruments Directive II. MiFID II came into effect in January 2018. This is a comprehensive regulation of the European Union’s financial and capital markets. The time accuracy requirements for the trading system have been determined.

  • Time reference: Synchronized with UTC (Coordinated Universal Time)
  • Time accuracy (offset from UTC): Within 100 μsec (in the case of high-frequency algorithmic trading)
  • Time particle size (time display digit): 1 μsec or more (in the case of high-frequency algorithmic trading)

http://www.edmae.org/wp-content/uploads/2017/01/EDMA-Briefing-doc-on-MiFID-II-clock-sync-Nov-2016.pdf

Conclusion

For high-frequency trading, MIFID also determines. And PTP is essential for accurate analysis.

References

--

--