Skip to main content

LUP Student Papers

LUND UNIVERSITY LIBRARIES

Theoretical & Practical Investigation of Algorithmic Trading

Mild, Gustaf LU (2023) In Master's Theses in Mathematical Sciences FMSM01 20222
Mathematical Statistics
Abstract
This Master’s Thesis was written in collaboration with Handelsbanken Asset Man- agement in Stockholm, through the Faculty of Engineering at Lund University. This paper aims to investigate algoritmic trading on the financial market from a theo- retical and a practical perspective. The theoretical section presents an approach of using sentiment analysis for predicting asset price movements. The algorithms be- hind the investigation is the rule-based model VADER, and the Deep Learning model BERT. The practial section instead examines two Machine Learning algorithms for predicting tomorrows closing price movements. The models is the Gated Recurrent Unit (GRU), and the Random Forest. Both models will be built up in five different structures.... (More)
This Master’s Thesis was written in collaboration with Handelsbanken Asset Man- agement in Stockholm, through the Faculty of Engineering at Lund University. This paper aims to investigate algoritmic trading on the financial market from a theo- retical and a practical perspective. The theoretical section presents an approach of using sentiment analysis for predicting asset price movements. The algorithms be- hind the investigation is the rule-based model VADER, and the Deep Learning model BERT. The practial section instead examines two Machine Learning algorithms for predicting tomorrows closing price movements. The models is the Gated Recurrent Unit (GRU), and the Random Forest. Both models will be built up in five different structures. GRU and Random Forest are exposed to trading from January 2020 to October 2022, where eight financial metrics will be used as comparison parameters. The traded assets are four Futures on the interest rate market, all of them European. The results from the practical part points towards difficulties for Gated Recurrent Unit to be a profitable trading model for these European interest rates. While for Random Forest, the results instead points towards the model having potential of being a profitable model for trading the European interest rates, but cannot be said for sure without further investigation. The best result that GRU achieves for predicting tomorrow’s closing price movement is an accuracy of [54.96%,64.11%] for increase and [54.24%, 64.34%] for decrease, both confidence intervals at the 95% significance level. The same metric for Random Forest gave the confidence intervals [58.51%, 58.80%] for increases in closing price, and [58.00%, 58.33%] for decreases in closing price. The five different setups for GRU and Random Forest respectively shows only small significant improvement in the overall trading performance. The conclusion for future research is that GRU should be investigated with a different model construction and with other financial assets, while Random Forest should be investigated more thoroughly in a similar investigation, although during a time period with a more increasing market. (Less)
Popular Abstract
Already in 1987 Gordon Gekko said ‘It’s not about money. It’s about the game between people.’. That’s what trading is, the game between people. But when public information is directly interpreted in the market price, you need to get your information before your opponent to beat them. Insider trading is directly illegal, how should one then proceed? Predict the future? Yes, and that’s exactly what this is all about. Predicting future closing prices, with Artificial Intelligence. The question is thus, who can do it best? The old man or the new kid on the block, both of which look at historical data? Or the one reading the newspaper, over and over again?

The older AI model, Random Forest, seems to have potential to succeed in financial... (More)
Already in 1987 Gordon Gekko said ‘It’s not about money. It’s about the game between people.’. That’s what trading is, the game between people. But when public information is directly interpreted in the market price, you need to get your information before your opponent to beat them. Insider trading is directly illegal, how should one then proceed? Predict the future? Yes, and that’s exactly what this is all about. Predicting future closing prices, with Artificial Intelligence. The question is thus, who can do it best? The old man or the new kid on the block, both of which look at historical data? Or the one reading the newspaper, over and over again?

The older AI model, Random Forest, seems to have potential to succeed in financial trading. The algorithm may not be the Einstein of the class with full marks on the exam, but to be honest, there doesn't seem to be anyone in the class who performs that much better? With a test result (accuracy in future prediction) of at least 50%, every time, Random Forest would absolutely reach the passing threshold for my university exams, or otherwise expressed, having sufficient result to perhaps cope within trading. As best Random Forest could foretell the future in almost 59% of all predictions. Not bad for an AI, or compared to anyone else for that matter. Since predicting the future isn’t easy - or what do you say Marty McFly?

However, we shouldn't raise Random Forest's confidence too much. Because, even if the model can predict the future between 50-59% of the time, and the model's return do beat Warren Buffet's strategy of ‘buying a financial asset and holding it for life’, the traded return is nothing to hang on the Christmas tree. In the research Random Forest was exposed to staged trading scenarios for four European interest rates between January 2020 and October 2022. None of the scenarios resulted in a positive return, but the positive thing is still that the model performed between 1.5-10% better in total return compared to Buy-and-Hold. Perhaps take a different trading strategy?

