No Stock is an Island: Learning Internal and Relational Attributes of Stocks with Contrastive Learning (2022)

Abstract: Previous work has demonstrated the viability of applying deep learning techniques in the financial area. Recently, the task of stock embedding learning has been drawing attention from the research community, which aims to represent the characteristics of stocks with distributed vectors that can be used in various financial analysis scenarios. Existing approaches for learning stock embeddings either require expert knowledge, or mainly focus on the textual part of information corresponding to individual temporal movements. In this paper, we propose to model stock properties as the combination of internal attributes and relational attributes, which takes into consideration both the time-invariant properties of individual stocks and their movement patterns in relation to the market. To learn the two types of attributes from financial news and transaction data, we design several training objectives based on contrastive learning to extract and separate the long-term and temporary information in the data that are able to counter the inherent randomness of the stock market. Experiments and further analyses on portfolio optimization reveal the effectiveness of our method in extracting comprehensive stock information from various data sources.

## introduction with the prosperity of machine learning, a whole new range of powerful data analysis tools has been introduced to applied fields such as health and economics. one of the areas that benefit most from this revolution is the area of financial technologies, where machine learning has been widely used in tasks including stock trend prediction @xcite and optimal execution @xcite . in this work, we focus on the task of stock embedding learning. similar to the well-studied task of word embeddings, stock embedding learning aims to represent the characteristics of a stock with a densely distributed vector. stock embeddings that capture the comprehensive properties of stocks accurately can provide valuable stock information for downstream financial analysis. previous methods for learning stock embeddings broadly fall into two categories. methods in the first category propose to combine stock representation learning with traditional technical analysis and learn the intrinsic properties or indicators based on the investment behavior of fund managers @xcite . however, the professional knowledge of human experts is usually difficult to access for the public, limiting the scope of application. also, due to the vast amount of data in the stock market, even experts cannot take a comprehensive view of all available information. the second category consists of methods that are more focused on data-driven deep learning techniques and bear more resemblance to our approach @xcite ]. these methods make use of financial news and stock price data by employing learnable stock embeddings in the stock movement prediction or classification task. the main drawback of these approaches is that they only focus on the textual part of information corresponding to the movement of stock. consequently, they either neglect the intrinsic properties of a stock or fail to explicitly model the relations between stocks, both of which carry valuable information for the process of financial analysis. in view of the downsides of existing work, we propose a method to extract comprehensive stock information solely from news and price data. to be specific, we model the characteristics of a stock from two aspects: the internal attributes and the relational attributes. for example, consider the following excerpt from a financial news article: here, "carmakers" conveys information about the internal attributes of toyota (7203.t) and nissan (7201.t), i.e., both are in the industrial sector of "transportation equipment". on the other hand, "both underperformed" reflects the resemblance in the market performance of these two stocks, an example of what we define as the relational attributes . however, information regarding the two types of attributes is implicit, largely blended in the data and subject to the ran-domness of the market. to address these issues, we propose to disentangle the long-term information and the temporary information in the data for mining the stable properties of individual stocks and stock relations. inspired by the success of contrastive learning, we design several contrastive training objectives that extract long-term and temporary information from data to learn internal and relational attributes, respectively. compared to previous methods, our stock embeddings are able to capture more comprehensive information contained in the text and price data, thus modeling the inherent properties and relations of stocks more accurately. to testify the effectiveness of our approach, we apply our learned stock embeddings to the task of portfolio optimization. the portfolio yielded by our method achieves the highest return and the lowest risk of all tested approaches, demonstrating the superiority of our approach. our contributions can be summarized as follows: ## method in this section, we describe the model architecture and the designed contrastive objectives to capture the internal and relational attributes of stocks from textual news and transaction data in our embeddings, as shown in figure 1 . ## conclusion in this paper, we propose to model the properties of a stock from two aspects: its internal attributes as an individual stock, and its relational attributes relative to other stocks. we propose to extract long-term information and temporary information from financial news and transaction data to learn these two types of attributes. to capture these attributes in the stock embeddings, we design several training objectives based on contrastive learning that are able to counter the randomness of the stock market. comprehensive empirical evidence demonstrates that our stock embeddings are able to model stock properties and relations more accurately.