Similar stock K-line retrieval method based on dynamic programming and multivariate Pearson correlation

By combining dynamic programming and multivariate Pearson correlation coefficient methods, the problem of accuracy and inefficiency in complex data processing of traditional similar K-line search methods is solved, and more efficient and accurate similar stock K-line search is achieved, providing more reliable decision support.

CN119691025APending Publication Date: 2025-03-25HAINAN INTERNATIONAL MEDIA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411769520.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-04
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

When traditional similar K-line search methods deal with K-line data of complex price trends, they cannot accurately identify the true similar K-line, resulting in frequent misjudgment and misjudgment, and the calculation efficiency is inefficient, making it difficult to meet the needs of real-time applications.

Method used

The similar stock K-line retrieval method based on dynamic programming and multivariate Pearson correlation is used to calculate the similarity of stock K-lines through multivariate Pearson correlation coefficient, and the dynamic programming algorithm is used to optimize the similarity matching process to improve efficiency and accuracy.

Benefits of technology

It achieves higher accuracy and efficiency when processing complex stock price data, avoids misjudgment and misjudgment in traditional methods, provides faster and more accurate decision-making support, and provides investors with more reliable similar stock search solutions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119691025A_ABST
    Figure CN119691025A_ABST
Patent Text Reader

Abstract

The invention provides a similar stock K-line retrieval method based on dynamic planning and multivariate Pearson correlation, and relates to the technical field of data processing.The method comprises the steps that a to-be-retrieved stock K-line data set is selected, a dynamic planning model is constructed according to the characteristics and requirements of the data set, and the K-line data set is retrieved; wherein the multivariate Pearson's correlation coefficient is used as a similarity measurement index in a state transition equation, and the dynamic programming model is initialized according to the size and complexity of a data set. By setting proper parameters such as an initial state, an initial value and the number of iterations, an optimal solution is obtained through rapid convergence under limited computing resources. The model is solved by using a dynamic programming algorithm, a proper optimization method and acceleration skills are selected according to actual needs, and finally, a K line set most similar to a to-be-retrieved K line is screened out according to an output result of the dynamic programming algorithm. The results can be sorted and displayed according to the sequence of the similarity from high to low, so that a user can check and compare the results conveniently.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a similar stock K-line retrieval method based on dynamic programming and multivariate Pearson correlation. Background Art

[0002] With the increasing prosperity of the financial market, the trading volume and data size of the stock market have shown an unprecedented growth trend. For investors and researchers, how to accurately and efficiently extract valuable information from massive stock data has become a very challenging problem. Among them, similar stock K-line retrieval technology is a widely used data analysis method. Through this method, investors can find stocks with similar price trends, and then formulate more reasonable and effective investment strategies.

[0003] However, traditional similar K-line retrieval methods mainly rely on distance measurement algorithms, such as Euclidean distance and Manhattan distance. Such methods usually only focus on the overall shape of the K-line, while ignoring the correlation between its internal data points. Therefore, when processing K-line data with complex price trends, these methods often cannot accurately identify truly similar K-lines, resulting in frequent misjudgments and missed judgments.

[0004] In order to overcome this problem, some researchers have begun to try to use similar K-line retrieval methods based on correlation coefficients. When calculating the similarity of K-lines, this type of method not only considers the overall shape of the K-line, but also fully considers the correlation between its internal data points. However, most of the existing similar K-line retrieval methods based on correlation coefficients still use an exhaustive search method, and the computational efficiency needs to be improved. Especially when processing large-scale stock data, these methods usually consume a lot of computing resources and time, and it is difficult to meet the needs of real-time applications. Summary of the invention

[0005] In view of the shortcomings of the prior art, the present invention provides a similar stock K-line retrieval method based on dynamic programming and multivariate Pearson correlation, which combines the dynamic programming algorithm with the multivariate Pearson correlation coefficient, aiming to overcome the limitations of the prior art in terms of similarity calculation efficiency and accuracy, and provide investors with more efficient and reliable decision support.

[0006] A similar stock K-line retrieval method based on dynamic programming and multivariate Pearson correlation includes the following steps:

[0007] Step 1: Data collection, obtaining historical stock market data;

