Overview

3 Min Read

My trading platform consists of 2 distinct modules. The first module is the automated trader itself which is responsible for opening a position, managing a position, closing a position etc. The second part is the web application. This is responsible for the visualization of strategies, back testing, error reporting and configuration such as adding new brokers, pairs, strategies etc. More on this later.

Getting Started

Choosing the right tools, programming languages and libraries will be one of the first challenges you will encounter when creating an automated trading platform. There are many options available to us when considering what to use. Do we use MetaTrader4/5 or do we use an API from a broker? Do we care about speed? In that case you might ask if you should use python or c++. This can be quite overwhelming which is why I have decided to list everything I used in the ongoing development of my automated trading platform.

Python – I used python for the trader itself and the web application. Python is extremely versatile and easily extensible. It is a high level language suitable for beginner programmers but also versatile enough for more advanced programmers. It has a huge community and is generally very well supported. Unless you are looking for very low latency trading, python is one of the best languages to use for this type of application.

Here is a list of my absolute must libraries you should use when creating an automated trader using python:

    • Ta-lib – widely used by trading software developers requiring to perform technical analysis of financial market data. https://mrjbq7.github.io/ta-lib/
    • Pandas – A powerful and flexible library that allows for the manipulation of data received from broker API’s. Pandas is extremely fast and makes working with data sets much easier https://pandas.pydata.org/
    • Plotly – A great visualization tool to plot stock charts, indicators etc. https://plotly.com/
    • A broker API/trading platform API – In my case I used MetaTrader 5. I made this decision based on the fact that I did not want to limit myself to one particular broker. Using the MT5 python API allowed me to connect and trade with any broker. https://pypi.org/project/MetaTrader5/
    • Dash/Flask – The UI for the web application is implemented in Dash. This was mainly due to the integration of Plotly and how easy it was to display graphs on a HTML page. Dash is ideal for building data visualization apps with highly custom user interfaces in pure Python. https://plotly.com/dash/

Some other applications I found useful:

Redis – I used Redis mainly as storage for background tasks. This was really helpful when using the back-test feature of the platform. Since back-test calculations can take a long time (with a big data set) I did not want to be sitting around waiting for the results. Instead, running the back-test would happen in the background and I would receive the results on slack.

MySQL – As mentioned above I wanted the ability to use multiple brokers with the platform. If I had multiple strategies and multiple brokers I needed a way to store this information. MySQL was fairly easy to setup and more than capable for the job. I am also storing information on open trades, closed trades, back-testing etc.

Slack – I used the slack API for sending notifications from the automated trader. This is useful for me if I am not by my computer as notifications come directly to my phone. Some events I push to slack include:

    • When a trade is opened.
    • When a trade is closed and the P/L.
    • When the max loss for the day has been breached.
    • When the application has been started.
    • Any errors from the application.
    • Unexpected shutdowns.
My platform pushing trade notifications to slack

If you are interested in learning more about algo trading and trading systems, I highly recommend reading this book. I have taken some of my own trading ideas and strategies from this book. It also provided me a great insight into effective back testing. Check it out here.

4 thoughts on “Overview”

  1. Avatar

    Hi, nice work! I have seen your comments about the EC2 instance and various things. At the moment I have a Ubuntu Server running on EC2 with python, Talib and Binance broker installed. I also plan to use Postgres to track prices, account balances etc. and I’m curious to know about your standpoint on this approach. The MT5 API seems to offer a lot, but at the same time I like to use Ubuntu and I think I will have a hard time combining the two.

    1. Conor O'Hanlon

      I think what you have is also a great approach! Binance is also great if you prefer to trade more crypto.

Leave a Comment

Your email address will not be published.

Subscribe to my newsletter to keep up to date with my latest posts

Holler Box