Stock price trend analysis system and method based on event influence graph construction
By constructing an event impact chart, expressing the complex correlation between multiple events in multiple companies, solving the problem of poor stock price trend prediction in the existing technology, and achieving more accurate stock price trend analysis and prediction.
Patent Information
- Application Number
- CN202411767916.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-03-28
AI Technical Summary
The existing technology is difficult to effectively express the complex correlation between multiple events in multiple companies, resulting in poor stock price trend forecasting.
The construction method based on event impact graph is adopted, and the complex correlation between multiple events in multiple enterprises is modeled through data loading, event information extraction, event impact graph construction and stock price trend analysis modules, and the graph convolutional neural network and feedforward neural network are used for stock price trend analysis and prediction.
It improves the adaptability to complex correlations, significantly improves the accuracy of stock price trend forecasts, and has better results than other methods.
Smart Images

Figure CN119722327A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a stock price trend analysis system and method based on an event impact graph. Background Art
[0002] With the development of computers and artificial intelligence, the way financial assets are traded has undergone revolutionary changes, and stock trend analysis has become an important service that investors and financial institutions are paying more and more attention to. At present, there are endless studies on the problem of stock price trend analysis, but due to the complexity and variability of the stock market environment and stock data, the accuracy of stock trend analysis of existing methods still has a lot of room for improvement.
[0003] Among many methods, event impact analysis is a research field that has received much attention in stock price trend analysis. By studying the impact of events on the stock market, we can discover the potential influencing factors of events and provide more accurate prediction results. Studies have found that financial news can greatly affect stock prices, and extracting events from financial news may play an important role in stock market prediction. Therefore, researchers use financial data, news reports, social media data, etc. to identify these events, and use statistical analysis or machine learning methods to predict stock price trends. Existing research works usually use natural language processing technology to convert event text in news into word vectors or word embeddings, and then model the correlation between events based on vector and tensor methods. Although these methods have achieved certain results, they lack the expression of complex correlations between multiple events in multiple companies, which makes it difficult to improve the prediction effect of stock price trends. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention provides a stock price trend analysis system and method based on an event impact diagram. The event impact diagram can model the complex invisible correlation between multiple events of multiple enterprises, which is more in line with market rules and the needs of stock price trend analysis.
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0006] A stock price trend analysis system based on event impact graph construction includes a data loading module, an event information extraction module, an event impact graph construction module and a stock price trend analysis module;
[0007] The data loading module loads different types of perception data and loads the perception data into the event information extraction module for processing;
[0008] The different types of sensory data include:
[0009] (1) Financial news data in txt and csv formats;
[0010] (2) Stock market information data in csv format;
[0011] The event information extraction module receives the perception data collected by the data loading module, analyzes the event implications of the perception data, and automatically identifies and extracts structured information describing the event;
[0012] Furthermore, the event information extraction module includes an event type extraction unit, a trigger word extraction unit and an event argument extraction unit;
[0013] The event type extraction unit is used to encode the perception data collected in the event information extraction module to form a text vector, and identify and extract the event type information described by the text from the encoded text vector;
[0014] The trigger word extraction unit locates and extracts trigger word data or keywords of an event from a given text, and identifies and locates the event;
[0015] The event argument extraction unit extracts argument information related to the event from the text, including the subject, object, time, place, and role elements of the event, where nodes represent stocks and adjacent edges represent correlations between stocks;
[0016] The event impact graph construction module uses a graph to model the impact of events related to stock prices and construct an event impact graph based on the event related information extracted from the event information extraction module and combined with basic stock data, including opening price, closing price, highest price, and lowest price.
[0017] The stock price trend analysis module includes an event impact diagram analysis layer, which builds dynamic feature correlations between stocks based on event type data, trigger word data and argument information of the event information extraction module and combined with the analysis of the stock price index data of the included companies;
[0018] The stock price trend analysis module also includes a feature extraction layer, which is based on the constructed event impact graph, combined with the analysis of the stock price index data of the companies contained therein, and uses a graph convolutional neural network to propagate the feature information of nodes and adjacent edges into the event impact graph, thereby obtaining the relationship representation between stocks.
[0019] The stock price trend analysis module also includes a stock price trend prediction layer, which performs classification prediction of stock price trends through a feedforward neural network.
[0020] A stock price trend analysis system based on an event impact diagram is used to implement the following method, including the following steps:
[0021] Step 1: Obtain historical time series data and news data related to stock quotes, and load the historical time series data and news data into memory;
[0022] Step 2: Filter and preprocess the historical time series data and news data obtained in step 1;
[0023] For historical time series data, its feature dimensions include five historical features of each stock on each trading day: opening price, closing price, highest price, lowest price and trading volume. The historical time series data is filtered by setting the filtering conditions, and each feature dimension of the filtered historical time series data is normalized; among them, the opening price, closing price, highest price, lowest price and trading volume are represented by open, close, high, low and volume respectively, t represents the trading day, and i represents the company;
[0024] Step 3: Extract and abstract the events, where N t =[n i1 ,n i2 ,…n it ] represents the news text set of the day, n it represents the news text set of company i on the tth trading day, e i Represents structured events extracted from unstructured text;
[0025] Step 3.1: Use Bert_Tokenizer to encode the text data, extract the semantic features and contextual relationships of the text data, and obtain the implicit representation of the text H = h1, h2, ..., h N As a token representation of subsequent downstream subtasks, h N is the implicit information representation of the Nth text;
[0026] Step 3.2: Extract event types and use attention mechanism to detect event types and capture the most relevant context for each possible type; randomly initialize the type embedding matrix C∈R |C|×d , where C is the initialization matrix, R is a set of real numbers, and d is the number of event types; use the correlation calculation function δ(c,hi)=v T tanh(W[c;h i |ch i |;c∪h i ]) measures the candidate type embedding c∈C and the implicit information representation h encoded by each token i The correlation between them, where the trainable parameter matrix W∈R is initialized 4d×4d , v∈R 4d×1 is a learnable parameter, h i is the implicit information representation, c is the type embedding;
[0027] Step 3.3: Represent h by implicit information of the text i and type embedding c to obtain text information representation The implicit information of the text is represented by h i The mean and variance of are represented by μ and σ, and the specific calculation of φ is expressed by the following formula: b and β are random bias constants and form a matrix G; the self-attention mechanism T is used on the matrix G c =SelfAttention(G), use the softmax function to calculate T c , determine the trigger word classification;
[0028] Step 3.4: Represent the text information of each word obtained in step 3.3 Select the mean of the start and end positions of the word in the text as the position embedding P, and represent the text information And the position embedding P is concatenated to obtain the matrix Then use the self-attention mechanism T on the matrix Z c =SelfAttention(Z), calculate the similarity probability with argument classification a through the softmax function, and get argument classification A c ;
[0029] Step 4: Based on the type embedding, trigger word classification, and argument classification extracted in step 3, mathematical model the event impact and construct the event impact graph;
[0030] Specifically: Constructing industry relationship matrix A n×n , A is a symmetric undirected graph, where n represents the total number of companies in the news of the day. If company i and company j appear in the same event, then A ij =1 otherwise A ij =0;
[0031] Step 5: Predict the stock price trend based on the event impact diagram obtained in step 4;
[0032] Step 5.1: Pass the event impact graph obtained in step 4 into the graph convolutional neural network GCN to obtain the graph-aware hidden state H of each node (l) ,For each node, its hidden state contains information from neighboring nodes;
[0033] Step 5.2: Implement H by iteratively updating the hidden states of all nodes (l+1) =σ(D -1 / 2 AD -1 / 2 H (l) W (l) ), where A is the adjacency matrix of the graph and D is the degree matrix of the graph.
[0034] Step 5.3: For the hidden state updated in step 5.2, perform a linear transformation on each associated stock pair, use a layer of neural network, input the updated hidden state obtained in step 5.2 into the stock trend prediction layer, and use a feedforward neural network for classification prediction. The stock trend prediction is expressed as a binary classification problem, and the prediction results are output.
[0035] The beneficial effects of adopting the above technical solution are:
[0036] The present invention provides a stock price trend analysis system and method based on an event impact diagram, which specifically has the following beneficial effects:
[0037] 1. The present invention provides a stock price trend analysis system based on an event influence diagram. According to event information and basic stock data, an event influence diagram is constructed by extracting word vectors and modeling the implicit complex correlations between multiple events of multiple enterprises, thereby improving the adaptability to complex correlations.
[0038] 2. The present invention implements a stock price trend analysis method based on graph neural network. According to the implicit relationship in stock data and the dynamic relationship that changes over time, the stock trend is analyzed through event impact diagram and graph neural network. Comparative experiments have proved that the method proposed in the present invention is better than other methods in stock trend prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A schematic diagram of the structure of a stock price trend analysis system in an embodiment of the present invention;
[0040] Figure 2 4 is a flow chart of a stock price trend analysis method in an embodiment of the present invention. DETAILED DESCRIPTION
[0041] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.
[0042] A stock price trend analysis system based on event impact diagram, such as Figure 1 As shown, it includes a data loading module, an event information extraction module, an event impact diagram construction module and a stock price trend analysis module;
[0043] The data loading module loads different types of perception data and loads the perception data into the event information extraction module for processing;
[0044] The different types of sensory data include:
[0045] (1) Financial news data in txt and csv formats;
[0046] (2) Stock market information data in csv format;
[0047] The event information extraction module receives the perception data collected by the data loading module, analyzes the event implications of the perception data, and automatically identifies and extracts structured information describing the event;
[0048] Furthermore, the event information extraction module includes an event type extraction unit, a trigger word extraction unit and an event argument extraction unit;
[0049] The event type extraction unit is used to encode the perception data collected in the event information extraction module to form a text vector, and identify and extract the event type information described by the text from the encoded text vector;
[0050] The trigger word extraction unit locates and extracts trigger word data or keywords of an event from a given text, and identifies and locates the event;
[0051] The event argument extraction unit extracts argument information related to the event from the text, including the subject, object, time, place, and role elements of the event, where nodes represent stocks and adjacent edges represent correlations between stocks;
[0052] The event impact graph construction module uses a graph to model the impact of events related to stock prices and construct an event impact graph based on the event related information extracted from the event information extraction module and combined with basic stock data, including opening price, closing price, highest price, and lowest price.
[0053] The stock price trend analysis module includes an event impact diagram analysis layer, which builds dynamic feature correlations between stocks based on event type data, trigger word data and argument information of the event information extraction module and combined with the analysis of the stock price index data of the included companies;
[0054] The stock price trend analysis module also includes a feature extraction layer, which is based on the constructed event impact graph, combined with the analysis of the stock price index data of the companies contained therein, and uses a graph convolutional neural network to propagate the feature information of nodes and adjacent edges into the event impact graph, thereby obtaining the relationship representation between stocks.
[0055] The stock price trend analysis module also includes a stock price trend prediction layer, which performs classification prediction of stock price trends through a feedforward neural network.
[0056] A stock price trend analysis system based on event impact diagram is used to implement the following methods, such as Figure 2 As shown, the following steps are included:
[0057] Step 1: Obtain historical time series data and news data related to stock quotes, and load the historical time series data and news data into memory;
[0058] Step 2: Filter and preprocess the historical time series data and news data obtained in step 1;
[0059] For historical time series data, its feature dimensions include five historical features of each stock on each trading day: opening price, closing price, highest price, lowest price and trading volume. The historical time series data is filtered by setting the filtering conditions, and each feature dimension of the filtered historical time series data is normalized; among them, the opening price, closing price, highest price, lowest price and trading volume are represented by open, close, high, low and volume respectively, t represents the trading day, and i represents the company;
[0060] Step 3: Extract and abstract the events, where Nt = [ni1, ni2, ... nit] represents the news text set of the day, nit represents the news text set of company i on the tth trading day, and ei represents the structured events extracted from the unstructured text;
[0061] Step 3.1: Use Bert_Tokenizer to encode the text data, extract the semantic features and contextual relationships of the text data, and obtain the implicit representation of the text H = h1, h2, ..., hN as the token representation of the subsequent downstream subtasks, where hN is the implicit information representation of the Nth text;
[0062] Step 3.2: Extract event types and use the attention mechanism to detect event types and capture the most relevant context for each possible type; randomly initialize the type embedding matrix C∈R|C|×d, where C is the initialization matrix, R is a real number set, and d is the number of event types; use the correlation calculation function δ(c,hi)=vTtanh(W[c;hi|c-hi|;c∪hi]) to measure the correlation between the candidate type embedding c∈C and the implicit information representation hi encoded by each token, where the initialized trainable parameter matrix W∈R4d×4d, v∈R4d×1 is the learnable parameter, hi is the implicit information representation, and c is the type embedding;
[0063] Step 3.3: Obtain text information representation by representing the implicit information hi of the text and embedding the type c The implicit information of the text is represented by the mean and variance of hi, represented by μ and σ. The specific calculation of is expressed by the following formula: gic = (Wc + b) · ((hi - μ) / σ)) + β, b and β are random bias constants, and form a matrix G; the self-attention mechanism Tc = SelfAttention (G) is used for the matrix G, and the softmax function is used to calculate Tc to determine the trigger word classification;
[0064] Step 3.4: According to the text information representation gic of each word obtained in step 3.3, select the average of the start and end positions of the word in the text as the position embedding P, concatenate the text information representation gic and the position embedding P to obtain the matrix Z = [gic; P], then use the self-attention mechanism Tc = SelfAttention(Z) on the matrix Z, calculate the similarity probability with the argument classification a through the softmax function, and obtain the argument classification Ac;
[0065] Step 4: Based on the type embedding, trigger word classification, and argument classification extracted in step 3, mathematical model the event impact and construct the event impact graph;
[0066] Specifically: construct an industry relationship matrix An×n, where A is a symmetric undirected graph, where n represents the total number of companies in the news of the day, and if company i and company j appear in the same event, then Aij=1, otherwise Aij=0;
[0067] Step 5: Predict the stock price trend based on the event impact diagram obtained in step 4;
[0068] Step 5.1: Pass the event impact graph obtained in step 4 into the graph convolutional neural network GCN to obtain the graph-aware hidden state H(l) of each node. For each node, its hidden state contains information from neighboring nodes;
[0069] Step 5.2: Iteratively update the hidden states of all nodes to achieve H(l+1)=σ(D-1 / 2AD-1 / 2H(l)W(l)), where A is the adjacency matrix of the graph and D is the degree matrix of the graph.
[0070] Step 5.3: For the hidden state updated in step 5.2, perform a linear transformation on each associated stock pair, use a layer of neural network, input the updated hidden state obtained in step 5.2 into the stock trend prediction layer, and use a feedforward neural network for classification prediction. The stock trend prediction is expressed as a binary classification problem, and the prediction results are output.
[0071] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) to form a technical solution.
Claims
1. A stock price trend analysis system based on event impact diagram, characterized in that: It includes data loading module, event information extraction module, event impact diagram construction module and stock price trend analysis module; The data loading module loads different types of perception data and loads the perception data into the event information extraction module for processing; The event information extraction module receives the perception data collected by the data loading module, analyzes the event implications of the perception data, and automatically identifies and extracts structured information describing the event; The event impact graph construction module uses a graph to model the impact of events related to stock prices and construct an event impact graph based on the event related information extracted from the event information extraction module and combined with basic stock data, including opening price, closing price, highest price, and lowest price; The stock price trend analysis module includes an event impact diagram analysis layer, which builds dynamic feature correlations between stocks based on event type data, trigger word data and argument information of the event information extraction module, combined with analysis of the stock price index data of the companies contained therein.
2. A stock price trend analysis system based on event impact diagram according to claim 1, characterized in that: The different types of sensory data include: (1) Financial news data in txt and csv formats; (2) Stock quotes data in csv format.
3. A stock price trend analysis system based on event impact diagram according to claim 1, characterized in that: The event information extraction module includes an event type extraction unit, a trigger word extraction unit and an event argument extraction unit; The event type extraction unit is used to encode the perception data collected in the event information extraction module to form a text vector, and identify and extract the event type information described by the text from the encoded text vector; The trigger word extraction unit locates and extracts trigger word data or keywords of an event from a given text, and identifies and locates the event; The event argument extraction unit extracts argument information related to the event from the text, including the subject, object, time, place, and role elements of the event, wherein nodes represent stocks and adjacent edges represent correlations between stocks.
4. A stock price trend analysis system based on event impact diagram according to claim 1, characterized in that: The stock price trend analysis module also includes a feature extraction layer, which uses a graph convolutional neural network to propagate feature information of nodes and adjacent edges to the event impact graph based on the constructed event impact graph and combined with the analysis of the stock price index data of the included companies, thereby obtaining a relationship representation between stocks; The stock price trend analysis module also includes a stock price trend prediction layer, which performs classification prediction of stock price trends through a feedforward neural network.
5. A stock price trend analysis system based on event impact diagram according to claim 1, characterized in that: The stock price trend analysis system constructed based on the event impact diagram is used to implement the following method, including the following steps: Step 1: Obtain historical time series data and news data related to stock quotes, and load the historical time series data and news data into memory; Step 2: Filter and preprocess the historical time series data and news data obtained in step 1; For historical time series data, its feature dimensions include five historical features of each stock on each trading day: opening price, closing price, highest price, lowest price and trading volume. The historical time series data is filtered by setting the filtering conditions, and each feature dimension of the filtered historical time series data is normalized; among them, the opening price, closing price, highest price, lowest price and trading volume are represented by open, close, high, low and volume respectively, t represents the trading day, and i represents the company; Step 3: Extract and abstract the events, where N t =[n i1 ,n i2 ,…n it ] represents the news text set of the day, n it represents the news text set of company i on the tth trading day, e i Represents structured events extracted from unstructured text; Step 4: Based on the type embedding, trigger word classification, and argument classification extracted in step 3, mathematical model the event impact and construct an event impact graph; specifically: construct the industry relationship matrix A n×n , A is a symmetric undirected graph, where n represents the total number of companies in the news of the day. If company i and company j appear in the same event, then A ij =1 otherwise A ij =0; Step 5: Predict the stock price trend based on the event impact diagram obtained in step 4.
6. A stock price trend analysis system based on event impact diagram according to claim 5, characterized in that: The step 3 specifically includes the following steps: Step 3.1: Use Bert_Tokenizer to encode the text data, extract the semantic features and contextual relationships of the text data, and obtain the implicit representation of the text H = h1, h2, ..., h N As a token representation of subsequent downstream subtasks, h N is the implicit information representation of the Nth text; Step 3.2: Extract event types and use attention mechanism to detect event types and capture the most relevant context for each possible type; randomly initialize the type embedding matrix C∈R |C|×d , where C is the initialization matrix, R is a set of real numbers, and d is the number of event types; use the correlation calculation function δ(c,hi)=v T tanh(W[c;h i |ch i |;c∪h i ]) measures the candidate type embedding c∈C and the implicit information representation h encoded by each token i The correlation between them, where the trainable parameter matrix W∈R is initialized 4d×4d , v∈R 4d×1 is a learnable parameter, h i is the implicit information representation, c is the type embedding; Step 3.3: Represent h by implicit information of the text i and type embedding c to obtain text information representation The implicit information of the text is represented by h i The mean and variance of are represented by μ and σ, The specific calculation of the text information is expressed by the following formula: i c =(Wc+b)·((h i -μ) / σ))+β, b and β are random bias constants, and form a matrix G; the self-attention mechanism T is used on the matrix G c =SelfAttention(G), use the softmax function to calculate T c , determine the trigger word classification; Step 3.4: Represent g based on the text information of each word obtained in step 3.3 i c , select the mean of the start and end positions of the word in the text as the position embedding P, and represent the text information g i c and position embedding P in series to obtain the matrix Z = [g i c ; P], and then use the self-attention mechanism T on the matrix Z c =SelfAttention(Z), calculate the similarity probability with argument classification a through the softmax function, and get argument classification A c .
7. A stock price trend analysis system based on event impact diagram according to claim 5, characterized in that: The step 5 specifically comprises the following steps: Step 5.1: Pass the event impact graph obtained in step 4 into the graph convolutional neural network GCN to obtain the graph-aware hidden state H of each node (l) ,For each node, its hidden state contains information from neighboring nodes; Step 5.2: Implement H by iteratively updating the hidden states of all nodes (l+1) =σ(D -1 / 2 AD -1 / 2 H (l) W (l) ), where A is the adjacency matrix of the graph and D is the degree matrix of the graph; Step 5.3: For the hidden state updated in step 5.2, perform a linear transformation on each associated stock pair, use a layer of neural network, input the updated hidden state obtained in step 5.2 into the stock trend prediction layer, and use a feedforward neural network for classification prediction. The stock trend prediction is expressed as a binary classification problem, and the prediction results are output.