[0008] Step 2: Data preprocessing: preprocess the data obtained in step 1; and identify the mutation points in the stock K-line through the stock trend mutation point detection algorithm based on bidirectional difference;

[0009] The preprocessing includes data cleaning, data sorting and data standardization;

[0010] The stock trend mutation point detection algorithm based on two-way difference combines the two-way difference idea with the characteristics of stock price data. By calculating the difference before and after the stock price sequence, that is, the price change in adjacent time periods, the fluctuation and turning point in the price trend are obtained, thereby identifying the mutation point in the stock K-line.

[0011] Step 3: Construction of multivariate similarity operators for individual stocks;

[0012] Combining the four attributes of opening price open, closing price close, highest price high, and lowest price low, the multivariate similarity operator MSO is calculated:

[0013]

[0014] Step 4: Similarity calculation;

[0015] The multivariate Pearson correlation coefficient is used to calculate the similarity between the target stock and the candidate stock; specifically, the multivariate similarity operator MSO of the target stock is selected. t and the multivariate similarity operator MSO of the candidate stocks c , by calculating the Pearson correlation coefficient between the two, to measure the similarity of the K-line trends of two stocks;

[0016]

[0017] Among them, ρ(MOS t ,MOS c ) represents the Pearson correlation coefficient, cov(MOS t ,MOS c ) represents the covariance of the multivariate similarity operator between the target stock and the candidate stock, σ(MOS t ) and σ(MOS c ) is the standard deviation of the multivariate similarity operator between the target stock and the candidate stock, and Represents the specific value of the multivariate similarity operator of the target stock and the candidate stock, and They represent the average values ​​of the multivariate similarity operators of the target stock and the candidate stock, respectively, and n represents the number of samples;

[0018] Step 5: Dynamic planning matching;

[0019] Step 5.1: Data preparation and sliding window setting;

[0020] Step 5.1.1: Target stock data selection;

[0021] Extract the K-line data of the target stock from the stock database, which includes the opening price, closing price, highest price, lowest price, transaction amount and transaction volume within the set time;

[0022] Step 5.1.2: Preparation of candidate stock data;

[0023] Prepare K-line data of candidate stocks and conduct comparative analysis with target stocks;

[0024] Step 5.1.3: Set the length of the sliding window;

[0025] Step 5.2: Design and initialization of dynamic programming table;

[0026] Step 5.2.1: Dynamic programming table construction;

[0027] Design a two-dimensional array as a dynamic programming table to store the optimal solutions under different stages and specific stock K-line characteristics; the rows of the array represent different candidate stocks, and the columns represent different sliding window positions;

[0028] Step 5.2.2: Table initialization:;

[0029] Initialize all cells in the dynamic programming table to an infinite value, indicating that the optimal solution has not been calculated in the initial state;

[0030] Step 5.3: Similarity matching based on dynamic programming;

[0031] Step 5.3.1: Initialize the sliding window: traverse the K-line data of the candidate stocks from left to right, and set the length of time each time to form a new sliding window.

[0032] Step 5.3.2: Calculate similarity;

[0033] Step 5.3.2.1: Application of multivariate similarity operator: Using the constructed multivariate similarity operator, the data of the target stock and the candidate stock in the sliding window are merged to reflect the value of similarity between the stocks;

[0034] Step 5.3.2.2: Pearson correlation coefficient calculation: Based on the results of the multivariate similarity operator, calculate the multivariate Pearson correlation coefficient between the target stock and the candidate stock;

[0035] Step 5.3.3: Dynamic programming table update;

[0036] Step 5.3.3.1: Similarity comparison: compare the currently calculated similarity with the value of the corresponding cell in the dynamic programming table;

[0037] Step 5.3.3.2: Optimal solution storage: If the currently calculated similarity is higher than the previously stored value, update the value of the cell and record the corresponding candidate stocks and sliding window positions.

[0038] Step 5.3.4: Sliding window movement and repeated calculation;

[0039] Step 5.3.4.1: Each time the sliding window is moved, the data redundancy between adjacent time windows is utilized and only the impact of the data changes at the head and tail on the similarity is considered;

