Algorithmic Trading

Home » Trading » Algorithmic Trading

Algorithmic trading or algo-trading is a very fancy buzzword. I will try and document my understanding of algo-trading and how someone can venture into this space. If you find any misleading and erratic information and/or blaring holes, please do let me know. This article is purely based on my limited understanding of the area hence rectifying my mistakes will help me better understand algo-trading.

This article is meant for retail traders. Algorithmic trading as described in the article is not applicable to institutional and high-frequency traders, as they are in a totally different ball game with regards to capital, strategy and infrastructure.

Algorithmic trading is a way of automating the process of trading. You need a trading strategy, based on numerical analysis, that works; next you build an automated trading system around your trading strategy. Viola! You are an algo-trader! It is that straightforward.

A trading strategy based purely on mathematical foundations is ripe for porting into algorithmic trading. If you already have a strategy that you manually perform and is based on mathematical/statistical/numerical analysis, then you can design a system to automate those manual steps in an algorithmic way. Unfortunately, any trading strategy that is based on hunch or really sophisticated thinking or logic cannot be converted to an algorithmic trading system. For example, lets say, you are watching the news and you hear President of the United States Trump say “We will build a wall and make Mexicans pay for it”. You have a very sophisticated approach to trading and immediately you are thinking of shorting Mexican Peso and their industries and going long on construction materials company, related to one of Trump’s advisors based out of the US. This strategy cannot be converted to an algorithmic trading strategy because computers are dumb and it is quite difficult to get them to be as intelligent as a 2 year old, let alone a grown adult.

Will the returns be any good? You as a trader should code the strategy/algorithm, which means, you should come up with a strategy/algorithm. Therefore, returns would entirely depend upon how good you are at devising a new strategy/algorithm.

Is it worth investing time in building automated trading algorithm? Of course it is! Automated trading strategies will free up your time, instead of sitting in front of the screen deciding when to buy and when to sell while biting nails, you could be drinking beer at the pub, watching a movie, go swimming, spend time with family or travel!

Trading

First and foremost traits to excel in trading is that you must have thorough knowledge of the market, thorough understanding of your trading psychology, an excellent trading strategy based on numerical analysis and thorough understanding of your risk profile. If you have all of the above then you are best fit to move into developing automated trading algorithms. If even one of those areas is not up to scratch, unfortunately, you are destined to fail.

The only way you can get started or learn trading is via actual trading. Most online brokers provide a dummy-money trading account. Start trading on dummy-money account, then gradually move into a real-money trading. Get to know yourself, your psychology, your risk profile via trading and develop a trading strategy that generates profit for you. Once you have all these, then you can think of moving into automated/algorithmic trading. Algorithmic trading is not magic or miracle, it is just a way of automating/formalising your physical trading strategies!

System

An algorithmic trading system will mostly consist of the below six elements:

  1. Data: You will need access to good, clean data. Not all data providers provide sufficient support to download data programmatically, so you will have to pick wisely. Data needs to stored in a format that your analysis module can access and process. Data providers do recommend certain formats of databases but you will have to pick based on what is convenient for you. Depending on your trading time-scale the price of data feed varies.
  2. Data Analysis: Using the data, you will need to perform some sort data analysis using a trading strategy that you might employ or code. This usually generates your BUY/SELL signals. You can either build your own analysis platform to read the data and analyse the data or use some readily available platforms to help you perform the analysis. Readily available platforms takes away the hassle of reading the data correctly and provides ease of processing.
  3. Broker: You will need a broker who provides access to their API’s to help you automate. By connecting to broker’s gateway, you can programmatically retrieve your account information, place orders and perform other necessary functions.
  4. Management: You need some sort of risk and order management modules to prepare your orders and place your orders with the broker via the API. You might want to do some sort of book keeping after placing the orders. All these can be built into your software. If you are using Interactive Brokers as your broker then my IB Interface might be a good place to start, to help you build this management system.
  5. Overarching Control: You will have to code up an overarching software framework that will help you control and monitor the process pipeline. A traditional pipeline would be data download → data analysis → generate signals → risk & order management → place orders → book keeping → generate reports → monitor orders.
  6. Reporting: Make sure you have elaborate process logs and reporting built into your system. Process logs will help you debug within minutes of failing and reporting will help you make sure your risk management, order management, etc. are running as planned.

For a person with average software engineering skills, it should not take more than 100 – 200 man hours to build a trading system from scratch. However, this is based on the assumption that the trading strategy is mature and/or well developed.

Pit-falls of algo-trading are, your costs (brokerage, commissions, infrastructure, etc), your risk management, your strategy/algorithm and finally your software. Cost of data varies depending on the time-scale you want, i.e. End-of-day data is lot cheaper than 1 minute tick data, real-time data is lot costlier than 5-minute or 10-minute delayed data, etc. You will mostly likely need a dedicated computer, high-speed broadband internet, etc. There are other costs associated such as power, computer maintenance, software maintenance, etc. With respect to software, make sure you perform tons of error-checking, cross-checking, overflow conditions, etc before the order is sent to the broker. It might sound like overkill but more the checks the better, more redundancies in checking the better because you do not want to send the wrong order to the broker. A wrong order can wipe your account in few seconds even before you realise you have sent a wrong order. Of course, you will want to follow standard software development principles to make sure you are not confused when you revisit the module in future. If you fail to take all these into consideration while building your trading strategy and/or algorithm then you are destined to book a loss, without doubt.

Algorithmic trading is not for everyone. People who are successful at algorithmic trading usually are very passionate about numerical/statistical analyses and thrive on data challenges. They will also be very hard working, have excellent analytical and logical thinking capability, good programming knowledge and love building software applications from ground up. If you are a trader with limited or no knowledge of programming and/or software engineering then it might be worthwhile hiring the services of an expert programmer.

If you are programmer, you should have a shot at building algorithmic trading systems. Learning is always a good thing as it enhances ones’ skill-set and knowledge to a different level. If nothing else, it might make you more marketable in your day job!

Risk Disclosure | Terms & Conditions | Privacy Policy