Machine Learning for Portfolio Optimization & Trading

The Opportunity

Machine Learning (ML) and Artificial Intelligence (AI) are revolutionising all aspects from our lives from healthcare to online shopping. The application for Machine Learning for Trading is getting more important day by day due to new research in Deep Learning, Deep Reinforcement Learning, etc.

Hedge funds like Renaissance Technologies, Bridgewater Associates have been implementing Machine Learning for their trading systems for some time now and these hedge funds that have been implementing traditional Machine Learning technology have outperformed traditional Quant funds and generalized Hedge funds according to a report by ValueWalk. AI and ML systems can provide traders and managers with tools to help with decision making process associated with investment and risk.

Humans often make decision with emotional bias which affects their overall strategy and performance. Seperating out the emotion from investment and trading is really difficult and therefore computer algorithms and models can make decisions without any emotions and can execute much faster as compared to a human. Computerization of order flow began in 1970’s when computer algorithms and softwares were developed for automated execution of orders. Soon these algorithms and softwares evolved for trading purposes often known as algorithmic trading.

There are numerous different types of algorithmic trading. A few examples are as follows:

  • Trade execution algorithms, which break up trades into smaller orders to minimise the impact on the stock price. An example of this is a Volume Weighted Average Price (VWAP) strategy
  • Strategy implementation algorithms which make trades based on signals from real-time market data. Examples of this are trend-based strategies that involve moving averages, channel breakouts, price level movements and other technical indicators.
  • Stealth/gaming algorithms that are geared towards detecting and taking advantage of price movements caused by large trades and/or other algorithm strategies.
  • Arbitrage Opportunities. An example would be where a stock may trade on two separate markets for two different prices and the difference in price can be captured by selling the higher-priced stock and buying the lower priced stock.

Algorithmic trading strategies gave hedge funds and trading funds significant advantage and the hedge funds were wildly profitable. In May 2017, capital market research firm Tabb Group said that high-frequency trading (HFT) accounted for 52% of average daily trading volume. But this did not last long as this space became more competitive and ultimately resulted in profit decline. Traders and Hedge funds now needed new tools which could give them competitive advantage and increase profits. This new tool was Machine Learning.

Machine Learning is a branch of Artificial Intelligence. Machine Learning involves training a mathematical model with data for example historical prices, technical indicators for predictions and decision making. Example of these can be portfolio optimization models, trend classification, trading models etc.

Machine Learning offers the number of important advantages over traditional algorithmic programs. Machine Learning models can learn patterns hidden in the data that can be impossible for humans to understand. The process can accelerate the search for effective algorithmic trading strategies by automating what is often a tedious, manual process. It also increases the number of markets an individual can monitor and respond to. Most importantly, they offer the ability to move from finding associations based on historical data to identifying and adapting to trends as they develop. If you can automate a process others are performing manually; you have a competitive advantage. If you can increase the number of markets you’re in, you have more opportunities. And in the zero-sum world of trading, if you can adapt to changes in real time while others are standing still, your advantage will translate into profits.

There are multiple strategies which use Machine Learning to optimize algorithms, including linear regressions, neural networks, deep learning, support vector machines, and naive Bayes, to name a few. And well-known funds such as Citadel, Renaissance Technologies, Bridgewater Associates and Two Sigma Investments are pursuing Machine Learning strategies as part of their investment approach. At Aegasis AI, we have the experience and know-how to help traders incorporate ML into their own trading strategies.

Our case study


In one of our projects, we designed an intelligent asset allocation system that utilized Deep Reinforcement Learning and Modern Portfolio Theory. The task was to implement an investment strategy that could adapt to rapid changes in the market environment.

We built an AI system that trained a deep neural network for portfolio management problem. An LSTM (Long Short-Term Memory Units) was trained to generate weights for different assets in a portfolio. These weights represented the capital allocation for each particular asset at time ‘t’. This particular neural network architecture can store information for multiple timesteps, which is made possible by a Memory Cell. This property enables the model to learn long and complicated temporal patterns in data. As a result, we were able to predict asset allocation given the previous allocation of capital for each asset along with it’s past performance.

The AI Framework used Reinforcement Learning which is a branch of Machine Learning. With reinforcement learning, an algorithm automatically determines what an ideal behavior should be in a given environment to maximize a given goal. In this case, the environment is a real-time equities market and the goal is to maximize risk adjusted returns. 

