다시 되돌아보는 레이턴시

1.
2012년에 쓰려고 초안을 잡았던 글입니다. 원문을 구하면 정리를 끝내려고 했지만 힘드네요.그래서 간단히 마무리합니다.

GreySpark라는 연구소가 2012년 Low Latency: Faster than Light라는 제목으로 보고서를 내었습니다. 제목만을 놓고 보면 Latency와 관련된 모든 주제를 다루고 있습니다.  본문을 구할 수 있으면 좋지만 대부분 해외조사기관 자료와 마찬가지로 비싼 돈을 주고 사야 합니다.

Low-Latency: Faster than Light – Table of Contents

1. A Brief History of [Elapsed] Time
1.1 What is Latency?
1.1.1 Latency is End-to-End
1.1.2 Latency is More than One Number
1.1.3 Latency is Always Relative
1.2 Where is Latency Created?
1.2.1 Network Latency
1.2.2 Software Components and Application Latency
1.3 Why do we Care? – The Impact of Latency on Electronic Trading
2. Coping with the Need for Speed
2.1 Equities, Futures and Options
2.2 Fixed Income
2.3 Foreign Exchange
3. Measuring Latency
3.1 What to Measure?
3.1.1 Business Measures
3.1.2 Technical Measures
3.2 How to Measure?
3.2.1 Measurement Techniques
3.2.2 Clock Synchronisation
3.3 Instrumentation
4. Latency Reduction Strategies
4.1 Reducing Latency in Applications
4.2 Reducing Latency in the Infrastructure
4.3 Reducing Latency at the Location
4.4 Evaluation of Strategies to Reduce Latency

2.
보고서의 내용은 알 수 없지만 Latency in Electronic Trading를 토대로 몇가지를 소개합니다.

먼저 latency의 정의입니다.(What is Latency?) Latency는  어떤 행위를 처리하는데 걸린 시간입니다. 아니면 시차라고 해도 무방합니다. 다만 일반적인 의미로 레이턴시를 사용하지 않고 자본시장의 트레이딩을 놓고 사용하기때문에 트레이딩의 특징을 반영하여야 합니다. 자본시장에서 레이턴시란 매매를 위한 의사결정을 한 후 매매정보가 시장에 접수되어 결과를 받을 때까지 걸리는 시간이라고 할 수 있습니다. 원문에서는 “the total elapsed time between the event, or signal, triggering a trading decision and the actual completion of that trading action”이라고 했습니다.

흔히 ‘Latency is End-to-End’라는 표현을 자주 사용합니다. 어떤 뜻일까요? 레이턴시는 어떤 것이 시작해서 끝날 때까지 걸린 시간입니다. 무엇의 레이턴시를 이야기하느냐에 따라 기준이 달라집니다. End-To-End도 시작과 끝을 기준으로 레이턴시를 이야기해야 한다는 뜻입니다.예를 들어 네트워크카드가 있다고 합니다. 네트워크카드의 레이턴시를 어떻게 측정할까요? 가장 기본적인 방법이 End-To-End Latency로써 패킷을 받아서 데이타로 변화하여 OS(Application)으로 넘기는 시간입니다. Input의 시작과 Output의 끝이 기준입니다. 이를 트레이딩에 적용하면 트레이더가 시작이고  끝은 전자화된 거래소입니다. 여기서 더 연장하면 끝은 바로 시작점인 트레이더입니다. 트레이더-거래소 혹은 트레이더-거래소-트레이더사이의 레이턴시를 다루어야 합니다. 그래서 단순히 네트워크 레이턴시가 아니라 하드웨어, 네트워크 및 어플리케이션까지를 모두 포괄하는 레이턴시가 대상입니다. 위의 기사에서 이를 다음과 같이 설명합니다.

Latency manifests itself in the four main steps of the trading flow:

