By Graham Miller, CEO of Marketcetera
Picture this: you want to build an automated trading system to take advantage of ongoing price discrepancies in US listed equity options. This system will allow you to scale up the strategy to a significant portion of your P&L, so clearly you will code this in-house with your most trusted software developers. Open source software is probably the furthest thing from your mind. However, as the project gets underway, you are surprised to find that much of the code that will ultimately make up your trading system is not proprietary, and may even be available as open source software.
Actually, not so surprising at all; a quiet move towards open source is occurring in financial services, initially at the infrastructure layer and progressively, even in finance-specific functions like FIX connectivity and basic risk-analysis. Increasingly, software adopted from open source projects can provide the flexibility of in-house code, while providing time-to-market advantages of proprietary third-party software. For example, JP Morgan based OneBench - their internal application development environment - on the open source Eclipse application framework, because it provided the efficiency, lower cost and control they required as the foundation of their front-office trading and risk system.
On the buy side, the advantage of open source is even more compelling, as the agility of trading organisations is constrained by smaller development and IT organisations. Instead of siphoning precious internal development resources off to re-implement common application infrastructure components, the buy side benefits when engineers and quants focus on the proprietary portions of your automated or algorithmic trading stack where real returns are produced from highly optimised implementations of your strategies.
Everyone now knows about the success of the Linux operating system and MySQL database server, but today, there are a variety of additional open source projects that could jumpstart development of an auto/algo trading system and provide substantial economic and time-to-market advantages. The following provides a survey of some of the most mature and promising open source initiatives available that are potentially relevant and valuable to buy side organisations. These projects generally proffer extensive documentation and maintain active developer communities, enabling thorough software evaluation and creating a rich environment to support fast implementation (see box: 'Tyre kicking').
Messaging & Middleware
Automated and algorithmic trading systems increasingly require communication across multiple applications on multiple machines with high throughput. For example, consider risk managers observing real-time trading, trading assistants entering orders for traders and clusters of pricing servers sharing data. In addition, pricing logic is increasingly separated from FIX gateway software, and executing applications must ingest blotter data from an OMS. These types of interactions lend themselves to an event driven architecture, indicating the use of messaging middleware that provides publish/subscribe support, manages latency and uses point-to-point guaranteed delivery semantics.
ActiveMQ is an open source messaging system that provides a messaging bus with an impressive array of features (http://activemq.apache.org/). Supporting several transport protocols, persistence, load-balancing, failover, and integration libraries for many languages, ActiveMQ rivals the offerings of many of its proprietary competitors. It's easy to setup and can actually be embedded directly into server applications written in Java for tighter integration and better performance.
AMQP (Advanced Message Queuing Protocol) is a messaging protocol designed to enable highly interoperable middleware messaging and replace proprietary protocols like those used by TIBCO's Rendezvous. AMQP was initially developed by JP Morgan Chase and further championed in the open source community by financial institutions such as Credit Suisse and Goldman Sachs. The Apache Foundation (the same people that developed the world's most widely used web server) is running an AMQP project called Qpid (http://cwiki.apache.org/qpid/). Apache describes Qpid as "a messaging implementation built on AMQP that allows one to implement just about any distributed or business application. Qpid provides transaction management, queuing, distribution, security, management and heterogeneous multi-platform support."
While messaging infrastructure can deliver the buy side market data, transport orders and fill information across various internal systems, there are a couple of projects that can provide a model development environment for both internal pricing and trading.
The R Project (www.r-project.org) may already have a presence in your quant group. As described by the R community, "R is a language and environment for statistical computing and graphics. R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, ...) and graphical techniques, and is highly extensible." Quants can use R's statistical tools to develop and test trading strategies, and it can also form the basis of the runtime logic behind those strategies.
QuantLib is aimed at providing a comprehensive software framework for quantitative finance including modelling, trading, and risk management (http://quantlib.org/). In building an automated or algorithmic trading system, one may choose to implement custom proprietary pricing algorithms, or risk analytics. But, if access to implementations of well known quantitative finance tools is required, QuantLib may have what is needed. QuantLib has C++ libraries with interfaces to the majority of popular languages for a host of models and tools including pricing engines, pricers, financial instruments, yield term structures, volatility and more. Unlike proprietary code, all submissions have been peer-reviewed by an active community of academic and industry quants and statisticians.
Graph 1: Number of source lines of code (SLoC) in about 5000 of the most active open source projects
With the pace of product innovation and intensity of buy side competition in trading, the need for auto/algo trading systems to reach the market quickly and inexpensively increases daily. Several open source efforts aim to increase the financial viability of rapidly launching and maintaining internally developed trading systems. These include providing open source FIX implementations and open source versions of the common components of the trading platform itself.
Graph 2: Historical shares traded by automated and algorithmic systems on the NYSE and American Stock Exchange
QuickFIX and QuickFIX/J are solid implementations of the FIX protocol in C++ and Java respectively (http://www.quickfixengine.org/, http://www.quickfixj.org/). Exchanges now integrate FIX connectivity natively into tradebook systems, providing performance meeting or exceeding proprietary protocols for order entry. As a result, FIX is becoming the lingua franca of finance and will likely supplant any other standard.
The QuickFIX libraries handle the underlying connection and session logic, providing total control of the application data communicated to counterparties. Fairly low-level, these libraries can be used to produce anything from simple drop copy loggers, all the way up to complete trading systems.
To stay competitive and generate alpha, trading systems must be flexible, agile and constantly adaptive to new market conditions. Trading strategies may have a half-life measured in months as increasingly sophisticated market participants quickly squeeze the edge out of even the cleverest of strategies. A trading system must, therefore, allow regular adjustment and updating, and the rapid addition of new features, strategies, and asset classes.
Using open source software, buy side organisations gain the ability to implement new trading strategies and build new features on an internally driven development schedule, without the delays inherent in relying on a third party software vendor's release cycle. Today, development teams supporting traders can build a prototype of an application on ActiveMQ in the time that it would take to negotiate a licence with a vendor for a product like IBM's MQSeries. The 'openness' of open source enables fast technology evaluation cycles, and dramatically shortens the time-to-market for developing new trading systems.
The benefits of open source will ultimately persuade all but the largest and most conventional firms on Wall Street to abandon trading systems based on wholesale internal IT efforts or proprietary systems from commercial vendors, and turn to using the timely and cost-effective strategies offered through this community-based approach. While many myths must be dispelled before wide-scale adoption occurs (see box: 'Open Source Mythology'), those that innovate early will see real returns in opportunity costs of development time and business scalability.