[0040] Step 5.3.4.2: Update the dynamic programming table;

[0041] Step 6: Matching result output;

[0042] Step 6.1: Optimal matching result screening: traverse the dynamic programming table to find the candidate stocks with the highest similarity and their corresponding sliding window positions;

[0043] Step 6.2: Formatted output of results: The best matching result is output in the form of a four-tuple, including similar stock codes, similar stock start time, similar stock end time, and similarity of similar stocks.

[0044] The beneficial effects of adopting the above technical solution are:

[0045] The present invention provides a similar stock K-line retrieval method based on dynamic programming and multivariate Pearson correlation. The similar stock K-line retrieval method proposed in the present invention brings unprecedented technical innovation and strategic change in the field of stock similarity analysis, thereby showing its unique characteristics.

[0046] First, we chose the multivariate Pearson correlation coefficient as the core standard for measuring the similarity of stock K-line. Compared with the traditional single Pearson correlation coefficient, the multivariate Pearson correlation coefficient is more complex and accurate. It can deeply consider the combined effects of multiple factors, thereby more comprehensively revealing the similar relationship between stocks. This comprehensiveness enables us to more accurately identify and match similar K-line patterns when dealing with complex stock price data.

[0047] Secondly, in order to enhance the effect of stock K-line similarity matching, the present invention introduces a dynamic programming algorithm. As an algorithm with optimization function, the dynamic programming algorithm can easily cope with large-scale data and find the global optimal solution at the same time. With the help of the dynamic programming algorithm, our method is not only improved in efficiency, but also in accuracy, successfully avoiding the problem of local optimal solution that may occur in traditional methods. This advantage enables us to quickly screen out candidate stocks similar to the target stock K-line in a huge stock database, providing investors with faster and more accurate decision-making basis.

[0048] In addition, the present invention also solves a series of limitations of traditional methods in similar stock retrieval. Most traditional methods are based on simple statistical indicators or pattern matching algorithms, which are difficult to fully capture the complexity and diversity of stock price trends. Our method, through the perfect combination of multivariate Pearson correlation coefficient and dynamic programming algorithm, can more comprehensively consider the similarity relationship between stocks and effectively cope with the challenges of data scale and computational complexity. This breakthrough enables our method to have a wider range of applications and higher practicality, providing investors with a more comprehensive and reliable similar stock retrieval solution.

[0049] Furthermore, by deeply integrating the multivariate Pearson correlation coefficient and the dynamic programming algorithm, our method demonstrates excellent performance and practicality. Specifically, the multivariate Pearson correlation coefficient can capture the similarities between stocks from multiple perspectives, while the dynamic programming algorithm can efficiently find the best matching path. This synergy enables our method to maintain excellent computational performance and accuracy when processing large-scale, high-dimensional stock data.

[0050] The present invention achieves efficient and accurate retrieval of similar stock K-lines by means of multivariate Pearson correlation coefficient, dynamic programming algorithm and a series of innovative technical means. These unique technical features and advantages not only enhance the application value of the present invention in the stock market, but also provide investors with a powerful and reliable decision support tool, thus further promoting the development and innovation in the field of financial data analysis.

[0051] In summary, the present invention implements a similar stock K-line retrieval method driven by a multivariate Pearson correlation coefficient based on dynamic programming through the above 6 steps. These methods can efficiently and accurately find candidate stocks that are similar to the target stock K-line. Specifically, these similar stock K-lines can serve as a crucial reference in investment decisions. Traditional investment decisions are often based on judgments on the current market environment and research on individual stocks, but the complexity of the market makes this decision-making method somewhat blind and risky. By comparing and analyzing other stock K-lines that are similar to the target stock K-line trend, investors can have a more comprehensive understanding of the market's operating conditions and more accurately grasp the overall trend of the market.

[0052] Therefore, using the similar stock K-line obtained from the dynamic programming optimization results can not only enhance investors' cognition and understanding of the market, but also provide them with a more reliable and scientific basis for decision-making. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 It is the overall flow chart of the present invention;

[0054] Figure 2Classify stock price mutation points;

[0055] Figure 3 This is an example of a sudden change point in stock price;

