Does “Everything AI” apply to portfolio optimisation?
Hello,
Today, we're going to talk about the cutting-edge world of portfolio optimization, and the star of the show is none other than Artificial Intelligence. Moving past the traditional approaches, there's a whole new world out there, and it's powered by artificial intelligence.
In this classroom, we will discuss how AI can change the way we manage our portfolios. Excited? Let’s begin!
The graph you see below shows the performance of a portfolio created by using a traditional mean-variance approach:
Here, ‘Optimised S’ implies the optimised portfolio’s Sharpe ratio.
You can download the Python code for mean-variance optimised portfolio from Section 5 Unit 2 on Optimise Portfolio Weights. You need to login and take "Free Preview" to open the Jupyter notebook.
But when we created a portfolio using an AI approach (Long Short-Term Memory Model), this is what the performance looked like:
Observing the results, it's evident that the portfolio's performance, when optimised with AI, is far better. But what could be the reason behind this? Let’s find out!
All the concepts covered in this email are taken from the Quantra course on AI for Portfolio Management: LSTM Networks. You can preview the concepts taught in this course by clicking on the free preview button and going to Section 10 and Unit 1 of the course.
Note: The links in this tutorial will be accessible only after logging into quantra.quantinsti.com?
The Plus Side of Using AI in Portfolio Optimisation
The mean-variance approach, or for that matter any other traditional approach, can only be used to optimise a portfolio to a certain extent. We need something more intelligent. Something that can not only recognise patterns but learn and change on the basis of these patterns. Hence, we choose to move beyond the traditional approaches and opt for AI. With AI you can expect to identify patterns and adapt to the time-series effect. Not just that, you can incorporate additional features rather than solely relying on historical returns. This can help to improve the decision-making process.
Unlike traditional methods that often assume independence and constant distributions of returns, AI models excel at understanding and leveraging temporal aspects, such as trends, seasonality, and evolving market conditions.
We will take the Long Short-Term Memory (LSTM) model because it can handle time series data effectively.
Setting Up the Model
The objective is to calculate the optimal weights for a long-only portfolio consisting of 4 assets. The 4 assets are taken for illustration purposes only. AI model can be used to calculate the weights for more assets.
领英推荐
Input Layer
The input layer is 3-dimensional:
Output Layer:
In addition to input and output layers, you also have hidden layers added to the LSTM network. The input data from the input layer passes through hidden layers, and then to the output layer to calculate the weights of all the four assets in the portfolio.
Training the Model
Now that you know what the structure of the LSTM model looks like, let’s try to understand the training process of the model. The model will calculate the weights but how will it know that these weights are optimal? This is where the loss function comes into play. The loss function helps to evaluate the weights calculated by the LSTM network.
Think about this, what should be the ideal portfolio? The one which gives you the best risk-reward ratio. In other words, the portfolio which yields the highest Sharpe ratio would be the one that has the optimal weight distribution. Therefore, we create a loss function based on the Sharpe ratio.
Ideally, while training the model we want to minimise the loss function. Does it mean we minimise the Sharpe ratio??
No, infact, it’s the opposite. We create a loss function that minimises negative Sharpe.
A Look at the Results
We used the LSTM model to create a long-only portfolio consisting of four assets, and these were the results:
We compare the performance of the optimised portfolio with that of the benchmark portfolio. The benchmark portfolio is nothing but the average returns of the four assets. As you can see, the optimised portfolio has performed far better than the benchmark portfolio.
In this classroom, you’ve learned the architecture of the LSTM model and how you can set-up your own LSTM model to optimise a portfolio. But we’ve only scratched the surface here.?
In this explanation, we skipped the whole train-test data split thing. We just wanted to focus on nailing down the concept of calculating weights for different assets. In the "AI for Portfolio Management course", we break the data into training and test sets and analyse the performance in test sets. Plus, we will also learn to create long-short portfolios. Want a sneak peek? Take a free preview of the course!
But hold on... That’s not all! In the upcoming Quantra classroom, we are going to take things up a notch and discuss how to backtest the performance of an optimised portfolio. Hang tight!
What to do next?