Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

 

Homework #2

FE-570 F21

 

Problem 2.1.

The R package highfrequency contains several datasets of tick level trades and quotes prices (level 1 data).

For this problem we will load the datasets sampleQData and sampleTData which are cleaned versions of raw data quote and trade samples.  These are generic data microsecond level data sets of TAQ type (Trade and Quote).

We will use these data sets to get some practice working with tick level data.

1.  Combine the trade and quote data sets into one common data set, showing at each trade time also the bid and ask quotes.  This is done with the matchTradesQuotes function. Study and plot the resulting data for trade prices and quotes.

2.  Compute the fraction of trades taking place within the spread (pt  ∈ (bt , at )), and how many at the touch (pt  = bt  or pt  = at ).

3.  Determine the “trade direction” dt  of each trade, which shows if it is a buy (dt  = +1) or a sell (dt  = -1). There are two ways to do this:

i) In the absence of quote data, use the“tick test”.  This uses only the trade prices pt .  Under this test the trade is classified as buy/sell according to:

dt  = +1 (buy) if pt  > pt − 1  (uptick) or if pt  = pt − 1  > pt −2  (zero-uptick)

dt  = -1 (buy) if pt  < pt − 1  (downtick) or if pt  = pt − 1  < pt −2  (zero-downtick)

ii) the Lee-Ready (mid-point) rule which decides if a trade is a buy or sell by comparing the trade price pt  with the mid-price mt  =  (at + bt ) (the half-point between best-bid bt  and best-ask at ). If the trade price is exactly equal to the mid-price pt  = mt  then use the tick rule in point (i) above.

 

+1        if pt  > mt

(1)                             dt  =          -1        if pt  < mt , tick rule    if pt  = mt

This is the Lee-Ready rule, as described in Foucault, Pagano, R¨oell, see below.

Compare the results of the two methods for determining the trade di- rection.  What fraction of trades are classified the same way under the two tests?

 

 

 

Figure 1: The Lee-Ready rule described in FPR, Chapter 2. This uses both trade prices and quote prices. The tick rule uses only trade prices.