[0056] Figure 4 It is a stock K-line similarity matching method based on exhaustive thinking;

[0057] Figure 5 It is a stock K-line similarity matching method based on dynamic programming ideas. DETAILED DESCRIPTION

[0058] 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.

[0059] In the stock market, the retrieval of similar stocks is of great value. By finding stocks with similar price trends, investors can obtain more reference information, which helps them judge market trends more accurately and formulate more effective investment strategies. However, traditional similar stock retrieval methods often show certain limitations when processing complex and diverse stock price data and cannot meet the actual needs of investors.

[0060] To solve this problem, the present invention proposes an innovative method. We introduce the multivariate Pearson correlation coefficient as a similarity metric. Compared with the traditional single Pearson correlation coefficient, the multivariate Pearson correlation coefficient can more comprehensively consider the similarity relationship between stocks and capture more complex similarity patterns. This feature makes our method more accurate when processing stock K-line data with complex price trends.

[0061] The framework of the present invention is as follows Figure 1 As shown in the figure, it is mainly composed of two modules: data input module and similar K-line search module. The data input module is mainly composed of market data. The similar K-line search module mainly uses the previously obtained data to construct a similarity operator, and executes a dynamic programming algorithm based on the similarity operator to obtain a set of similar K-lines and then select stocks.

[0062] A similar stock K-line retrieval method based on dynamic programming and multivariate Pearson correlation includes the following steps:

[0063] Step 1: Data collection, obtaining historical stock market data;

[0064] The acquisition process in this embodiment is to download data from the network. The original stock price data is obtained from the established stock database. These data usually contain the historical transaction information of each stock, such as the opening price, closing price, highest price, lowest price, etc. In order to more intuitively show the trend of stock prices, we convert the original data into a K-line chart.

[0065] Step 2: Data preprocessing: preprocess the data obtained in step 1; and identify the mutation points in the stock K-line through the stock trend mutation point detection algorithm based on bidirectional difference;

[0066] The preprocessing includes data cleaning, data sorting and data standardization; this step is an important link to ensure the accuracy and effectiveness of subsequent similarity calculations, so as to better perform subsequent analysis and calculations.

[0067] The stock trend mutation point detection algorithm based on two-way difference combines the two-way difference idea with the characteristics of stock price data. By calculating the difference before and after the stock price sequence, that is, the price change in adjacent time periods, the fluctuation and turning point in the price trend are obtained, thereby identifying the mutation point in the stock K-line.

[0068] The original stock price data often contains some noise, outliers or missing values, which will interfere with the subsequent similarity calculation and reduce the accuracy of the results. Therefore, before performing similarity calculation, we need to preprocess the data to ensure the accuracy and completeness of the data.

[0069] Data preprocessing includes multiple steps, the most important of which are data cleaning and standardization. The purpose of data cleaning is to eliminate noise and outliers in the data, such as removing duplicate data, filling missing values, smoothing, etc. We can use various data cleaning methods, such as moving average, interpolation, etc., and choose the appropriate method to process the data according to the specific situation. Standardization is another important preprocessing step, which aims to convert the data into a uniform scale and range to eliminate the impact of price differences between different stocks. Standardization can be done in various ways, such as min-max normalization, Z-score normalization, etc. Through standardization, we can convert the price data of different stocks into the same numerical range, making the subsequent similarity calculation more accurate and reliable.

[0070] Another important task in the data preprocessing stage is to detect the mutation points of stock K-line. Mutation points refer to the key points where the K-line trend changes significantly between two consecutive trading days. They usually indicate that important changes have occurred in individual stocks, such as major news, policy adjustments or other factors that cause drastic price fluctuations. The detection of mutation points can help us better understand the dynamics and change patterns of stock prices, and provide richer information for subsequent similarity calculations.

[0071] like Figure 2 As shown in Figure 1, the specific form of the mutation point can be identified by observing the shape and trend of the K-line chart. Taking Ping An Bank as an example, there was a significant mutation point between June 19, 2013 and June 20, 2013 (see Figure 11). Figure 3 The emergence of this mutation point may be caused by important market news or other factors, which changes the price trend of Ping An Bank's stock and affects the subsequent price dynamics. Through the analysis and understanding of mutation points, we can have a deeper understanding of the operation rules of the stock market and the characteristics of individual stocks, and provide a more accurate basis for investment decisions.

