/Itch-1

Itch 4.1 Implementation in C#

Primary LanguageC#

Itch 4.1 Implementation

This is a C# implementation of the Itch 4.1 protocol decribed here: http://nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/NQTV-ITCH-V4_1.pdf

Please note that this is for educational purposes and probably isn't fast enough to be used in any type of a production environment. I've noticed that I'm able to publish about 3,000 messages/second and consume 1,200 messages per second, which is way too slow to actually use.

For test data, you can download data from past days of trading directly from Nasdaq at: ftp://emi.nasdaq.com/ITCH/

This project is setup as a publisher and a consumer.

How to Run

  1. Install RabbitMQ and make sure it's running.
  2. Check your app.config for publisher and make sure your DataFile setting is pointing to the datafile that you've downloaded from ftp://emi.nasdaq.com/ITCH/ and that your server is pointed to RabbitMQ.
  3. Check your app.config for the consumer and ensure the server is pointed to RabbitMQ.
  4. Open the solution and set the consumer as your startup project, then hit F5.
  5. Once the consumer is up and running, go back to Visual Studio and right click on the Publisher project. Goto Debug, then Start New Instance.
  6. Let the publisher start up and watch the messages flow.

Publisher

First and foremost, the code for reading the file was a direct port from the ITCH 4.1 implementation written in python by Ryan Day: https://github.com/rday/ITCH41

This console application reads through the data file defined in the app.config and publishes them to our message queue. It does this as fast as it can. The code can parse about 450k messages/second, however publishing them to the queue reduces the speed to about 3,000/second.

Consumer

The consumer listens for messages from the queue and keeps track of how many of each type of messages have come in.

For every SecondMessage that we get, we clear out all the counts and print them out to the console. This SecondMessage is sent about every second and marks the number of seconds since midnight.

Requirements

RabbitMQ is required to be setup. You can point your publisher/consumer to the proper server by editing the Server key in each of the app.config files. However, they are defaulted to localhost.