The stock market is an extremely complex and dynamic environment, where every investor's goal is to obtain an edge on the others in order to make big profits. For this reason, experts use cutting-edge techniques trying to get that, but it is common for some external factors to change and nullify the advantage gained by having a huge impact on the market, making the profits fluctuate widely. This dissertation aims at defining a framework that could potentially be used to generate an investment strategy with returns that have lower variability compared to stocks. To do so, the first part of this work focuses on assessing the use of machine learning algorithms to predict the price movements of stocks, trying to verify the hypothesis that they don't give any advantage to investors when used alone. Following that, the second half of this dissertation will focus on the definition and implementation of a framework that could generate consistent returns and could be generalizable to different market sectors. This was done through an initial phase of input optimization that includes a Principal Component Analysis to reduce the dimensionality of the data and a Multiple Linear Regression with a backwards exclusion algorithm to keep only the relevant features for this problem, as well as the implementation of a Deep Q-Network (DQN) that acts as a trading agent able to balance a portfolio consisting of a stock and a risk-free asset. The results obtained show that machine learning algorithms cannot be distinguished from a random classifier when used single-handedly, but the optimized framework can generate returns with a lower variability compared to the buy-and-hold strategy, and in some cases also higher than the latter. Possible future developments of this work include the further generalization of this framework to handle multiple stocks and different asset classes, as well as adding sentiment analysis data to try to increase the returns.
Il mercato azionario è un sistema estremamente complesso e dinamico, in cui l'obiettivo di ogni investitore è ottenere un vantaggio sugli altri per generare grandi profitti. Per questo motivo, gli esperti utilizzano tecniche all'avanguardia nel tentativo di ottenerlo, ma è frequente che alcuni fattori esterni cambino e, avendo un enorme impatto sul mercato, annullino il vantaggio ottenuto facendo fluttuare ampiamente i profitti. Questa tesi mira a definire un modus operandi che possa essere utilizzato per generare una strategia di investimento con rendimenti meno variabili rispetto alle azioni. Per fare ciò, la prima parte di questo lavoro si concentra sulla valutazione dell'uso di algoritmi di machine learning per prevedere i movimenti di prezzo delle azioni, cercando di verificare l'ipotesi che essi non diano alcun vantaggio agli investitori se usati singolarmente. In seguito, la seconda parte della tesi si concentrerà sulla definizione e sull'implementazione di un framework in grado di generare rendimenti costanti e che sia generalizzabile a diversi settori di mercato. Ciò è stato fatto attraverso una prima fase di ottimizzazione degli input che comprende una Principal Component Analysis per ridurre la dimensionalità dei dati e una Regressione Lineare Multipla con un algoritmo di eliminazione a ritroso per mantenere solo le variabili rilevanti per questo problema, a cui segue l'implementazione di una rete Q-Network profonda (DQN) che sia in grado di bilanciare un portafoglio composto da un'azione e un'attività priva di rischio. I risultati ottenuti mostrano che gli algoritmi di machine learning non si distinguono da un classificatore casuale se utilizzati da soli, ma il framework ottimizzato può generare rendimenti con una variabilità inferiore rispetto alla strategia buy-and-hold, e in alcuni casi anche superiore a quest'ultima. I possibili sviluppi futuri di questo lavoro includono l'ulteriore generalizzazione di questo framework per gestire più titoli e diverse classi di attività, nonché l'aggiunta di dati di sentiment analysis per cercare di aumentarne ulteriormente i rendimenti.
Deep Q-Network for trading: an innovative framework to exploit AI in portfolio balancing
Sgroi, Pietro
2023/2024
Abstract
The stock market is an extremely complex and dynamic environment, where every investor's goal is to obtain an edge on the others in order to make big profits. For this reason, experts use cutting-edge techniques trying to get that, but it is common for some external factors to change and nullify the advantage gained by having a huge impact on the market, making the profits fluctuate widely. This dissertation aims at defining a framework that could potentially be used to generate an investment strategy with returns that have lower variability compared to stocks. To do so, the first part of this work focuses on assessing the use of machine learning algorithms to predict the price movements of stocks, trying to verify the hypothesis that they don't give any advantage to investors when used alone. Following that, the second half of this dissertation will focus on the definition and implementation of a framework that could generate consistent returns and could be generalizable to different market sectors. This was done through an initial phase of input optimization that includes a Principal Component Analysis to reduce the dimensionality of the data and a Multiple Linear Regression with a backwards exclusion algorithm to keep only the relevant features for this problem, as well as the implementation of a Deep Q-Network (DQN) that acts as a trading agent able to balance a portfolio consisting of a stock and a risk-free asset. The results obtained show that machine learning algorithms cannot be distinguished from a random classifier when used single-handedly, but the optimized framework can generate returns with a lower variability compared to the buy-and-hold strategy, and in some cases also higher than the latter. Possible future developments of this work include the further generalization of this framework to handle multiple stocks and different asset classes, as well as adding sentiment analysis data to try to increase the returns.File | Dimensione | Formato | |
---|---|---|---|
2024_12_Sgroi_Executive Summary.pdf
solo utenti autorizzati a partire dal 14/11/2025
Descrizione: executive summary
Dimensione
512.42 kB
Formato
Adobe PDF
|
512.42 kB | Adobe PDF | Visualizza/Apri |
2024_12_Sgroi_Tesi.pdf
solo utenti autorizzati a partire dal 14/11/2025
Descrizione: testo tesi
Dimensione
2.34 MB
Formato
Adobe PDF
|
2.34 MB | Adobe PDF | Visualizza/Apri |
I documenti in POLITesi sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.
https://hdl.handle.net/10589/231103