Skip to main content

Modelling shares choice to enter in a portfolio using artificial neural networks (ANN)

Abstract

Shares choice to enter a portfolio is a good topic in finance and management, as it affects the portfolio performance which is managed by a Fund Manager. In this research, we aim to create an artificial neural network model to choose a share to enter a portfolio based on its financial factors and big data about the financial condition of companies. The artificial neural network model has 15 input nodes of attributes associated with a company’s financial situation, 8 hidden layer nodes, and 1 output node. The accuracy of the model is 85.71%, with a learning rate of 0.05 trained over 2000 iterations.

Introduction

Shares choice to enter a portfolio a special topic in finance and management and is very interesting to be discussed by both practitioners and academics. Shares choice to enter in a portfolio is very important for a Fund Manager when he manages his client’s fund. When a Fund Manager does not properly choose the share, it will affect target return and Investors will redeem their fund and looking the good performance. Share choice to enter a portfolio is a process to build a portfolio. Good shares portfolio consists of many shares that have good performance from the past and in the future. Research for shares choice becomes very important because the result will make the fund be sought by investors as a good investment. Good shares in a portfolio is a power to Fund Manager to sell it and investor to become large to buy the fund.

Markowitz [7] introduced a method of shares choice to enter a portfolio using risk and return. Elton et al. introduced an alternative to choose a share to enter a portfolio. The method is known as Excess Return to Beta which is using risk (beta) and returns. Wallingford [17] used the Single-Index, Multi-Index, and Full-Covariance Model to choose a share to enter a portfolio. Saaty et al. [15] stated that the Analytical Hierarchy Process (AHP) can be used to choose a share to enter a portfolio. AHP was developed by Saaty in 1970. Khaksari et al. [5] supported Saaty et.al’s research to use AHP to choose share to enter into a portfolio. Jones [4] introduced a network analysis to build a portfolio. Reily and Brown ([13], 272) stated that an optimal portfolio is an efficient portfolio to have the highest utility for the investor’s certainty.

Previous research used risk and return to choose a share enter in a portfolio, but it never discusses characteristics of the companies whose shares were entered into a portfolio, for example, market capitalization and financial ratio company. Farrell [3] investigated stock to enter in a portfolio using homogeneous stock grouping. Based on some previous researches, Common stocks tend to group naturally, according to their price behavior [8] and also P/E [10]. Wainscott [16] found that the changing of correlation between assets will significantly affect mixed-asset portfolio from one period to another period. Peritt and Lavine [11] stated that asset allocation is very important to build a portfolio. Marmer [9] explored an efficient frontier for Canadian’s Portfolio. Fama and French [2] explored another factor to affect portfolio return. Reinganum [14] did research and stated that market capitalization has an impact on managing portfolio. Manurung [6] used the Logit Method to choose a share to enter into a portfolio using financial ratios.

Shares choice to enter in a portfolio is still developed for research, especially to explore new methods. Recently, a research on Shares choice to enter in a portfolio was conducted using Artificial Neural Networks (ANN). Ashwood [1] explored ANN as a method to predict stock prices in shares portfolio, with a result of better than 50% accuracy for almost all of the stocks and portfolios tested. Rasekhschaffe and Jones [12] used Machine Learning to select stocks for building portfolio using deep neural networks (DNN). This paper explores the usage of ANN to choose a share to enter in a portfolio using financial situation data of several Indonesian companies.

Meanwhile, big data techniques, especially the volume of data, can be used in modeling shares choice to gather data to use as training and testing data for the ANN. Zhang et al. [18] stated that ANNs can extract features from raw data while big data provides tremendous training samples for the ANN, creating a mutual reinforcement. Thus, the use of big data is beneficial to improve this experiment in the future.

Proposed methods

The algorithms used for building the ANN was supervised stochastic learning with backpropagation and steepest gradient descent, with bias nodes at the hidden and output layer. The 31 data rows gathered were split into 80% training set and 20% test set. The model of the ANN was as shown in Fig. 1.

Fig. 1
figure1

The proposed model of ANN used in this research

The ANN takes 15 input data, X, of attributes associated with a company’s financial situation:

  • Cash Ratio (X1)

  • Current Ratio (X2)

  • Cash T. Assets (X3)

  • Cash Debt US$ (X4)

  • Free CF Debt US$ (X5)

  • Debt US$ Equity (X6)

  • MV E Debt US$ (X7)

  • Sales T. Assets (X8)

  • Net Inc. T. Assets (X9)

  • Net Inc. Equity (X10)

  • Operational Profit (X11)

  • R E T. Assets (X12)

  • EBIT T. Assets (X13)

  • Debts T. Assets (X14)

  • Free CF T. Assets (X15).

The hidden layer, H, which consists of 8 nodes, then extracts features from these data and sends a signal to the output layer, Y. The result is the probability of the company being bankrupt or not. To calculate the accuracy of the model, the test set is fed into the trained network, and if the probability is above 70%, then the company is bankrupt (Y = 1), otherwise, it is not bankrupt (Y = 0). This output is then compared with the actual labels of the test set.

The equations used in this research are as follows:

Linear combinations:

$$ o_{j} = \mathop \sum \limits_{i = 1}^{a} w_{ij} x_{i} + b_{1} $$
(1)
$$ p_{l} = \mathop \sum \limits_{k = 1}^{b} u_{kl} h_{m} + b_{2} $$
(2)

with: \( o_{j} , p_{n} \) as linear combination results for the hidden layer nodes and output layer nodes respectively; \( w_{ij} \) as weights from the input layer to the hidden layer; \( u_{kl} \) as weights from the hidden layer to the output layer; \( x_{i} \) as input nodes; \( h_{m} \) as hidden layer nodes; \( b_{1} , b_{2} \) as biases of the hidden layer and the output layer respectively; \( i, k \) as the index of nodes in the input layer and the hidden layer respectively; \( j, l \) as the index of nodes in the hidden layer and the output layer respectively; \( a, b \) as the number of nodes in the input layer and the hidden layer respectively.

Sigmoid activation function:

$$ h_{j} = \frac{1}{{1 + e^{{\left( { - o_{j} } \right)}} }} $$
(3)
$$ y = \frac{1}{{1 + e^{{\left( { - p_{l} } \right)}} }} $$
(4)

with: \( h_{j} \) as the hidden layer nodes’ output; \( y \) as the output layer node’s output; \( o_{j} , p_{l} \) as linear combination results for the hidden layer nodes and output layer nodes respectively.

Mean squared error:

$$ E = \frac{1}{2}\left( {t - y} \right)^{2} $$
(5)

with: \( E \) as error (or loss); \( t \) as the target output; \( y \) as the output layer node’s output

Steepest gradient descent:

$$ w_{new} = w_{old} + \Delta w $$
(6)
$$ \Delta w = - \alpha g_{n} \left( w \right) $$
(7)
$$ b_{new} = b_{old} + \alpha \left( {y - t} \right)\left( {1 - y} \right)\left( y \right) $$
(8)

with: \( w_{new} \) as the new weight value; \( w_{old} \) as the current weight value; \( \Delta w \) as the adjustment made to the current weight value; \( \alpha \) as learning rate\( g_{n} \left( w \right) \) as a function of weight; \( b_{new} \) as the new bias value; \( b_{old} \) as the current bias value; \( y \) as a vector of the output layer nodes’ output; \( t \) as a vector of the target output.

Chain rule for the hidden layer → output weights (u):

$$ \frac{\partial E}{\partial u} = \frac{\partial E}{\partial y}\frac{\partial y}{\partial q}\frac{\partial q}{\partial u} $$
$$ \frac{\partial E}{\partial u} = \left( {y - t} \right)\left( {1 - y} \right)\left( y \right)\left( {h_{2} } \right) $$
(9)

with: \( g_{n} \left( u \right) \) as a function of the hidden layer  output layer weights; \( \frac{\partial E}{\partial u} \) as the partial derivative of Error against the hidden layer  output layer weights; \( \frac{\partial E}{\partial y} \) as the partial derivative of Error against the output layer; \( \frac{\partial y}{\partial q} \) as the partial derivative of the output layer against the output layer’s linear combination; \( \frac{\partial q}{\partial u} \) as the partial derivative of the output layer’s linear combination against the hidden layer  output layer weights.

Chain rule for the input layer → hidden layer weights (w):

$$ g_{n} \left( w \right) = \frac{\partial E}{\partial w} $$
$$ \frac{\partial E}{\partial w} = \frac{\partial E}{\partial y}\frac{\partial y}{\partial q}\frac{\partial q}{\partial h}\frac{\partial h}{\partial p}\frac{\partial p}{\partial w} $$
$$ \frac{\partial E}{\partial w} = \left( {y - t} \right)\left( {1 - y} \right)\left( y \right)\left( u \right)\left( {1 - h} \right)\left( h \right)\left( x \right) $$
(10)

with: \( g_{n} \left( w \right) \) as a function of the input layer  hidden layer weights; \( \frac{\partial E}{\partial w} \) as the partial derivative of Error against the input layer  hidden layer weights; \( \frac{\partial q}{\partial h} \) as the partial derivative of the output layer’s linear combination against the hidden layer; \( \frac{\partial h}{\partial p} \) as the partial derivative of the hidden layer against the input layer’s linear combination; \( \frac{\partial p}{\partial w} \) as the partial derivative of the hidden layer’s linear combination against the input layer  hidden layer weights.

Meanwhile, the pseudocode of the algorithm used in this experiment is:

figurea

Experimental results

We used a total of 31 lines of data for training and testing. The data was split into 80% training set and 20% test set prior to executing the training algorithm using the architecture defined in Fig. 1. It was trained with various learning rates: 0.5, 0.1 and 0.05. It was also trained with various amounts of iterations.

The test results can be seen in Fig. 2, while the error vs. iteration graph for each learning rate for 2000 iterations can be seen in Figs. 3, 4, 5.

Fig. 2
figure2

Accuracy of ANN over iterations with different learning rates

Fig. 3
figure3

Error vs. iteration graph for LR 0.5 over 2000 iterations