In order to strengthen our predictions, we used a wealth of historical data for the relevant assets. This method determines the allocation of assets, which is diverse and ensures the lowest possible level of risk, given the returns’ predictions.

Combining these models created an investment strategy which generated 10 fold returns over a period of 6 months. This strategy outperformed benchmark portfolio management strategies like UCRP, ONS, RMR etc.  Contact us to learn more.

AI Strategies Outperform

It is difficult to find performance data for AI strategies given their proprietary nature, but hedge fund research firm Eurekahedge has published some informative data. The chart below displays the performance of the Eurekahedge AI/Machine Learning Hedge Fund Index vs. traditional quant and hedge funds from 2010 to 2016. The Index tracks 23 funds in total, of which 12 continue to be live.

ai machine learning consulting

Eurekahedge notes that:

“AI/Machine Learning hedge funds have outperformed both traditional quants and the average hedge fund since 2010, delivering annualized returns of 8.44% over this period compared with 2.62%, 1.62% and 4.27% for CTA’s, trend-followers and the average global hedge fund respectively.”

Eurekahedge also provides the following table with the key takeaways:

Table 1: Performance in numbers – AI/Machine Learning Hedge Fund Index vs. quants and traditional hedge funds
machine learning for trading


  1. AI/Machine Learning hedge funds have outperformed the average global hedge fund for all years excluding 2012.
  2. Barring 2011 and 2014, returns for AI/Machine Learning hedge funds have outpaced those for traditional CTA/managed futures strategies while underperforming systematic trend following strategies only for the year 2014 when the latter realized strong gains from short energy futures.
  3. Over both the five, three and two year annualized period, AI/Machine Learning hedge funds have outperformed both traditional quants and the average global hedge fund delivering annualized gains of 7.35%, 9.57%, and 10.56% respectively over these periods.
  4. AI/Machine Learning hedge funds have also posted better risk-adjusted returns over the last two and three year annualized periods compared to all peers depicted in the table below, with Sharpe ratios of 1.51 and 1.53 over both periods respectively.
  5. While returns have been more volatile compared to the average hedge fund (compare with Eurekahedge Hedge Fund Index), AI/Machine Learning funds have posted considerably lower annualized volatilities compared with systematic trend following strategies.

Eurekahedge also notes that the AI/Machine Learning hedge funds are “negatively correlated to the average hedge fund (-0.267)” and have “zero-to-marginally positive correlation to CTA/managed futures and trend following strategies,” which point to the potential diversification benefits of an AI strategy.

The above data illustrate the potential in utilising AI and Machine Learning in trading strategies. Fortunately, traders are still in the early stages of incorporating this powerful tool into their trading strategies, which means the opportunity remains relatively untapped and the potential significant.

Here is an another example of an AI application for finance in practice:

Imagine a system that can monitor stock prices in real time and predict stock price movements based on the news stream. That’s precisely what AZFinText does. This article recounts an experiment that used Support Vector Machine (SVM) to trade S&P-500 and yielded excellent results. Below is the table that shows how it performed relative to the top 10 quantitative mutual funds in the world:

machine learning for algorithmic trading

Strategy using Google Trends

Another experimental trading strategy used Google Trends as a variable. There are a plethora of articles on the use of Google Trends as a sentiment indicator of a market.

The experiment in this paper tracked changes in the search volume of a set of 98 search terms (some of them related to the stock market). The term “debt” turned out to be the strongest, most reliable indicator when predicting price movements in the DJIA.

Below is a cumulative performance chart. The red line depicts a “buy and hold” strategy. Google Trends strategy (blue line) massively outperformed with a return of 326%.

machine learning futures trading

I need more specific examples applicable in my industry

This paper describes NLP and Sentiment Analysis techniques for finding investment opportunities.

This paper describes how Deep Neural Networks (DNN) were used to predict 43 different Commodity and FX future mid-prices.


Another experiment describes trading on Istanbul Stock Exchange with NN and Support Vector Machine (SVM).

Interestingly enough, this paper presents how genetic algorithms support vector machine (GASVM) was used to predict market movements.


By incorporating Machine Learning into your trading strategies, your portfolio can capture more alpha. But implementing a successful ML investment strategy is difficult– you will need extraordinary, talented people with experience in trading and data science to get you there. Let us help get you started.