[0072] In order to efficiently and accurately identify the mutation points in the stock K-line, we proposed a stock trend mutation point detection algorithm based on bidirectional difference. After rigorous testing and verification, the algorithm has been proven to be an effective method that can reliably identify the mutation points in the stock K-line and provide investors with more accurate and valuable information.

[0073] This algorithm based on two-way difference fully combines the idea of ​​two-way difference with the characteristics of stock price data. By calculating the difference between the stock price series before and after, that is, the price change in adjacent time periods, we can capture small fluctuations and turning points in the price trend. Difference calculation can help us capture price changes more sensitively and thus identify mutation points more accurately.

[0074] In order to ensure the accuracy and reliability of the algorithm, we also set a reasonable threshold to filter out some minor price changes to avoid too many false positives. By selecting the appropriate threshold, we can exclude those price fluctuations that have little impact on the overall trend and only focus on those mutation points with significant significance. This threshold setting method makes the algorithm more flexible and adaptable, and can be adjusted and optimized according to different stocks and market conditions.

[0075] The algorithm has the advantages of high efficiency and scalability. By performing two-way differential calculations on the price series, we can quickly detect mutation points without the need for complex pattern matching or machine learning training on the entire data set. This reduces the complexity and computational cost of the algorithm, making it more suitable for large-scale stock data analysis.

[0076] Step 3: Construction of multivariate similarity operators for individual stocks;

[0077] Next, we explored in depth how to extract features that can truly reflect the stock K-line trend from the preprocessed data. In this critical process, we not only considered traditional technical indicators, but also combined some advanced feature extraction methods, with the aim of finding those features that can fully reveal the intrinsic properties of stocks.

[0078] After many experiments, we have identified a series of important features, including: opening price open, closing price close, highest price high, lowest price low and trading volume. These features play a vital role in stock analysis. They can not only describe the status of stocks at a certain point in time, but also reveal the dynamic changes of stock prices and market sentiment.

[0079] Among them, the opening price represents the starting price of the market in a certain trading period, while the closing price reflects the ending price of the period. The difference and rate of change between these two prices can provide valuable information about the flow of market sentiment and the comparison of buying and selling forces. The highest and lowest prices highlight the fluctuation range of stock prices during the period. Their changing patterns and frequencies can reveal the supply and demand relationship in the market and changes in investor sentiment.

[0080] In addition, trading volume is also an important indicator that cannot be ignored. It represents the number of stock transactions in a certain period of time, which can reflect the market activity and investor participation. The combined analysis of changes in trading volume and price trends can help us understand the market dynamics and trends more deeply.

[0081] In order to measure the similarity between stocks more comprehensively and deeply, the present invention proposes a unique fusion method. Combining the four attributes of opening price open, closing price close, highest price high, and lowest price low, the multivariate similarity operator MSO is calculated. The core idea of ​​this operator is to perform a specific weighted fusion of these four price attributes to obtain a value that can more comprehensively reflect the similarity between stocks. The specific fusion rules and weight distribution are shown in formula (1), which is the optimal solution we obtained after a large number of experiments and verifications. Through this fusion method, we can more accurately capture the subtle differences and similarities between stocks, thereby providing a more reliable and effective basis for subsequent similar stock retrieval.

[0082]

[0083] Step 4: Similarity calculation;

[0084] After successfully obtaining the multivariate similarity operator of stock K-lines, the present invention further proposes an effective method for measuring the similarity between different stock K-lines. To achieve this goal, we choose the Pearson correlation coefficient as the key indicator for measuring similarity.

[0085] The Pearson correlation coefficient is a widely used method in statistics to measure the correlation between two variables. Its value ranges from -1 to 1, where 1 indicates a perfect positive correlation, -1 indicates a perfect negative correlation, and 0 indicates no correlation. This correlation coefficient not only reflects the strength and direction of the linear relationship, but also is a relatively robust measure of correlation and is not easily affected by extreme values.

