## Designing and implementing a Hidden Markov Model to predict stock prices

Written by Brandon Sandhu on 19/07/2024

### Abstract

Our work is primarily inspired by Renaissance Technologies, which aimed to develop systematic trading strategies using quantitative models based on mathematical and statistical analysis.
Founded in 1982 by mathematician and philanthropist James Harris Simons, Renaissance Technologies had its roots in Simonsâ€™ experience as a code breaker during the Cold War. Many of
his initial recruits for the firm were colleagues from his code-breaking days.

The Medallion Fund, renowned for its record-setting investment returns, has achieved an average annual return of 62% from its inception in 1988 until 2021. Although the specific strategies
employed by Medallion remain undisclosed due to perpetual non-disclosure agreements signed
by its employees, we can still make some educated guesses about their methods.

Given that Simons was a mathematical researcher for much of his life, his approach centered
around research. Consequently, many of his recruits were academics holding PhDs or other
advanced qualifications. One of the first recruits was Leonard Baum, who was with the company for only two years. Baumâ€™s joint development of the Baum-Welch algorithm sparked
the initial types of models used at Renaissance Technologies. The Baum-Welch algorithm is a
type of expectation-maximising algorithm that finds the most probable parameters of a Hidden
Markov Model. By recognising this connection between Baum and Renaissance, we begin with
the theory of Hidden Markov Models and explore how they can be used to forecast stock market
prices.

### Report

The written report of our theory and implementation can be accessed here, Report.

### Python Code

The Jupyter notebook consisting of the final python code can be accessed here, Notebook.