For the last 6 months I have been focused on the process of building the full technology stack of an automated trading system. I have come across many challenges and learnt a great deal about the two different methods of backtesting (Vectorised and Event driven). In my journey to building an event driven backtester, it came to my surprise that what you would end up with is close to the full technology stack needed to build a strategy, backtest it, and run live execution.
My biggest problem when tackling the problem was a lack of knowledge. I looked in many places for an introduction to building the technology or a blog that would guide me. I did find a few resources that I am going to share with you today.
For the readers new to quantitative trading I would recommend Ernie P. Chan’s book titled: Quantitative Trading: How to build your own algorithmic trading business. This book is the basics. It’s actually the first book I read on quantitative trading and even then I found it very basic but there are some notes you should take.
From page 81-84 Ernie writes about how at the retail level a system architecture can be split up into semi-automated and fully automated strategies.
A semi-automated system is suitable if you want to place a few trades a week. Ernie recommends using Matlab, R, or even Excel. I have used all 3 platforms and this is my advice:
- Skip Matlab, it cost a lot of money and I could only get access to it at the university laboratories. There isn’t a lot of training material like blogs or books that will teach you how to code a strategy using Matlab.
- R has tons of resources that you can make use of in order to learn how to build a strategy. My favorite blog covering the topic is: QuantStratTradeR run by Ilya Kipnis.
- Microsoft Excel is most likely where you will start if you don’t have programming experience. You can use Excel for semi-automated trading but it’s not going to do the trick when it comes to building the full technology stack.
Semi-automatic framework pg 81
Completely automated trading systems are for when you want to automatically place trades based on a live data feed. I coded mine in C#, QuantConnect also uses C#, QuantStart walks the reader through building it in Python, Quantopian uses Python, HFT will most likely use C++. Java is also popular.
Completely automated trading framework pg 84
Step 1: Getting a head start
Do the Executive Program in Algorithmic Trading offered by QuantInsti.com. I just started the course and the very first set of lectures was on system architecture. It would have saved me about 3 months of research if I had started here. The lectures walked me through each component that I would need as well as detailed description of what each component needs to do. Below is a screen shot of one of their slides used in the presentation:
You can also use this general framework when evaluating other automatic trading systems.
At the time of writing I am only in the third week of lectures but I am confident that a practitioner will be able to build a fully automated trading strategy that could, with a bit of polish, be turned into the beginnings of a quantitative hedge fund.
Note: the course is not focused on building the technology stack.
Step 2: Code a basic event driven backtester
Michael Hallsmore’s blog quantstart.com & book “Successful Algorithmic Trading”
This book has sections dedicated to building a robust event driven backtester. He walks the reader through a number of chapters that will explain his choice of language, the different types of backtesting, the importance of event driven backtesting, and how to code the backtester.
Michael introduces the reader to the different classes needed in an object orientated design. He also teaches the reader to building a securities master database. It is here that you will see how the system architecture from QuantInsti fits in.
Note: You will need to purchase his book: “Successful Algorithmic Trading”, his blog leaves out too much information.
Step 3: Turn to TuringFinance.com
- The EPAT program
- Reading “Successful Algorithmic Trading” & coding a backtester in a different language of your choice.
You should move onto a blog called TuringFinance.com and read the article titled “Algorithmic Trading System Architecture” By: Stuart Gordon Reid. In his post he describes the architecture following the guidelines of the ISO/IEC/IEEE 42010 systems and software engineering architecture description standard.
I found this post very technical and it has some great ideas that you should incorporate into your own architecture.
A screen shot from his post
Step 4: Study open source trading systems.
It goes without saying that Quantopian should be added to this list and I am embarrassed to say that I haven’t spent a lot of time using their platform (due to my choice of language). Quantopian has many perks but the ones that stick out most to me are the following:
- Easy to learn Python
- Free access to many datasets
- A huge community and competitions
- I love how they host QuantCon!
Quantopian is the market leaders in this field and is loved by quants all over! Their open source project is under the code name Zipline and this is a little bit about it:
“Zipline is our open-sourced engine that powers the backtester in the IDE. You can see the code repository in Github and contribute pull requests to the project. There is a Google group available for seeking help and facilitating discussions.”
Here is a link to their documentation:
For those of you unfamiliar with QuantConnect, they provide a full open source algorithmic trading engine. Here is a link
You should have a look at their code, study it, & give them praise. They are Quantopians competition.
I would like to take this opportunity to thank the QuantConnect team for letting me pick their brain and for the brilliant service they provide.
Here is a link to their documentation:
I hope this guide helps the members of the community. I wish I had this insight 6 months ago when I started coding our system.
Questions to the Readers:
- I would like to reach out to the community and ask: “What good algorithmic trading courses do you know of?” I would like to write a post that looks into the topic and provides a ranking.
- Are there any recommendations to building a fully automated trading system that you would like to add to this post?