[0086] In the present invention, the multivariate Pearson correlation coefficient is used to calculate the similarity between the target stock and the candidate stock; specifically, the multivariate similarity operator MSO of the target stock is selected. t and the multivariate similarity operator MSO of the candidate stocks c , by calculating the Pearson correlation coefficient between the two, to measure the similarity of the K-line trends of two stocks;

[0087] As shown in formula (2), the calculation of the Pearson correlation coefficient involves the covariance and standard deviation of two variables. In the application of the present invention, these two variables are the multivariate similarity operators of the target stock and the candidate stock, respectively. Since the multivariate similarity operator itself has integrated the information of multiple stock features, through the calculation of this multivariate Pearson correlation coefficient, we can measure the similarity between stock K-lines more comprehensively and deeply.

[0088] This method not only takes into account the multivariate characteristics of stock K-line, but also makes full use of the advantages of Pearson correlation coefficient, thereby improving the accuracy and reliability of similarity calculation. By comparing the multivariate Pearson correlation coefficient between the target stock and the candidate stock, we can more accurately judge the similarity of the K-line trends of the two stocks, providing a stronger basis for investment decisions. At the same time, this method also has good adaptability and scalability, and can be applied to stock data analysis in different markets and different time periods.

[0089]

[0090] Among them, ρ(MOS t ,MOS c ) represents the Pearson correlation coefficient, which is used to measure the MOS of target stocks. t MOS c The similarity between them is between -1 and 1, where 1 indicates a perfect positive correlation, -1 indicates a perfect negative correlation, and 0 indicates no correlation. t ,MOS c ) represents the covariance of the multivariate similarity operator between the target stock and the candidate stock, which is a measure of how two variables change together; σ(MOS t ) and σ(MOS c) is the standard deviation of the multivariate similarity operator between the target stock and the candidate stock, which is a statistical indicator used to measure the degree of dispersion of a variable and reflects the volatility of the sample data. and Represents the specific value of the multivariate similarity operator of the target stock and the candidate stock, and Represents the average value of the multivariate similarity operator of the target stock and the candidate stock, respectively, and is used to calculate the covariance and standard deviation. n represents the number of samples, which means the number of samples of the target stock or the candidate stock when calculating the Pearson correlation coefficient.

[0091] Step 5: Dynamic planning matching;

[0092] In traditional stock K-line trend similarity retrieval, researchers usually adopt a strategy based on exhaustive thinking. This method is inefficient when processing large-scale data and easily causes a lot of repeated calculations, such as Figure 4 To overcome this defect, the present invention proposes an innovative optimization strategy based on dynamic programming, as shown in Figure 5 As shown, it aims to improve the efficiency and accuracy of similar stock K-line retrieval.

[0093] Step 5.1: Data preparation and sliding window setting;

[0094] Step 5.1.1: Target stock data selection;

[0095] Extract the K-line data of the target stock from the stock database, which includes the opening price, closing price, highest price, lowest price, transaction amount and transaction volume within the set time;

[0096] Step 5.1.2: Preparation of candidate stock data;

[0097] Prepare K-line data of candidate stocks and conduct comparative analysis with target stocks;

[0098] Step 5.1.3: Set the length of the sliding window;

[0099] In this embodiment, the length of a trading day is selected as the window size to facilitate comparison of data from adjacent trading days.

[0100] Step 5.2: Design and initialization of dynamic programming table;

[0101] Step 5.2.1: Dynamic programming table construction;

[0102] Design a two-dimensional array as a dynamic programming table to store the optimal solutions under different stages and specific stock K-line characteristics; the rows of the array represent different candidate stocks, and the columns represent different sliding window positions;

[0103] Step 5.2.2: Table initialization:;

[0104] Initialize all cells in the dynamic programming table to an infinite value, indicating that the optimal solution has not been calculated in the initial state;

[0105] Step 5.3: Similarity matching based on dynamic programming;

[0106] Step 5.3.1: Initialize the sliding window: traverse the K-line data of the candidate stocks from left to right, set the time for each movement, which in this embodiment is the length of one trading day, to form a new sliding window.

[0107] Step 5.3.2: Calculate similarity;

