Abstract
In the last years, researchers and practitioners have focused on defining portfolio optimization approaches. This task aims to identify a suitable distribution of assets for maximizing profits and minimizing risks, also offering protection against unexpected market behaviors. Nevertheless, the state-of-the-art approaches encounter significant limitations due to the complex nature of the task: (1) forecasting of non-stationary, non-linearity and volatile stock price; (2) budget allocation over different stocks satisfying multi-objective objective function; (3) risk costs can significantly affect the effectiveness of the designed approaches. In this paper, we propose a cognitively inspired framework for portfolio optimization by integrating deep learning-based stock forecasting for maximizing the revenue and portfolio diversification and Shape Ratio for minimizing the risk. Furthermore, the cognitively inspired forecasting module relies on the LSTM-based approach which combines historical financial data and technical indicators. Hence, this approach addresses the portfolio optimization task with the aim of designing more and more cognitive agents that perform autonomous actions for supporting decision-making. To make these agents cognitive, we further integrate stock forecasting into the portfolio optimization model, also investigating the main factors affecting both stock forecasting and portfolio optimization tasks. The proposed framework has been evaluated in two stages on a real-world dataset, composed of four years of information about stocks from six different areas. Firstly, we compare the proposed forecasting models based on LSTM and GRU, pointing out that the former achieves higher effectiveness results although the latter has a shorter training time. Finally, the proposed framework has been compared with different baselines, obtaining a net difference of $168 at the maximum. Finally, we compare the proposed approach w.r.t. several baselines in terms of total revenue, also providing an ablation analysis to investigate how stock prediction might support investors in dealing with portfolio optimization task.
Similar content being viewed by others
Avoid common mistakes on your manuscript.
Introduction
In the last decade, machine and deep learning models have made significant advances in many applications, prompting investors and financial institutions to design profitable trading strategies [1, 2]; in fact, stock exchanges trade assets worth billions of dollars on a daily basisFootnote 1 while investors seek to achieve profitable returns over their investment horizons by participating in the market. Hence, investing in the capital market may present opportunities to increase expected returns from the investment compared to traditional financial approaches such as savings and time deposits [3].
Therefore, practitioners and researchers have focused their attention on the optimization of a portfolio, which is composed of a collection of financial assets (i.e., stocks, bonds, currencies, cryptocurrencies, and others) [4, 5]. Redistributing these assets of a portfolio to increase the rate of return on investment is commonly defined as portfolio optimization [6, 7], in which the aim is to distribute investment among several assets to jointly maximize returns and minimize the risks [2, 8].
There are two main types of investment strategies (active and passive), as pointed out by [9]. The former aims to beat the average return on the stock market through a careful stock selection process [10] although its long-term performance is unstable because it can change dramatically over time. In turn, the latter [11] aims to achieve the average market returns through a buy-and-hold strategy, which is less complex than active investment.
One of the most used models for portfolio optimization is the Mean-Variance (MV) model proposed by [12], which is a multi-objective problem to jointly maximize the return on investment and minimize the risks. Following Markowitz’s pioneering work, the standard Mean-Variance (MV) model has extended over different directions [13] although they are mainly focused on the improvement and expansion of the MV model without adequately addressing the selection of high-quality assets before creating an optimal portfolio [14].
Despite the financial market attracting the attention of several researchers and practitioners to maximize their profit from their investment [15], it is known to be highly non-linear and volatile [16]. Hence, predicting the temporal behavior of stocks modeled as a time series is considered a challenging task [17]. Furthermore, it is important to identify the intrinsic value of a given stock for mitigating market deterioration and asset loss value [18]. Specifically, one of the main factors in portfolio optimization concerns stock market forecasting due to the increasing attention on identifying high-quality stock selection before optimizing the portfolio. In fact, the effectiveness of the portfolio optimization task is strongly affected by the stock market performance, as shown by [19], requiring more and more accurate forecasting to maximize the return from investment and mitigate risk.
Nevertheless, these methods encounter significant limitations due to the complex nature of the task. Firstly, modeling the non-stationarity, non-linearity, and uncertainty of price series is a critical concern due to the prevalence of noise, jumps, and fluctuations [20, 21]. Second, another challenge concerns how investment budget is distributed among different stocks in terms of numbers and business sectors, falling under the name portfolio diversification [6]. Finally, transaction and risk costs can significantly affect the effectiveness of the designed approaches [22].
In this paper, we propose a cognitively inspired framework for optimizing asset allocation to maximize the revenue from the investments and minimize the related risks, mainly relying on Artificial Intelligence (AI) models that are becoming more and more pervasive in the financial domain as shown in [1]; in fact, [23] underlined the relevance of integrating machine learning-based stock forecasting approaches in portfolio optimization. In particular, we integrate a Long Short-Term Memory (LSTM)-based model, which is one of the most used for predicting time series [24], to forecast stock trends by combining historical financial data and technical indicators. Hence, the main novelty of the proposed approach relies on the design of a cognitively inspired portfolio optimization framework by integrating both deep learning-based forecasting to predict stock trends for maximizing revenue and portfolio diversification and Shape Ratio for minimizing risk. In particular, it deals with the portfolio optimization task to design cognitive agents that perform autonomous actions for supporting decision-making, as also discussed by [25]. This approach falls under the umbrella term of Cognitive Computing (CC) since it is an Artificial Intelligence-based solution representing an important driver for knowledge-rich automation work, satisfying the definition of CC provided by [26]. We further integrate the stock forecasting into the portfolio optimization model, whose need for tight integration has been underlined by [23]. Furthermore, we investigate the main factors affecting the stock forecasting task, which is based on the analysis of various data to make predictions that are the main fundamental of cognitive systems as discussed by [27].
Summarizing, the main novelties of the proposed framework concerns:
-
Design of cognitively inspired prediction model for stock forecasting by combining historical financial data and technical indicators;
-
Design of a portfolio optimization framework by integrating both deep learning-based forecasting to predict stock trends for maximizing the revenue and portfolio diversification and Shape Ratio for minimizing the risk;
-
Evaluation of the proposed framework in a real-world scenario by considering stocks in different industrial domains which in pairs strongly influence each other to satisfy the portfolio differentiation. In particular, we compare the effectiveness of the proposed approach w.r.t. several baselines, also providing an ablation study to verify the integration of a deep learning-based approach for stock forecasting into the portfolio optimization model.
The remainder of the paper is organized as follows. The state-of-the-art approaches to portfolio optimization have been investigated in the “Related Work” section, also underlining the main novelties of the proposal. The “Methodology” section describes the proposed methodology, detailing its main components (stock forecasting and portfolio optimizer). The evaluation analysis has been presented in the “Experimental Evaluation” section, in which we described experimental protocol with the related assessment metrics, while the “Results” section discusses the efficiency and effectiveness results on a real-world dataset w.r.t. different baselines. Finally, the “Conclusion” section summarizes the main findings of the analysis, also pointing out possible future directions. The used notations are shown in Table 1.
Related Work
In the last years, different researchers have focused their attention on portfolio optimization task [6, 13], which is defined as a multi-objective problem for optimizing allocation assets and minimizing the associated risk [13, 17]. Specifically, portfolio optimization aims to find the optimal allocation over different assets taking into account three different risks, as shown in [28]: (i) quantification risk through statistical measure; (ii) asset diversification and (iii) trade-off between risk and return.
Despite that the Markowitz Mean-Variance (MV) model [29] represents the fundamental of the modern portfolio theory, it suffers from multiple limitations for practical applications (e.g., limited assumptions and high computational complexity). Hence, numerous studies have been designed to enhance the MV model [28], mainly based on optimization approaches [30, 31]. The former defined a mixed-integer semidefinite optimization problem with cardinality constraints for limiting the number of invested assets through the analysis of the probability distribution of asset returns. They further designed a cutting-plane algorithm to solve the defined problem. In turn, [31] relied on multi-objective strategies (see [32] for more details) to deal with the computational complexity of portfolio optimization. Furthermore, another challenge concerns the covariance matrices computed from empirical finance data that appear to contain a high amount of noise, requiring specific filtering methods, as shown in [33]. However, the non-linearity and highly non-stationary nature of stock trends pose several challenges in the forecasting task [34].
Over the past decade, machine learning and deep learning techniques have driven significant advances across many application areas, which inspired investors and financial institutions to develop machine learning-aided trading strategies [35, 36]. Integrating AI-based models in portfolio optimization might prevent behavioral economic biases [37]. Chen et al. [7] designed the MV model, in which stocks are selected among the ones with higher potential returns through eXtreme Gradient Boosting (XGBoost), whose hyper-parameters are computed by using an improved firefly algorithm. In [31], the authors combined multiple neural networks output through the particle swarm optimization (PSO)-based weight optimization. In turn, the relevance of Technical Analysis indicators has been investigated by [38, 39] as case studies for stock prediction and portfolio optimization, respectively. However, some of them are lagging indicators, affecting the effectiveness of stock trading and portfolio management.
Since AI-based models have shown overwhelming superiority over well-known statistical methods, incorporating the return prediction of traditional time series models can improve the performance of the original portfolio optimization model, as shown in [40]. Specifically, [23] have underlined the need for a tight integration of stock forecasting approaches based on artificial intelligence in the portfolio optimization process. Recent developments in deep learning techniques have motivated intensive research in AI-aided stock trading strategies. Hence, several researchers have designed portfolio optimization using deep learning approaches since that has the potential to significantly enhance the efficiency of portfolio selection processes and improve the return on the investment [9, 41].
Other approaches [7, 40] aimed to make stock pre-selection before portfolio optimization by integrating Long Short-Term Memory (LSTM) and Convolutional Neural Network (CNN) into the MV model, respectively. Two-stage approaches have been further proposed by [23, 42] for portfolio optimization. Specifically, the former first computes backward the portfolio value that would have had in past periods based on the time series of its stocks, and, successively, the future value of the portfolio is predicted through a damped trend model. In turn, [23] designed an approach for a man-value-at-risk portfolio optimization model in which the stock trends have been predicted through well-known machine learning models. Bisht and Kumar [19] proposed a further approach for portfolio optimization by selecting the highest performing stocks in previous years, extracted from strong sectors, that are identified through Dempster-Shafer evidence theory based on historical closing prices. In turn, [22] designed a Reinforcement Learning-based approach for portfolio optimization by considering dynamic risks according to market conditions for dynamic portfolio rebalancing.
Nevertheless, the financial market has a highly non-stationary nature hindering the application of typical data-hungry machine learning methods [6], often requiring to analyze contextual information [43,44,45] that makes stock forecasting a more and more challenging task. Hence, some approaches have been developed to incorporate these features in the stock prediction process, as proposed for instance by [46], that designed a multi-source aggregated-based approach for classifying stock price movement. Furthermore, the predicted value of news and social media has been investigated by [47], whose analysis unveiled that news and social media content are more effective with a one and two-to-five-day range, respectively. Nevertheless, the large amount of financial news, the heterogeneity of data sources, and the variety of events to extract from the textual content pose several challenges in integrating news content into the stock forecasting process. Therefore, the use of cognitive agents is required to analyze and predict financial market.
The main novelties of this approach w.r.t. the state-of-the-art ones concern:
-
The design of a cognitively inspired forecasting module that combines historical financial data and technical indicator w.r.t. other approaches [43,44,45] relying on social network and news, whose analysis is very sensitive to noise introduced by fake news spread [48] and malicious users actions [48], that are difficult to identify;
-
A cognitively inspired portfolio optimization approach relies on forecasting score of stock trend and risk factor, integrating the stock diversification into the model, w.r.t. [7, 40], that only incorporates AI-based models for the pre-selection purpose.
-
The design of a portfolio optimization model based on cognitively inspired stock forecasting which combines historical and technical data w.r.t. [23], that do not consider the multi-source analysis and short-time dependency of stock features over the time.
Methodology
Figure 1 shows the overall flow of the proposed cognitively inspired framework, starting from the data crawling until portfolio optimization. In particular, we crawled data from financial data sources (see the “Source Identification” section), that are, successively, pre-processed to feed as input to a machine learning model for stock forecasting. Finally, we integrate risk factor and stock forecasting into the optimizer which will then distribute the budget into the appropriate investments.
Task Definition
In this section, we provide a formal definition of the addressed task, aiming to identify the optimal allocation of financial investments, also called assets. We deal with this task by first estimating the stock price trends that are, successively, used as variables in the optimization model to select a collection of assets. In particular, the first task falls under the name of theStock forecasting (see Definition 1), which is a challenging task due to the highly noisy dynamic, non-linear, non-parametric, and chaotic nature of stock data.
Definition 1
Stock Forecasting. Let \(s_{i,t_0},\ldots ,s_{i,t_N}\) be N observations about historical information of the stock \(s_i\), the stock forecasting task aims to provide an approximation of the function \(Y=f(s_{i,t_0},\ldots ,s_{i,t_N})\), which maps N stock historical values into the target variable score.
In turn, the second task (Portfolio optimization task, aims to build a time-dependent sequence of stocks for maximizing the investment and minimizing the risk (see Definition 2).
Definition 2
Portfolio Optimization. Let \(S=\{s_1,\cdots ,s_N\}\) be a set of assets, we define the portfolio optimization task as the weighted selection of stocks on which to make an investment of a specific amount of money. In particular, a percentage of investment (\(w_i\)) is invested on the i-th stock to maximize the total return of investment \(R=\sum _{i=0}^N {r_i x_i}\) where \(r_i\) is the return of investment for the i-th stock and \(x_i=0/1\) represents whether the stock is considered within the portfolio or not.
Hence, we define portfolio optimization as a multi-objective problem to identify the best investment proportion of stocks while minimizing investment risk. Nevertheless, the task of predicting stock market returns has become more and more challenging due to non-linearity and non-stationary characteristics within financial time series data.
Data Pre-processing
In this section, we analyze the main information composed of the collected dataset (see the “Source Identification” section) and the pre-processing operations (see the “ Data Manipulation” section) made on them.
Source Identification
In the stock market, different information (e.g., trading volume or opening/closing price) is taken into account for investigating the stock trend. In particular, a set of corporate actions affects the share capital of a listed company which results in a change in the value of the shares involved in the transaction.
We consider different features for each stock extracted from Yahoo FinanceFootnote 2 for each date in the interval of analysis:
-
1.
Opening Price
-
2.
Closing Price
-
3.
Adjusted Closing Price
-
4.
Highest Price Reached in the Day
-
5.
Lowest Price Reached in the Day
-
6.
Volume Weighted Average Price
Once these data have been extracted for any stock, different pre-processing operations (i.e., correlation analysis and data scaling) have been performed.
Data Manipulation
In this section, we discuss the pre-processing operations made for unveiling the most relevant features to deal with the designed task. Since we aim to predict the next-day closing price which will be one of the input variables of the proposed portfolio optimization model, we perform the correlation analysis among features w.r.t. the target. We made this analysis by choosing three different stocks (Apple (AAPL), Microsoft (MSFT) and Disney (DIS)), whose outcomes are shown in Table 2. It is easy to note that most of the features are highly correlated; in fact, High and Low attributes represent the upper bound and the lower bound of the two prices of “Open” and “Close” which themselves are quite related. It is worth noticing that Close and Volume features are the most discriminating ones observing the results shown in Table 2.
Stock Forecasting
In this section, we describe the proposed cognitively inspired model for predicting the financial trend of a stock. The reason behind this workflow is mainly due to the need for tightly integration of AI-based stock prediction in the forecasting process, as shown by [23]. Hence, the main novelty of this module is to forecast stock behavior by combining historical financial data and technical indicators, which are often applied in buy and sell signals for stocks. This module relies on an LSTM model, whose internal architecture has been shown in Fig. 2, which has been chosen because it achieves higher results [49] in predicting time series trends. This architecture is able to capture the non-linear dependency of independent variables and the target one making it more suitable for supporting financial applications with respect to the conventional linear models, as shown in [50, 51].
The LSTM architecture aims to unveil temporal dependencies inside the time series through a set of gates, that manage the knowledge flowing inside the cell. The advantage of using LSTM cells is twofold: i) they are designed to solve the vanishing gradient problemFootnote 3 and ii) they learn patterns from long-time sequences.
Portfolio Optimization
This module is based on an optimization approach on the model 1, relying on a slightly modified Markowitz’s model [12], by integrating forecasting predictions made by the previous module and risk factor in a unified optimization model. Its fundamental principle relies on the need to jointly minimize the risk and maximize the overall return by compensating for the asynchronous trends of the individual securities.
Despite classic portfolio optimization models rely on mean historical return as expected return, they obtain an inaccurate estimation of future short-term returns [40]. Specifically, we consider a percentage of the same invested budget that must be exceeded as a target variable.
In this case, the factor p will be chosen as the percentage of the budget to exceed while \(x_i\) and \(r_i\) represent the percentage of budget and return that a user wants to invest and return based on the forecast made by the stock forecasting module, respectively. Furthermore, \(\sigma _{ij}\) is inferred from the average of the log-returns of a single stock, which is computationally efficient. The third constraint simply indicates that all the available budget must be used while we do not consider the possibility of short selling in the last constraint.
In turn, a further attempt was made by modifying the objective function to maximize the Sharpe Ratio of the financial portfolio.
In particular, \(lr_i\) is the average of the log-returns of a single stock, while V is the volatility of the financial portfolio obtained through the log-return covariance matrix.
Experimental Evaluation
The proposed framework has been designed for next-day portfolio optimization by allocating the investment budget over a subset of stocks. In this section, we discuss the effectiveness and efficiency results of the proposed framework according to the experimental protocol described in the “Experimental Protocol” section. Furthermore, we detail the hyper-parameter tuning process for each module to identify their best configuration (see the “Hyper-parameter Tuning” section) and parameter tuning (see the “ Portfolio Optimizer Tuning” section).
Experimental Protocol
In this section, we describe the experimental protocol used to evaluate the efficiency and effectiveness of the proposed approach after performing a parameter tuning.
For this reason, the aim of the experimental protocol is fourfold:
-
Effectiveness of stock prediction in terms of Root Mean Squared Error (RMSE) - GAIN varying the number of epochs and time window;
-
Efficiency and effectiveness of portfolio optimization in terms of Running Time and Gain, respectively.
-
Effectiveness comparison of the proposed approach w.r.t. several baselines in terms of Total Revenue;
-
An ablation analysis to investigate how stock prediction might support investors in dealing with the portfolio optimization task.
The dataset has been collected from Yahoo Finance,Footnote 4 starting from 01-01-2016 to 01-01-2020, considering two stocks for six different areas because one of the critical issues in portfolio optimization concerns the “portfolio differentiation” [6]. Specifically, it means that the available budget is invested in stocks of different areas:
-
1.
Tech: Apple (AAPL), Microsoft (MSFT)
-
2.
Chemical: DuPont (DD), Abbott Laboratories (ABT)
-
3.
Automotive: Ford (F), HMC (Honda)
-
4.
Pharmaceutical: Johnson & Johnson (JNJ), Albemarle Corporation (ABL)
-
5.
Food: McDonald (MCD), Coca-Cola (KO)
-
6.
Entertainment: Electronic Arts (EA), Disney (DIS)
We evaluate the effectiveness of Stock Forecasting task through the Root Means Squared Error (RMSE), which is defined according to Eq. 3:
where N is the number of observation and \(y_i\) and \(\hat{y}_i\) are the real and predicted values, respectively.
In turn, we use the total revenue for evaluating the Portfolio Optimization, which is the amount of money earned or lost during the process.
The framework has been deployed on Google ColabFootnote 5 platform while the software stack relies on Python 3.6 with yfinance,Footnote 6 for crawling financial data on which we compute technical indicator through Ta-lib,Footnote 7 and TensorFlowFootnote 8 and ScipyFootnote 9 to design deep learning models and to perform optimization algorithm, respectively.
Hyper-parameter Tuning
In this section, we investigate the hyper-parameter optimization process for each stage of the proposed methodology (i.e., Stock Forecasting and Portfolio Optimizer). In particular, we perform the hyper-parameter tuning by splitting the entire dataset into three sets: train (\(70\%\)), validation (\(20\%\)), and test (\(10\%\)). Once hyper-parameter tuning has been performed by identifying the best model’s parameters, we used them for the evaluation process described in the “Results” section.
Stock Forecasting Tuning
In this section, we describe the hyper-parameter tuning made at each stage of the proposed framework. Firstly, we evaluate the window size for stock forecasting on the basis of the RMSE, varying five different time windows (3, 5, 10, 30, and 45 days) and different epochs (3, 10, 30, 100). Doing five tests and taking the average of the RMSEs, the following tables were obtained.
In this analysis, we used an LSTM-based model composed of 2 LSTM layers, having 100 neurons for each level and two Dense layers, composed of one with 25 and the other one with one neuron, respectively. The model has been trained by choosing Adam as the optimizer and the Mean Squared Error as the loss parameter.
It is worth noticing in Table 3 that the best RMSE score has been achieved using the 3-day time window. This observation is aligned with the main findings inferred by [52], which state that using window size closest to the forecast horizon may enhance the effectiveness of the prediction module to deal with the non-linearity and non-stationary market behavior.
Afterward, we are interested in integrating financial indicators into our data set to improve the effectiveness performance of the forecasting module although we found that only the Percentage Price Oscillator (PPO) achieves good performance in terms of RMSE. This indicator measures the Momentum, which is the speed at which the price is changing.
PPO has been computed as the nine-day Exponential Moving Average (EMA), decreased and, successively, divided by the 26-day EMA. We provide a formal definition of PPO in Eq. 4, where EMA is the exponential moving average of the stock’s closing price.
It is worth noticing in Table 4 that PPO achieves the highest results in terms of RMSE w.r.t. other technical indicators (see Table 5). Furthermore, Table 4 shows that the number of epochs to train the designed network turns out to be around 100 epochs.
In Table 6, we show the RMSE outcomes (mean and standard deviation) of the forecasting module by combining close price and PPO. For each stock, 10 tests have been carried out, maintaining the 100 training periods and varying the time window among three possible values (3 days, 10 days, 30 days).
Portfolio Optimizer Tuning
In this section, we are focused on the tuning of the optimizer module evaluated in terms of revenues, varying to main parameters (earning percentage and risk factor). The former represents the amount of budget earned per day among (\(0.5\%\), \(1\%\), \(2\%\) and \(3\%\)) choosing an initial budget equal to 15, 000 while the latter is represented through the covariance of stocks and the Sharp Ratio.
Table 7 shows the outcomes of the tuning of the optimizer module by computing the stock covariance matrix over different time periods (one month and one year). For each forecast week, we carried out 5 trials by computing the gain and losses identified at the end of the experiments.
In turn, Table 8 reports the results obtained by using the Shape Ratio over different time horizons. Specifically, we consider the annualized year and month [53] by multiplying the value by the square root of 252 and 12, respectively. A final test has been carried out by considering a not annualized Shape Ratio, which means to take the previous month’s score ratio data and applying it as the optimizer’s risk matrix.
Results
In this section, we discuss the efficiency (“Efficiency Analysis” section) and effectiveness (“Effectiveness Analysis” section) results of the proposed methodology, also comparing it with respect to several baselines.
Efficiency Analysis
We evaluate the effectiveness of the proposed methodology by varying both the window size (5, 10 and 15) and the number of stocks (6, 12, 20, 30, 50), using the number of training epochs equal to 100 (the best values identified in the optimization phase, as shown in Table 4). Specifically, we compute the mean and standard deviation over 10 repetitions for each parameter combination.
As shown in Table 9, the rise in the number of stocks and the window size increases the training time (in seconds) almost linearly.
In turn, Fig. 3 shows training time in seconds to compare the efficiency performance of LSTM and Gated Recurrent Unit (GRU)-based forecasting module varying both windows size and the number of stocks. In particular, Fig. 4 shows the internal architecture of the designed GRU-based forecasting module.
At the end of this analysis, we can observe in Table 9 and Fig. 3 that the worst scenario (i.e., forecast analysis considering a 15-day window and 50 stock) requires a training time around 2 h and 15 min, being suitable for the scenario which we had set. However, the training time in the worst case is decreased to 1 h and 5 min, having identified the best window size to 3 days during the hyper-parameter setting (see Table 3). Finally, it is worth noting in Fig. 3 that GRU is faster than the LSTM because the former is composed of fewer parameters.
Effectiveness Analysis
We evaluate the effectiveness of the proposed approach by firstly comparing the performance of the proposed methodology integrating LSTM and GRU and, successively, w.r.t. two optimization-based approaches [54, 55]. We carried out this experimental analysis by considering 2 weeks, which corresponds to consider 10 days since that Saturday and Sunday are not trading days for the stock market.
Table 10 shows the experimental outcomes in terms of total revenue, obtained by comparing two versions of the proposed methodology integrating LSTM and GRU, respectively. Although the GRU model shows a shorter training time than LSTM, the latter achieves higher effectiveness results, as shown in Table 10.
In Table 11, we compare the proposed LSTM-based methodology w.r.t. two baselines in terms of total revenue over two weeks.
It is worth noting during the first week that the proposed approach based on Sharpe Ratio outperforms the other baselines, which lose $57 and $48, respectively. Although the proposed approach loses money during the second week, we can see that it achieves a gain of $88.5, leading to obtain a net difference of a maximum of $168 over the baselines.
Comparison w.r.t. State-of-the-Art Approaches
In this section, we compare the effectiveness of the proposed approach with several state-of-the-art baselines on the entire test set in terms of total revenue. The proposed approach is composed of two phases: the former predicts stock’s trend and the latter performs portfolio optimization integrating the outcome of the previous phase. Hence, we choose as baselines approaches proposed by [7, 19, 40], that perform AI-based stock pre-selection before optimizing portfolio. Table 12 shows the outcome of the comparison on the entire test set. It is worth noticing that the proposed approach outperforms the baselines, showing the highest total revenue (up to \(77.29\%\)). In particular, the proposed approach and the one designed by [40] yield the highest total revenue, with a difference compared to the worst result of \(77.29\%\) and \(59.82\%\), respectively. This demonstrates how the integration of machine learning models for stock forecasting into the optimization task leads to gain better results.
Summarizing, the proposed framework improves the portfolio optimization task by combining an analysis of the stock features over time through an LSTM-based model, portfolio diversification, and Shape Ratio for minimizing.
Ablation Study
In this section, we describe the ablation study made for evaluating how the effectiveness of stock forecasting might affect the performance of the portfolio optimization, Specifically, we consider two different strategies for optimizing the portfolio: the former performs pre-selection of stocks and optimizing portfolio while the second one only performs portfolio optimization.
The obtained results in terms of total revenue are shown in Table 13, where it is possible to note that the proposed approach shows the highest score. In particular, this outcome supports the idea that a better prediction of the real market can improve the portfolio optimization approach by supporting investors in choosing robust optimization strategies.
Conclusion
Over the past few years, the widespread diffusion of Artificial Intelligence has radically transformed the financial domain [56], with a particular focus on stock market analysis due to its growing relevance in the real world. Hence, several practitioners and researchers have focused their activities in designing methods for predicting market behavior with the aim of maximizing profits from investment activities.
In this paper, we designed a cognitively inspired framework for portfolio optimization to optimize the budget distribution over different stocks according to the prediction made and the risk factor associated with the investment. In particular, we integrate stock diversification into the optimization to diminish the risk. This framework relies on an LSTM-based forecasting module that combines historical data and technical indicators for predicting securities behaviors.
The proposed framework has been evaluated on a real-world dataset, composed of information about several stocks starting from 01-01-2016 to 01-01-2020. Firstly, we evaluated the effectiveness and efficacy performances of the forecasting module by comparing two different versions based on LSTM and GRU, respectively. Although the GRU model has a shorter training time than LSTM, the latter achieves higher effectiveness results. Furthermore, we compared the proposed framework w.r.t. different baselines [54, 55] obtaining a net difference of $168 at maximum. We further provided a comparison analysis between the proposed approach w.r.t. several state-of-the-art methodologies [7, 19, 40], in which it is worth noticing that the proposal outperforms the baselines showing the highest total revenue (up to \(77.29\%\)).
Future works will be devoted to extending the examined dataset by increasing the number of stocks and industrial domains. Furthermore, we will investigate how transaction costs as well as content information inferred from news and/or Social Media can be integrated into the proposed framework to improve its effectiveness in dealing with portfolio optimization.
Data Availability
The authors do not have permission to share data.
Notes
The vanishing gradient problem describes a situation where the weights of some RNNs remain the same during training.
References
Tang Y, Song Z, Zhu Y, Yuan H, Hou M, Ji J, Tang C, Li J. A survey on machine learning models for financial time series forecasting. Neurocomputing. 2022;512:363–80. https://doi.org/10.1016/j.neucom.2022.09.003.
Ghahtarani A, Saif A, Ghasemi A. Robust portfolio selection problems: a comprehensive review. Oper Res Int Journal. 2022;22(4):3203–64. https://doi.org/10.1007/s12351-022-00690-5.
Campanella F, Serino L, Battisti E, Giakoumelou A, Karasamani I. FinTech in the financial system: towards a capital-intensive and high competence human capital reality? J Bus Res. 2023;155: 113376. https://doi.org/10.1016/j.jbusres.2022.113376.
Loke ZX, Goh SL, Kendall G, Abdullah S, Sabar NR. Portfolio optimization problem: a taxonomic review of solution methodologies. IEEE Access. 2023;11:33100–20. https://doi.org/10.1109/ACCESS.2023.3263198.
Erwin K, Engelbrecht A. Meta-heuristics for portfolio optimization. Soft Comput. 2023;1–29. https://doi.org/10.1007/s00500-023-08177-x.
Gunjan A, Bhattacharyya S. A brief review of portfolio optimization techniques. Artif Intell Rev. 2023;56(5):3847–86. https://doi.org/10.1007/s10462-022-10273-7.
Chen W, Zhang H, Mehlawat MK, Jia L. Mean-variance portfolio optimization using machine learning-based stock price prediction. Appl Soft Comput. 2021;100: 106943. https://doi.org/10.1016/j.asoc.2020.106943.
Xidonas P, Steuer R, Hassapis C. Robust portfolio optimization: a categorized bibliographic review. Ann Oper Res. 2020;292(1):533–52. https://doi.org/10.1007/s10479-020-03630-8.
Li XP, Shi ZL, Leung CS, So HC. Sparse index tracking with K-sparsity or \(\epsilon\)-deviation constraint via \(\cal L\it _{o}\)-norm minimization. IEEE Trans Neural Netw Learn Syst. 2022;1–14. https://doi.org/10.1109/TNNLS.2022.3171819.
Zheng Y, Chen B, Hospedales TM, Yang Y. Index tracking with cardinality constraints: a stochastic neural networks approach. In: Proceedings of the AAAI Conference on Artificial Intelligence, vol 34. 2020. p. 1242–9.
de Amorim TW, Silva JCS, de Almeida Filho AT. Assessing the interactions amongst index tracking model formulations and genetic algorithm approaches with different rebalancing strategies. Soft Comput. 2023;1–14. https://doi.org/10.1007/s00500-023-09185-7.
Markowitz HM. Protfilio selection J Financ. 1952;7:77–91. https://doi.org/10.1111/j.1540-6261.1952.tb01525.x.
Lai ZR, Yang H. A survey on gaps between mean-variance approach and exponential growth rate approach for portfolio optimization. ACM Comput Surv. 2022;55(2). https://doi.org/10.1145/3485274.
Ahmed S, Chakrabortty RK, Essam DL, Ding W. Poly-linear regression with augmented long short term memory neural network: Predicting time series data. Inf Sci. 2022;606:573–600. https://doi.org/10.1016/j.ins.2022.05.078.
Mittal SK, Srivastava N. Mean-variance-skewness portfolio optimization under uncertain environment using improved genetic algorithm. Artif Intell Rev. 2021;1–22. https://doi.org/10.1007/s10462-021-09966-2.
Wu ME, Syu JH, Lin JCW, Ho JM. Effective fuzzy system for qualifying the characteristics of stocks by random trading. IEEE Trans Fuzzy Syst. 2022;30(8):3152–65. https://doi.org/10.1109/TFUZZ.2021.3105192.
Thakkar A, Chaudhari K. A comprehensive survey on portfolio optimization, stock price and trend prediction using particle swarm optimization. Arch Comput Meth Eng. 2021;28(4):2133–64.
Huynh TT, Nguyen MH, Nguyen TT, Nguyen PL, Weidlich M, Nguyen QVH, Aberer K. Efficient integration of multi-order dynamics and internal dynamics in stock movement prediction. In: Proceedings of the Sixteenth ACM International Conference on Web Search and Data Mining, Association for Computing Machinery, New York, NY, USA, WSDM ’23. 2023. p. 850–8. https://doi.org/10.1145/3539597.3570427.
Bisht K, Kumar A. A portfolio construction model based on sector analysis using Dempster-Shafer evidence theory and Granger causal network: an application to National stock exchange of India. Expert Syst Appl. 2023;215: 119434. https://doi.org/10.1016/j.eswa.2022.119434.
Wang J, Cui Q, Sun X, He M. Asian stock markets closing index forecast based on secondary decomposition, multi-factor analysis and attention-based LSTM model. Eng Appl Artif Intell. 2022;113: 104908. https://doi.org/10.1016/j.engappai.2022.104908.
de A. Araújo R, Ferreira TA. A morphological-rank-linear evolutionary method for stock market prediction. Inf Sci. 2013;237:3–17. https://doi.org/10.1016/j.ins.2009.07.007.
Lim QYE, Cao Q, Quek C. Dynamic portfolio rebalancing through reinforcement learning. Neural Comput Appl. 2022;34(9):7125–39. https://doi.org/10.1007/s00521-021-06853-3.
Behera J, Pasayat AK, Behera H, Kumar P. Prediction based mean-value-at-risk portfolio optimization using machine learning regression algorithms for multi-national stock markets. Eng Appl Artif Intell. 2023;120: 105843. https://doi.org/10.1016/j.engappai.2023.105843.
Md AQ, Kapoor S, Chris Junni AV, Sivaraman AK, Tee KF, Sabireen H, Janakiraman N. Novel optimization approach for stock price forecasting using multi-layered sequential LSTM. Appl Soft Comput. 2023;134: 109830. https://doi.org/10.1016/j.asoc.2022.109830.
Mohagheghi V, Mousavi SM. D-WASPAS: addressing social cognition in uncertain decision-making with an application to a sustainable project portfolio problem. Cogn Comput. 2020;12:619–41. https://doi.org/10.1007/s12559-019-09679-3.
Sreedevi A, Nitya Harshitha T, Sugumaran V, Shankar P. Application of cognitive computing in healthcare, cybersecurity, big data and IoT: a literature review. Inf Process Manag. 2022;59(2): 102888. https://doi.org/10.1016/j.ipm.2022.102888.
Xu L, Xu W, Cui Q, Li M, Luo B, Tang Y. Deep heuristic evolutionary regression model based on the fusion of BiGRU and BiLSTM. Cogn Comput. 2023;1–15.
Kolm PN, Tütüncü R, Fabozzi FJ. 60 Years of portfolio optimization: Practical challenges and current trends. Eur J Oper Res. 2014;234(2):356–71. https://doi.org/10.1016/j.ejor.2013.10.060.
Fabozzi FJ, Gupta F, Markowitz HM. The legacy of modern portfolio theory. J Invest. 2002;11(3):7–22.
Kobayashi K, Takano Y, Nakata K. Cardinality-constrained distributionally robust portfolio optimization. Eur J Oper Res. 2023. https://doi.org/10.1016/j.ejor.2023.01.037.
Leung MF, Wang J. Minimax and biobjective portfolio selection based on collaborative neurodynamic optimization. IEEE Trans Neural Netw Learn Syst. 2021;32(7):2825–36. https://doi.org/10.1109/TNNLS.2019.2957105.
Liang J, Ban X, Yu K, Qu B, Qiao K, Yue C, Chen K, Tan KC. A survey on evolutionary constrained multi-objective optimization. IEEE Trans Evol Comput. 2022;1–1. https://doi.org/10.1109/TEVC.2022.3155533.
Puerto J, Ricca F, Rodríguez-Madrena M, Scozzari A. A combinatorial optimization approach to scenario filtering in portfolio selection. Comput Oper Res. 2022;142: 105701. https://doi.org/10.1016/j.cor.2022.105701.
Nam K, Seong N. Financial news-based stock movement prediction using causality analysis of influence in the Korean stock market. Decis Support Syst. 2019;117:100–12. https://doi.org/10.1016/j.dss.2018.11.004.
Wang J, Zhang Y, Tang K, Wu J, Xiong Z. AlphaStock: a buying-winners-and-selling-losers investment strategy using interpretable deep reinforcement attention networks. In: Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, Association for Computing Machinery, New York, NY, USA, KDD ’19. 2019. p. 1900–8. https://doi.org/10.1145/3292500.3330647.
Heaton JB, Polson NG, Witte JH. Deep learning for finance: deep portfolios. Appl Stoch Model Bus Ind. 2017;33(1):3–12. https://doi.org/10.1002/asmb.2209.
Hirshleifer D. Behavioral finance Annu Rev Financ Econ. 2015;7:133–59. https://doi.org/10.1146/annurev-financial-092214-043752.
Kochliaridis V, Kouloumpris E, Vlahavas I. Combining deep reinforcement learning with technical analysis and trend monitoring on cryptocurrency markets. Neural Comput Applic. 2023;1–18. https://doi.org/10.1007/s00521-023-08516-x.
Picasso A, Merello S, Ma Y, Oneto L, Cambria E. Technical analysis and sentiment embeddings for market trend prediction. Expert Syst Appl. 2019;135:60–70. https://doi.org/10.1016/j.eswa.2019.06.014.
Ma Y, Han R, Wang W. Portfolio optimization with return prediction using deep learning and machine learning. Expert Syst Appl. 2021;165: 113973. https://doi.org/10.1016/j.eswa.2020.113973.
Sharma M, Shekhawat HS. Portfolio optimization and return prediction by integrating modified deep belief network and recurrent neural network. Knowl-Based Syst. 2022;250: 109024. https://doi.org/10.1016/j.knosys.2022.109024.
Corberán-Vallet A, Vercher E, Segura JV, Bermúdez JD. A new approach to portfolio selection based on forecasting. Expert Syst Appl. 2023;215: 119370. https://doi.org/10.1016/j.eswa.2022.119370.
Zhai SS, Zhang ZD. Read the news, not the books: forecasting firms’ long-term financial performance via deep text mining. ACM Trans Manag Inf Syst. 2023;14(1). https://doi.org/10.1145/3533018.
Schmitz HC, Lutz B, Wolff D, Neumann D. When machines trade on corporate disclosures: using text analytics for investment strategies. Decis Support Syst. 2023;165: 113892. https://doi.org/10.1016/j.dss.2022.113892.
Li X, Wu P, Wang W. Incorporating stock prices and news sentiments for stock market prediction: a case of Hong Kong. Inf Process Manag. 2020;57(5): 102212. https://doi.org/10.1016/j.ipm.2020.102212.
Ma Y, Mao R, Lin Q, Wu P, Cambria E. Multi-source aggregated classification for stock price movement prediction. Inf Fusion. 2023;91:515–28. https://doi.org/10.1016/j.inffus.2022.10.025.
Dong H, Ren J, Padmanabhan B, Nickerson JV. How are social and mass media different in relation to the stock market? A study on topic coverage and predictive value. Inf Manag. 2022;59(2): 103588. https://doi.org/10.1016/j.im.2021.103588.
Zhu Y, Sheng Q, Cao J, Nan Q, Shu K, Wu M, Wang J, Zhuang F. Memory-guided multi-view multi-domain fake news detection. IEEE Trans Knowl Data Eng. 2023;35(7):7178–91. https://doi.org/10.1109/TKDE.2022.3185151.
Zhang Z, Zohren S, Roberts S. Deep learning for portfolio optimization. J Financ Data Sci. 2020;2(4):8–20.
Gu S, Kelly B, Xiu D. Empirical asset pricing via machine learning. Rev Financ Stud. 2020;33(5):2223–73.
Wu W, Chen J, Yang Z, Tindall ML. A cross-sectional machine learning approach for hedge fund return prediction and selection. Manage Sci. 2021;67(7):4577–601.
Weng B, Lu L, Wang X, Megahed FM, Martinez W. Predicting short-term stock prices using ensemble methods and online data sources. Expert Syst Appl. 2018;112:258–73. https://doi.org/10.1016/j.eswa.2018.06.016.
Geissel S, Graf H, Herbinger J, Seifried FT. Portfolio optimization with optimal expected utility risk measures. Ann Oper Res. 2022;1–19. https://doi.org/10.1007/s10479-021-04403-7.
Martin RA. PyPortfolioOpt: portfolio optimization in Python. J Open Source Softw. 2021;6(61):3066. https://doi.org/10.21105/joss.03066.
Cajas D. Riskfolio-lib (4.3.0). 2022. https://github.com/dcajasn/Riskfolio-Lib.
Cao, L. AI in finance: challenges, techniques, and opportunities. ACM Comput Surv. 2022;55(3). https://doi.org/10.1145/3502289.
Funding
Open access funding provided by Università degli Studi di Napoli Federico II within the CRUI-CARE Agreement. This work is supported by the Italian Ministry of Education, University and Research (MIUR) within the PRIN2022-ISALDI: Interpretable Stock Analysis Leveraging Deep multImodal models (CUP: E53D23008150006).
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Research Involving Human and Animal Participants
This article does not contain any studies with human participants performed by any of the authors.
Conflict of Interest
The authors declare no competing interests.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Carandente, V., Sperlí, G. Harnessing Cognitively Inspired Predictive Models to Improve Investment Decision-Making. Cogn Comput 16, 1237–1252 (2024). https://doi.org/10.1007/s12559-023-10240-6
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s12559-023-10240-6