Data & Code‎ > ‎

Contents of data (.mat) files

Each .mat file contains a single structure named "data" and contains all events on the Nasdaq exchange.

The structure data has five elements:
    data.Event

Each element's content is as follows:
    An (n x 7) element matrix describing all the messages sent into the market.  n is the number of events that occurred on the corresponding date for the corresponding ticker. Each of the 7 columns corresponds to the following information (by column)
  1. Time: measured in milliseconds from midnight. A number equal to 34200000 will correspond to market open 9:30:00.000. Similarly, market close (16:00:00.000) is equal to 57600000.
  2. ID tag for initial posted message: the limit order book (LOB) keeps track of each order when it is posted, and what happens to it afterward. When an order is initially posted it is given an ID number (the number in this column). Future messages that affect this order (e.g. cancellations or executions) will also be given this ID number so they can be traced back to the original posted message
  3. Message Type: code describing the type of messages (see below)
  4. Number of shares: in units, e.g. 100 means 100 shares. 
  5. Price: Denominated in cents times 100. To get a dollar value divide by 10000.
  6. Exchange: always equal to 1 (corresponding to NASDAQ)
  7. BidSide Flag: takes values 1 or 0. One indicates that the messages was posted on the bid side. Executions with this flag are orders that executed against an order posted on the bid side and hence are usually designated as aggressive sell orders. Zero indicates sell side order and aggressive buy orders.
    An (n x k) element matrix describing the number of shares (depth) posted in the limit order book.  n is the number of events that occurred on the corresponding date for the corresponding ticker. k is the number of levels in the LOB recorded. Sell volume refers to depth on the ask side of the book and Buy on the bid side.
    An (n x k) element matrix describing the prices at which depth is posted in the limit order book.  n is the number of events that occurred on the corresponding date for the corresponding ticker. k is the number of levels in the LOB recorded. Sell volume refers to depth on the ask side of the book and Buy on the bid side.

Messages types are encoded by their numeric equivalents. char(data.Event(:,3)) will convert them into the corresponding characters
66: "B" -- Add buy limit order (on the bid)
83: "S" -- Add sell limit order (on the ask)
69: "E" -- Execute outstanding order in part
70: "F" -- Execute outstanding order in full
67: "C" -- Cancel outstanding order in part
68: "D" -- Delete outstanding order in full
88: "X" -- Bulk volume for the cross event
84: "T" -- Execute non-displayed order