[0108] Step 5.3.2.1: Application of multivariate similarity operator: Using the constructed multivariate similarity operator, the data of the target stock and the candidate stock in the sliding window are merged to reflect the value of similarity between the stocks;

[0109] Step 5.3.2.2: Pearson correlation coefficient calculation: Based on the results of the multivariate similarity operator, calculate the multivariate Pearson correlation coefficient between the target stock and the candidate stock; as a key indicator to measure similarity.

[0110] Step 5.3.3: Dynamic programming table update;

[0111] Step 5.3.3.1: Similarity comparison: compare the currently calculated similarity with the value of the corresponding cell in the dynamic programming table;

[0112] Step 5.3.3.2: Optimal solution storage: If the currently calculated similarity is higher than the previously stored value, update the value of the cell and record the corresponding candidate stocks and sliding window positions.

[0113] Step 5.3.4: Sliding window movement and repeated calculation;

[0114] Step 5.3.4.1: Utilize data redundancy: Each time you move the sliding window, use the data redundancy between adjacent time windows and only focus on the impact of the head and tail changes on the similarity;

[0115] Step 5.3.4.2: Avoid repeated calculations: Update the dynamic programming table to avoid recalculating the similarity of the entire segment of data, thereby improving efficiency.

[0116] The above optimization strategy actually utilizes the data redundancy between adjacent time windows, and speeds up the similarity retrieval process by reducing unnecessary calculations. This not only improves the efficiency of retrieval, but also reduces the complexity of calculations, allowing us to process more data in a shorter time, and quickly and accurately find other stock K-lines that are most similar to the target stock K-line trend. More importantly, this optimization strategy is also highly versatile and can be applied to different types of stock K-line trend similarity retrieval scenarios, thereby meeting the dual needs of efficiency and accuracy in practical applications.

[0117] In addition, the present invention deeply optimizes the dynamic programming algorithm, incorporates process-oriented thinking, eliminates redundant intermediate variables, thereby significantly reducing the complexity of calculations and qualitatively improving retrieval efficiency. As a result, we have the ability to quickly process large-scale data sets, can lock target results more quickly, and thus achieve a significant improvement in overall work efficiency. In terms of optimization algorithms, we have borrowed and implemented cutting-edge strategies. For example, we adopted a more efficient search tree construction method and used parallel computing technology to accelerate the retrieval process to ensure that each step of the operation reaches the optimal state. These advanced strategies not only shorten the calculation time, but also optimize memory usage, making the system performance more outstanding and more stable. We have also made corresponding innovations in retrieval efficiency. The application of efficient indexing and caching technology and distributed computing enables our system to process multiple tasks in parallel, greatly improving retrieval efficiency. These strategies greatly shorten the user's waiting time, enhance the user experience of the system, and make it more friendly and convenient.

[0118] Step 6: Matching result output;

[0119] Step 6.1: Optimal matching result screening: traverse the dynamic programming table to find the candidate stocks with the highest similarity and their corresponding sliding window positions;

[0120] Step 6.2: Formatted output of results: The best matching result is output in the form of a four-tuple, including similar stock codes, similar stock start time, similar stock end time, and similarity of similar stocks.

[0121] Finally, with the optimization results obtained by dynamic programming, we can efficiently explore those candidate stock K-lines that are highly similar to the target stock K-line trend. These similar stock K-lines that have been screened out not only show similar price trends to the target stock, but also reflect similar market behaviors and capital flow patterns at a deeper level. They provide investors with a new perspective to gain insight into the operating laws and trend changes of the market.