Fig. 4
figure4

Error vs. iteration graph for LR 0.1 over 2000 iterations

Fig. 5
figure5

Error vs. Iteration graph for LR 0.05 over 2000 iterations

Discussion

As can be seen in Fig. 2, the maximum accuracy of the model is 85.71%, with the results stabilizing on 2000 iterations. By comparing Figs. 3, 4, and 5, we can see that the smoothest, thus the most stable, graph is the one with 0.05 learning rate. From these results, we can say that the optimal parameters for the ANN has 0.05 learning rate and trained for over 2000 iterations.

Conclusion

The data in this research are real data from some Indonesian companies. With these results, it can be said that the data used can be used to predict which shares are best for a portfolio. The algorithms used for building the ANN were supervised stochastic learning with backpropagation and steepest gradient descent, with the optimal parameters of 0.05 learning rate trained over 2000 iterations. These algorithms run with these parameters were able to predict if a company will go bankrupt with good success, that is, with 85.71% accuracy. The accuracy may be improved by obtaining more real data to be used in training the ANN, so it can learn from more examples. Big data techniques will be very helpful in this matter.

Availability of data and materials

Not applicable.

Abbreviations

ANN:

Artificial neural network

References

  1. 1.

    Ashwood AJ. Portfolio selection using artificial intelligence. DBA disertation of Queensland University of Technology 2013.

  2. 2.

    Fama EF, French FK. The cross-section of expected return. J Financ. 1992;47(2):611–49.

    Article  Google Scholar 

  3. 3.

    Farrell JL. Homogeneous stock grouping: implication for portfolio management. Financ Anal J. 1975;31(3):50–62.

    Article  Google Scholar 

  4. 4.

    Jones CP. Portfolio management. New York: McGraw-Hill’; 1992.

    Google Scholar 

  5. 5.

    Khaksari S, Kamath R, Grieves R. A new approach to determining optimum portfolio mix. J Portf Manag. 1989;15(3):43–9.

    Article  Google Scholar 

  6. 6.

    Manurung AH. Consistency of shares choice in building optimal portfolio on Jakarta Stock Exchange by Fund Manager associated to ratio of empirical performance (Konsistensi Pemilihan Saham dalam Pembentukan Portfolio Optimal di BEJ oleh Manajer Investasi dikaitkan dengan Variabel Rasio Empirik Kinerja Perusahaan). 2002 Doctoral Disertation of University of Indonesia.

  7. 7.

    Markowitz HM. Portfolio selection. J Finance. 1952;7(1):77–95.

    Google Scholar 

  8. 8.

    Markowitz HM, Perold AF. Portfolio analysis with factors and scenarios. J Financ. 1981;36(4):871–7.

    Article  Google Scholar 

  9. 9.

    Marmer HS. Optimal international allocation under different economic environments: a Canadian perspective. Financ Anal J. 1991;3(6):85–92.

    Article  Google Scholar 

  10. 10.

    Peavy JW, Goodman DA. The significance of P/Es for portfolio returns. J Portf Manag. 1983;9(2):43–7.

    Article  Google Scholar 

  11. 11.

    Perritt GW, Lavine A. Diversify: the investor’s guide to asset allocation strategies. USA: Longman Financial Services Publishing; 1990.

    Google Scholar 

  12. 12.

    Rasekhschaffe KC, Jones RC. Machine Learning for Stock Selection. Financ Anal J. 2019;75(3):70–88.

    Article  Google Scholar 

  13. 13.

    Reily FK, Brown KC. Investment analysis and portfolio management. New York: The Dryden Press; 2002. p. 272.

    Google Scholar 

  14. 14.

    Reinganum MC. The significance of market capitalization in portfolio management over time. J Portf Manag. 1999;25(4):39–50.

    Article  Google Scholar 

  15. 15.

    Saaty TL, Rogers PL, Pell R. Portfolio selection through hierarchies. J Portf Manag. 1980;6(3):16–21.

    Article  Google Scholar 

  16. 16.

    Wainscott CB. The Stock-bond correlation and it’s implication for asset allocation. Financ Anal J. 1990;2(2):55–60.

    Article  Google Scholar 

  17. 17.

    Wallingford BA. A survey and comparison of portfolio selection models. J Financ Quant Anal. 1967;2(2):85–106.

    Article  Google Scholar 

  18. 18.

    Zhang Y, Guo Q, Wang Jw. Big data analysis using neural networks. Adv Eng Sci. 2017;49:9–18.

    Google Scholar 

Download references

Acknowledgements

This work is supported by BINUS University.

Funding

No funding in this research.

Author information

Affiliations

Authors

Contributions

Both authors read and approved the final manuscript.

Corresponding author

Correspondence to Widodo Budiharto.

Ethics declarations

Competing interests

The authors declare that they have 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/.

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Manurung, A.H., Natasha, C. & Budiharto, W. Modelling shares choice to enter in a portfolio using artificial neural networks (ANN). J Big Data 7, 17 (2020). https://doi.org/10.1186/s40537-020-00294-w

Download citation

Keywords

  • Shares choice
  • Neural network
  • ANN
  • Big data