1. The retrieval and propagation of events occurring on the markets or the exchanges.
2. The identification and transmission of the derived trading signals, upon which trading decisions will be based.
3. The decision-making algorithm or the pricing process, depending on the type of instrument traded.

The management and transmission of orders and quotes, which result from either the pricing or trading algorithm until the point of execution.

다음은 ‘Latency is not one number’라는 문장입니다. 통계라고 이야기합니다. 그렇다고 통계적인 의미가 같다고 하여 품질이 동일하지 않습니다. jitter때문입니다. 매매에 직접적인 영향을 주는 것이 바로 Jitter이기 때문입니다. 또하나 latency는 절대적이지 않습니다. 상대적입니다. Low라는 표현 자체가 상대적입니다. 시장내의 경쟁자와 비교하여 상대적으로 낮은 것이 중요합니다.

Latency is More than One Number. Averages, medians, means, minima and maxima are useful indicators of latency; however, they hide a significant part of the actual nature of a phenomenon. The most crucial element in accounting for latency is jitter i.e. the distribution of latency when measured repeatedly. Jitter highlights the fluctuations in performance from the mean; the smaller the deviation the more predictable and reliable the performance.

Latency is More than One Number. Business requirements for low latency are not absolute but relative quantities based on the speed of the competition. When carrying out aggressive arbitrage activities firms need to be faster than everyone else in order to be the first to cash in on marketplace price discrepancies. For market-makers the objective is to be quick enough in order to be safe from the same arbitrageurs; and the goal posts keep moving. For agency businesses, on the other hand, it is enough to be at the same speed as everyone else.

그러면 매매흐름속에서 Latency가 발생한 부분은 어디일까요? 레이턴시가 발생하는 영역을 세가지 범주로 나눌 수 있습니다.

1. The network layer – propagation, serialisation, network protocols and related network devices (switches, routers and firewalls).
2. The middleware layer – messaging, market data distribution, FIX and proprietary protocols.
3. The application layer – event processing, trading algorithms, pricing, transaction management.

이중에서 소프트웨어 엔지니어가 관심을 가져야 할 영역은 Messaging Layer와 Application Layer입니다. Messaging Layer가 관계하는 핵심 부분은 시세입니다. 물론 KRX가 독점하는 시장와 몇 십개의 거래소로 나뉜 시장을 같은 수준으로 이야기할 수 없습니다. 해외시장의 경우 받아야 하는 시세가 복수이기때문에 Messaging Layer의 중요성은 국내보다 훨씬 높습니다.

Message oriented middleware in general, and market data distribution in particular, used to be a major source of latency. Over the past five years, however, we have witnessed significant improvements in the technology, offering a wider spectrum of trade-offs between performance and flexibility.

However, one the most important architecture element in the search for the lowest possible latency remains the optimisation of the information flow throughout the various software components on the trading chain. This is where over-engineering and abusive use of message oriented middleware impact the performance of electronic trading platforms.

트레이더가 관심을 가져야 할 부분은 Application Layer입니다. 매매에 직접적으로 관계하는 영역이기때문이니다. 시세처리, 시세가공 및 분석, 의사결정, 매매시그날, 위험관리(자금관리)가 이루어집니다.

Algorithmic, pricing and transaction management applications tend to be the greatest source of latency. This is where trading firms should initially concentrate their research and development budget. It is also where the biggest variations appear. When designing an application, financial institutions need to consider the relative value of in-house builds versus off-the-shelf purchases or a combination of both.

그러면 Latency를 줄이기 위해 어떤 노력을 들이는 것이 효율적일까요? 보고서에 실린 도표입니다.

greyspark2

3.
KRX의 Exture+가 3월 3일 가동을 시작합니다. 동기식 접속에서 비동기식 접속으로 통신방식을 변경하였습니다. 이런 변화가 Latency에 어떤 영향을 미칠까요? Exture보다 증권사간 차이가 넓어지는 방향으로 작용하지 않을까요?

Leave a Comment

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.