[0122] 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 similar stock K-line retrieval method based on dynamic programming and multivariate Pearson correlation, characterized in that: The following steps are involved: Step 1: Data collection, obtaining historical stock market data; Step 2: Data preprocessing: preprocess the data obtained in step 1; and identify the mutation points in the stock K-line through the stock trend mutation point detection algorithm based on bidirectional difference; Step 3: Construction of multivariate similarity operators for individual stocks; Combining the four attributes of opening price open, closing price close, highest price high, and lowest price low, the multivariate similarity operator MSO is calculated: Step 4: Similarity calculation; The multivariate Pearson correlation coefficient is used to calculate the similarity between the target stock and the candidate stock; specifically, the multivariate similarity operator MSO of the target stock is selected. t and the multivariate similarity operator MSO of the candidate stocks c , by calculating the Pearson correlation coefficient between the two, to measure the similarity of the K-line trends of two stocks; Among them, ρ(MOS t ,MOS c ) represents the Pearson correlation coefficient, cov(MOS t ,MOS c ) represents the covariance of the multivariate similarity operator between the target stock and the candidate stock, σ(MOS t ) and σ(MOS c ) is the standard deviation of the multivariate similarity operator between the target stock and the candidate stock, and Represents the specific value of the multivariate similarity operator of the target stock and the candidate stock, and They represent the average values ​​of the multivariate similarity operators of the target stock and the candidate stock, respectively, and n represents the number of samples; Step 5: Dynamic planning matching; Step 6: Output the matching results.

2. The similar stock K-line retrieval method based on dynamic programming and multivariate Pearson correlation according to claim 1 is characterized in that: The preprocessing described in step 2 includes data cleaning, data sorting and data standardization; The stock trend mutation point detection algorithm based on two-way difference combines the idea of ​​two-way difference with the characteristics of stock price data. By calculating the difference before and after the stock price sequence, that is, the price change in adjacent time periods, the fluctuations and turning points in the price trend are obtained, thereby identifying the mutation points in the stock K-line.

3. The similar stock K-line retrieval method based on dynamic programming and multivariate Pearson correlation according to claim 1 is characterized in that: The step 5 comprises the following steps: Step 5.1: Data preparation and sliding window setting; Step 5.1.1: Target stock data selection; Extract the K-line data of the target stock from the stock database, which includes the opening price, closing price, highest price, lowest price, transaction amount and transaction volume within the set time; Step 5.1.2: Preparation of candidate stock data; Prepare K-line data of candidate stocks and conduct comparative analysis with target stocks; Step 5.1.3: Set the length of the sliding window; Step 5.2: Design and initialization of dynamic programming table; Step 5.2.1: Dynamic programming table construction; Design a two-dimensional array as a dynamic programming table to store the optimal solutions under different stages and specific stock K-line characteristics; the rows of the array represent different candidate stocks, and the columns represent different sliding window positions; Step 5.2.2: Table initialization:; Initialize all cells in the dynamic programming table to an infinite value, indicating that the optimal solution has not been calculated in the initial state; Step 5.3: Similarity matching based on dynamic programming; Step 5.3.1: Initialize the sliding window: traverse the K-line data of the candidate stocks from left to right, and set the length of time each time to form a new sliding window; Step 5.3.2: Calculate similarity; Step 5.3.2.1: Application of multivariate similarity operator: Using the constructed multivariate similarity operator, the data of the target stock and the candidate stock in the sliding window are merged to reflect the value of similarity between the stocks; Step 5.3.2.2: Pearson correlation coefficient calculation: Calculate the multivariate Pearson correlation coefficient between the target stock and the candidate stock based on the results of the multivariate similarity operator; Step 5.3.3: Dynamic programming table update; Step 5.3.3.1: Similarity comparison: compare the currently calculated similarity with the value of the corresponding cell in the dynamic programming table; Step 5.3.3.2: Optimal solution storage: If the currently calculated similarity is higher than the previously stored value, update the value of the cell and record the corresponding candidate stocks and sliding window position; Step 5.3.4: Sliding window movement and repeated calculation; Step 5.3.4.1: Each time the sliding window is moved, the data redundancy between adjacent time windows is utilized and only the impact of the data changes at the head and tail on the similarity is considered; Step 5.3.4.2: Update the dynamic programming table.

4. The similar stock K-line retrieval method based on dynamic programming and multivariate Pearson correlation according to claim 1 is characterized in that: The step 6 comprises the following steps: Step 6.1: Optimal matching result screening: traverse the dynamic programming table to find the candidate stocks with the highest similarity and their corresponding sliding window positions; Step 6.2: Formatted output of results: The best matching result is output in the form of a four-tuple, including similar stock codes, similar stock start time, similar stock end time, and similarity of similar stocks.