Intraday Trading : Trade Engine Design
The Trade Engine described here is designed for intra-day trading. At a high level the Trade engine consists of a control component that registers a set of stocks with the data feed, controls the trade engine and communicates with other software components (e.g., a client GUI that supports control of the trading system). A high level view of the Trade Engine is shown below in Figure 1.
The trading system is a distributed system that can be implemented on a set of blades or tower systems. Each Trade Engine is allocated a portion of the portfolio and subscribes to the data feed for each of the stocks that it trades.
The Trade Engine is implemented as a Java Servlet running on top of the Apache Tomcat web server. Implementing the Trade Engine as a Servlet on Tomcat has several advantages:
The Trade Engine separates the model and the control of the model, so that different models can be plugged in to the same software framework. The model control takes care of subscribing to the data feed and creating multiple model threads, one for each stock. The order module is responsible for making sure that order transactions are properly mirrored in the database. Both the data feed and the order interface have abstract definitions (Java Interfaces) that allow multiple versions to be implemented for different data vendors and order processing systems.
Figure 3 shows some of the Trade Engine tread architecture. The model manager spawns off two threads, one to read the tick data stream and one for the model. The tick data stream reader thread does nothing but read a tick data value and place it in a First In, First Out queue. The data values from this queue are read by the model which may apply a filtering model to the values to produce an input for the model. The model logic decides on whether to issue an order to the Trade Engine order processing component.