# Portfolio Learning Based on Deep Learning
###### Abstract  
Traditional portfolio theory divides stocks into different categories using indicators such as industry, market value, and liquidity, and then selects representative stocks according to them. In this paper, we propose a novel portfolio learning approach based on deep learning and apply it to China's stock market. Specifically, this method is based on the similarity of deep features extracted from candlestick charts. First, we obtained whole stock information from Tushare, a professional financial data interface. These raw time series data are then plotted into candlestick charts to make an image dataset for studying the stock market. Next, the method extracts high-dimensional features from candlestick charts through an autoencoder. After that, K-means is used to cluster these high-dimensional features. Finally, we choose one stock from each category according to the Sharpe ratio and a low-risk, high-return portfolio is obtained. Extensive experiments are conducted on stocks in the Chinese stock market for evaluation. The results demonstrate that the proposed portfolio outperforms the market's leading funds and the Shanghai Stock Exchange Composite Index (SSE Index) in a number of metrics. quantitative trading; portfolio; autoencoder; convolutional natural network (CNN); clustering 2020; 12, 2020; doi:10.3390/6121102020  
choose a set of stocks with high return and the low a correlation coefficient while measuring stock similarity is particularly important. However, most similarity assessments have the following problems: (1) Typically, time series are used to measure similarity through a linear metric, such as co-variance and Pearson. However, these metrics can only reflect the linear characteristics of stock fluctuations. (2) Data from the past \(n\) days is needed to estimate the co-variance, which may not describe the whole market well. In order to solve these problems, we propose a method for estimating similarity using features extracted by deep learning. There have been a number of successful deep learning works in image processing. For example, the Convolutional Autoecoder (CAE) [5] and Bidirectional Generative Adversarial Networks (BiGANs) [6] have achieved good results in image analysis. Amodei [7] converts a 1D signal into a spectrogram (i.e., an image) in order to leverage the strength of CNNs to achieve promising recognition performance. Deep Q-network (DQN) [8] takes in \(4\times 84\times 84\) images from Atari games as state representations, makes a decision based on state, and has beat the best human player in many games. For the same motivation, we explored the conversion of a four-channel stock time series (the lowest, highest, open, and close prices) to the candlestick chart, presenting the price history in the form of an image. In order to achieve end-to-end learning, we chose an unsupervised CAE to learn stock features from candlestick charts. Therefore, the first innovation of this study is to use deep neural networks to encode candlestick charts into deep features. Compared with raw time series, deep feature extracted from candlestick charts can better reflect high-level information such as nonlinear trends and the semantics of stock movements. In addition, we propose a new method using image information for investment decision-making. Although some deep learning models, such as Long Short-Term Memory (LSTM) [9] and Recurrent Neural Network (RNN) [10], have been applied to optimize the portfolio [11; 12], they extract deep features from raw time series rather than candlestick charts for investment decision-making. We built a new end-to-end model to obtain a portfolio. Steps include: (1) Using CAE to learn deep features from candlestick charts; (2) clustering the deep features, thus dividing all stocks in the market into clusters; (3) building a portfolio based on the clustering of the market. For visual representation learning, we made a dataset of 600 k candlestick charts and input them into CAE for feature learning.