Would it hence be profitable to use Random Forest for predicting interest rates, or any other asset, such as stocks or indices, and make some money out of it? Well, said like a stock analyst, it is not a 'Buy' recommendation. Instead, we state 'Keep', and wait for more indicating results (i.e. further investigation).

So how did the new ‘cool’ person in the class perform, the one who only uses the latest technologies? Well, the Deep Learning algorithm Gated Recurrent Unit seems to have both good and bad days, with an emphasis on the latter. For the most, the model seems to move in the borderland of 50% prediction accuracy, with unfortunately a little too many results below. But in a few isolated cases, especially when the model is made more powerful, results appear in the range of 54-64%. Thus, despite these few good numbers, the Gated Recurrent Unit appears to be an even less suitable candidate for interest rate prediction - and is very unlikely to make us a Scrooge McDuck by trading on the fixed income market. The stock analyst therefore recommends 'sell' for Gated Recurrent Unit, in the hope that the model will be examined with other financial securities, to hopefully perform better somewhere else.

Finally, how did the newspaper guy perform? Well, trying new paths can lead to misstakes - but can still be beneficial, if you learn from them. Predicting future closing prices by having an AI reading thousands of news articles do make sense and is not as difficult as it sounds. The problem is instead to find these thousands of articles and get them into the algorithm. When you don't succeed in finding the data, you can instead give tips to someone else so that they can avoid ending up in the same position. So, listen closely. Find the data the first thing you do, and examine it. If it doesn't work? Well, just pay for the data. (Less)
Please use this url to cite or link to this publication:
author
Mild, Gustaf LU
supervisor
organization
alternative title
Teoretisk och praktisk utvärdering av algoritmbaserad handel
course
FMSM01 20222
year
type
H2 - Master's Degree (Two Years)
subject
keywords
Algorithmic Trading, BERT, Buy-and-Hold, Futures, Gated Recur- rent Unit, Interest Rate, Natural Language Processing, Natural Language Toolkit, Random Forest, VADER.
publication/series
Master's Theses in Mathematical Sciences
report number
LUTFMS-3465-2023
ISSN
1404-6342
other publication id
2023:E7
language
English
id
9111867
date added to LUP
2023-03-06 09:03:07
date last changed
2023-03-09 15:17:15
@misc{9111867,
  abstract     = {{This Master’s Thesis was written in collaboration with Handelsbanken Asset Man- agement in Stockholm, through the Faculty of Engineering at Lund University. This paper aims to investigate algoritmic trading on the financial market from a theo- retical and a practical perspective. The theoretical section presents an approach of using sentiment analysis for predicting asset price movements. The algorithms be- hind the investigation is the rule-based model VADER, and the Deep Learning model BERT. The practial section instead examines two Machine Learning algorithms for predicting tomorrows closing price movements. The models is the Gated Recurrent Unit (GRU), and the Random Forest. Both models will be built up in five different structures. GRU and Random Forest are exposed to trading from January 2020 to October 2022, where eight financial metrics will be used as comparison parameters. The traded assets are four Futures on the interest rate market, all of them European. The results from the practical part points towards difficulties for Gated Recurrent Unit to be a profitable trading model for these European interest rates. While for Random Forest, the results instead points towards the model having potential of being a profitable model for trading the European interest rates, but cannot be said for sure without further investigation. The best result that GRU achieves for predicting tomorrow’s closing price movement is an accuracy of [54.96%,64.11%] for increase and [54.24%, 64.34%] for decrease, both confidence intervals at the 95% significance level. The same metric for Random Forest gave the confidence intervals [58.51%, 58.80%] for increases in closing price, and [58.00%, 58.33%] for decreases in closing price. The five different setups for GRU and Random Forest respectively shows only small significant improvement in the overall trading performance. The conclusion for future research is that GRU should be investigated with a different model construction and with other financial assets, while Random Forest should be investigated more thoroughly in a similar investigation, although during a time period with a more increasing market.}},
  author       = {{Mild, Gustaf}},
  issn         = {{1404-6342}},
  language     = {{eng}},
  note         = {{Student Paper}},
  series       = {{Master's Theses in Mathematical Sciences}},
  title        = {{Theoretical & Practical Investigation of Algorithmic Trading}},
  year         = {{2023}},
}