Data analysis method and system based on K-line form similarity
Through the data analysis method based on the similarity of K-line patterns, the problems of instability and insufficient guidance of the existing K-line analysis methods are solved, and a more stable and efficient stock selection process is achieved, reducing investment risks.
Patent Information
- Application Number
- CN202411486691.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-03-14
AI Technical Summary
The existing K-line analysis methods are unstable and insufficient instructiveness, which leads to high risks and difficulties faced by investors when selecting stocks.
Using a data analysis method based on the K-line morphological similarity, the K-line data is obtained and preprocessed, the morphological similarity between each set of K-line data in the training data set and the target K-line data is calculated, and the K-line data with the morphological similarity greater than the set threshold are selected, and the confidence is determined based on the growth rate, and the K-line data whose morphological similarity and confidence meet the set conditions are output.
This method simplifies the stock selection process, improves the stability and guidance of stock selection, reduces the risk of stock selection for investors, and improves investment efficiency.
Smart Images

Figure CN119624651A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of computer data processing, and in particular to a data analysis method and system based on K-line morphological similarity. Background Art
[0002] Stock investment refers to the investment behavior of enterprises or individual investors buying and selling stocks to obtain returns. Traditional stock investment analysis methods mainly include: basic analysis based on traditional economic theory, technical analysis based on traditional securities theory, and evolutionary analysis based on fireworks securities theory. However, there are more than 5,000 stocks available for investors to choose from in the securities market. The large number of investable stocks and the large number of stock investment analysis methods dazzle individual investors and increase the difficulty of stock investment for investors.
[0003] Faced with massive amounts of stock-related data, how to extract valuable information from it, select high-quality stocks, buy at low prices, sell at high prices, and obtain investment returns is still a major problem in the current stock investment field.
[0004] In the related technology, the existing stock selection methods on the market cannot keep up with the changes in the stock market, resulting in unstable stock selection methods (confidence is sometimes high and sometimes low), low confidence, and insufficient guidance for investors (such as being unable to guide investors well when to buy stocks and when to sell stocks, so as to buy low and sell high to gain profits), thereby increasing the risk of investors investing in stocks. Summary of the invention
[0005] In order to at least overcome the problems of instability and lack of guidance of existing K-line analysis methods in the relevant technology to a certain extent, the present application provides a data analysis method and system based on K-line morphological similarity.
[0006] According to a first aspect of an embodiment of the present application, a data analysis method based on K-line morphology similarity is provided, comprising the following steps:
[0007] Obtain and preprocess all K-line data within the specified time period;
[0008] Obtain target K-line data, and divide the K-line data into two parts: a training data set and a test data set according to the data length of the target K-line data;
[0009] Calculate the morphological similarity between each group of K-line data in the training data set and the target K-line data, and select the K-line data whose morphological similarity is greater than a first preset threshold to form a similar data set;
[0010] Determine the confidence level of similar data sets based on the growth rate of K-line data in similar data sets;
[0011] If the confidence level is greater than the second preset threshold, K-line data having a morphological similarity with the target K-line data greater than a third set threshold is screened out from the test data set and output.
[0012] Furthermore, the acquisition and preprocessing of all K-line data within a specified time period includes the following steps:
[0013] Read all K-line data of the specified trading day from the database. The K-line data of each trading day includes: opening price, highest price, lowest price and closing price;
[0014] All K-line data are normalized and de-extreme valued.
[0015] Furthermore, the normalization step includes: Xnor=(X-Xmin) / (Xmax-Xmin); wherein X is an initial value, Xmin is a minimum value in the sequence, and Xmax is a maximum value in the sequence.
[0016] Furthermore, dividing the K-line data into two parts, a training data set and a test data set, according to the data length of the target K-line data includes the following steps:
[0017] Determine the initial date, end date and data length T of the target K-line data;
[0018] The K-line data of the last T trading days are taken as the test data set, and the remaining data are taken as the training data set.
[0019] Furthermore, the calculation of the morphological similarity between each group of K-line data in the training data set and the target K-line data comprises the following steps:
[0020] Extract the K-line data of a stock for T consecutive trading days from the training data set as a set of K-line data;
[0021] Calculate the morphological similarity between a set of K-line data and the target K-line data;
[0022] Calculate the morphological similarity between each set of K-line data and the target K-line data in a loop.
[0023] Furthermore, the calculating of the morphological similarity between a group of K-line data and target K-line data comprises the following steps:
[0024] The Euclidean distance between the two sets of K-line data is calculated respectively as the morphological similarity between the two sets of K-line data.
[0025] Furthermore, the respectively calculating the Euclidean distance between two sets of K-line data comprises the following steps:
[0026] Calculate the Euclidean distance between the opening price sequence, the highest price sequence, the lowest price sequence, and the closing price sequence of the two sets of K-line data in sequence;
[0027] The average of the four Euclidean distances is taken as the morphological similarity between the two sets of K-line data.
[0028] Furthermore, the step of determining the confidence level of the similar data set based on the growth rate of the K-line data in the similar data set comprises the following steps:
[0029] Determine the number of stock lists in the similar data set as N;
[0030] Calculate the m-day growth rate of a list of N stocks respectively;
[0031] The number n of stocks whose m-day growth rate is greater than the fourth set threshold is counted, and the confidence level is n / N.
[0032] Furthermore, the step of screening out K-line data having a morphological similarity with the target K-line data greater than a third set threshold value from the test data set and outputting the K-line data comprises the following steps:
[0033] In the test data set, calculate the morphological similarity between the K-line data of each stock and the target K-line data;
[0034] Filter out and output the list of stocks whose morphological similarity is greater than the third set threshold.
[0035] According to a second aspect of an embodiment of the present application, a data analysis system based on K-line morphology similarity is provided, comprising:
[0036] The data interface module is used to obtain and pre-process all K-line data within a specified time period and obtain target K-line data;
[0037] A data processing module, used for dividing the K-line data into two parts: a training data set and a test data set according to the data length of the target K-line data;
[0038] A similarity calculation module is used to calculate the morphological similarity between each group of K-line data in the training data set and the target K-line data, and screen out the K-line data whose morphological similarity is greater than a first preset threshold to form a similar data set;
[0039] A confidence calculation module, used to determine the confidence of a similar data set based on the growth rate of K-line data in the similar data set;
[0040] The output module is used to screen out and output K-line data whose morphological similarity with the target K-line data is greater than a third set threshold in the test data set if the confidence is greater than the second preset threshold.
[0041] The technical solution provided by the embodiments of the present application has the following beneficial effects:
[0042] This solution simplifies complex stock selection into a quick stock selection based on the similarity of the target K-line pattern provided by the user, which ultimately greatly simplifies the difficulty of stock selection for stock investors. This solution exhaustively lists all stocks with high similarity to the target K-line pattern in historical data, and at the same time incorporates growth rate and confidence into the analysis system. The analysis method of this solution is stable and has strong guidance.
[0043] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0045] Figure 1 The present invention is a flowchart of a data analysis method based on K-line pattern similarity according to an exemplary embodiment.
[0046] Figure 2 The invention discloses K-line data of an embodiment of a stock selection method based on daily K-line patterns.
[0047] Figure 3 It is a block diagram of a data analysis system based on K-line pattern similarity according to an exemplary embodiment. DETAILED DESCRIPTION
[0048] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of methods and systems consistent with some aspects of the present application as detailed in the appended claims.
[0049] Figure 1 This is a flow chart of a data analysis method based on K-line morphology similarity according to an exemplary embodiment. The method may include the following steps:
[0050] Step S1, obtaining and preprocessing all K-line data within a specified time period;
[0051] Step S2, obtaining target K-line data, and dividing the K-line data into a training data set and a test data set according to the data length of the target K-line data;
[0052] Step S3, calculating the morphological similarity between each group of K-line data in the training data set and the target K-line data, and screening out the K-line data whose morphological similarity is greater than a first preset threshold to form a similar data set;
[0053] Step S4, determining the confidence level of the similar data set based on the growth rate of the K-line data in the similar data set;
[0054] Step S5: If the confidence level is greater than the second preset threshold, K-line data having a morphological similarity with the target K-line data greater than a third set threshold is screened out in the test data set and output.
[0055] This solution simplifies complex stock selection into a quick stock selection based on the similarity of the target K-line pattern provided by the user, which ultimately greatly simplifies the difficulty of stock selection for stock investors. This solution exhaustively lists the 5-day growth rate and confidence of all stocks with a similarity of the target K-line pattern ≥ the set threshold F1 in history. If the 5-day growth rate and confidence ≥ the set threshold F2, then the stock list with a similarity of the target K-line pattern ≥ the set threshold F1 is screened out from the test data set, thereby greatly improving the confidence.
[0056] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0057] The solution of this application is further explained below in combination with specific application scenarios.
[0058] A stock selection method and system based on the similarity of stock daily K-line patterns is provided to improve confidence and stock selection efficiency while reducing the difficulty and risk of investment analysis for investors.
[0059] To achieve the above objectives, the present invention provides a stock selection method based on the similarity of stock daily K-line patterns, the method comprising the following steps:
[0060] S1. Connect to the database to obtain and pre-process all stock daily K-line data in the past N years;
[0061] S2, all stock data in nearly N years are divided into two parts: training data set and test data set;
[0062] S3, calculate the similarity between all stock lists in the training data set and the target K-line pattern, and select n stock lists whose similarity is ≥ the set threshold F1;
[0063] S4, calculating the 5-day growth rate and confidence of the list of n stocks selected in step S3;
[0064] S5. If the confidence calculated in step S4 is greater than or equal to the set threshold F2, a list of stocks whose similarity to the target K-line pattern is greater than or equal to the set threshold F1 is selected from the test data set and displayed to the user.
[0065] In some embodiments, step S1 specifically includes the following steps:
[0066] S11. Use Python to read all the daily stock data in the database for the past N years, including: opening price, highest price, lowest price, closing price, where N is a positive integer ≥ 1; where N years are trading days in a specified time period, and the data is executed according to the actual value set by the user;
[0067] S12, normalize and remove extreme values of all acquired daily K-line data of stocks, and delete the data of suspended and ST stocks;
[0068] It should be noted that normalization refers to compressing data within the range of [0,1], including the two boundary numbers 0 and 1. Normalization is a common dimensional processing method that can compress all data within the range of [0,1] to eliminate the problem of large differences between stock prices of different stocks and keep all data consistent.
[0069] The calculation formula is: Xnor = (X-Xmin) / (Xmax-Xmin); where X is the initial value, Xmin is the minimum value in the sequence, and Xmax is the maximum value in the sequence.
[0070] In some embodiments, step S1 specifically includes the following steps:
[0071] S21. Receive the target K-line pattern selected by the user. The target K-line pattern features should include: stock code, initial date of K-line data (initial trading date), end date (end trading date), and data length (number of trading days T);
[0072] S22. Get the most recent closing transaction date (for example, if the current time is 2024.8.27 14:32 p.m., then the most recent closing transaction date is yesterday, 2024.8.26 Monday);
[0073] S23. Take the stock data of the most recent T (T here refers to the number of trading days T of the target K-line pattern above) trading days as the test data set, and the remaining data as the training data set.
[0074] In some embodiments, step S3 specifically includes the following steps:
[0075] S31, calculating the similarity between all stock lists in the training data set and the target K-line pattern;
[0076] S32, select a list of n stocks whose similarity is greater than or equal to a preset threshold F1, where F1 is a first preset threshold.
[0077] For example, the user circles the red box K-line pattern on the daily K-line of stock 001201. Figure 2 shown.
[0078] According to the target K-line pattern selected by the user (i.e. Figure 2 The part circled in the box) can obtain the stock code of the target K-line pattern 001201, the initial trading date of the K-line pattern 2024.4.11, the end trading date 2024.4.22, and the trading days T is 8 days.
[0079] According to the stock code, start trading date and end trading date of the target K-line pattern obtained above, the data list of the target K-line pattern is extracted from the database as follows:
[0080] Stock Code Transaction Date Opening Price Highest Price Lowest Price Closing Price 001201 2024-04-11 20.93 21.30 20.52 20.55 001201 2024-04-12 20.51 20.74 19.91 20.01 001201 2024-04-15 20.01 20.06 18.73 19.03 001201 2024-04-16 19.00 17.00 17.60 17.72 001201 2024-04-17 17.85 18.67 17.83 18.35 001201 2024-04-18 18.30 19.14 17.80 18.80 001201 2024-04-19 18.60 19.10 18.28 18.55 001201 2024-04-22 18.56 20.41 18.56 19.63
[0081] After normalization, it is:
[0082] Stock Code Transaction Date Opening Price Highest Price Lowest Price Closing Price 001201 2024-04-11 1.00 1.00 0.00 1.00 001201 2024-04-12 0.86 0.87 0.79 0.81 001201 2024-04-15 0.70 0.71 0.39 0.46 001201 2024-04-16 0.37 0.00 0.00 0.00 001201 2024-04-17 0.00 0.39 0.08 0.22 001201 2024-04-18 0.15 0.50 0.07 0.38 001201 2024-04-19 0.24 0.49 0.23 0.29 001201 2024-04-22 0.23 0.79 0.33 0.67
[0083] Use Python loop to calculate the similarity between all stock lists in the training data set and the target K-line pattern. The similarity here uses the Euclidean distance of the two sequences, which is calculated by taking the square root of the sum of the squares of the differences between the two data sequences.
[0084] Suppose we are given two sequences A and B, both of length m, where the elements of A are a1, a2, …, am, and the elements of B are b1, b2, …, bm.
[0085] Then the Euclidean distance between A and B can be expressed as: Sqrt((a1-b1)^2+(a2-b2)^2+…+(am-bm)^2); where sqrt() represents the square root operator.
[0086] For example, take the data of a stock 002178 in the past N years within 8 consecutive trading days (the data here is taken from the normalized database above, so it has been normalized):
[0087] Stock Code Transaction Date Opening Price Highest Price Lowest Price Closing Price 002178 2024-2-29 0.00 0.00 0.00 0.11 002178 2024-3-1 0.66 0.77 0.97 1.00 002178 2024-3-4 1.00 1.00 1.00 0.72 002178 2024-3-5 0.75 0.59 1.00 0.06 002178 2024-3-6 0.53 0.41 0.94 0.56 002178 2024-3-7 0.74 0.77 1.00 0.00 002178 2024-3-8 0.55 0.27 0.81 0.17 002178 2024-3-11 0.55 0.27 0.84 0.50
[0088] The Euclidean distance between the opening price sequences of two stock lists is:
[0089] Sqrt((1.00-0.00)^2+(0.86-0.66)^2+(0.70-1.00)^2+(0.37-0.75)^2+(0. 00-0.53)^2+(0.15-0.74)^2+(0.24-0.55)^2+(0.23-0.55)^2)=1.4551632.
[0090] The Euclidean distance between the highest price sequences of two stock lists is:
[0091] Sqrt((1.00-0.00)^2+(0.87-0.77)^2+(0.71-1.00)^2+(0.00-0.59)^2+(0. 39-0.41)^2+(0.50-0.77)^2+(0.49-0.27)^2+(0.79-0.27)^2)=1.3543633.
[0092] The Euclidean distance between the lowest price sequences of two stock lists is:
[0093] Sqrt((0.00-0.00)^2+(0.79-0.97)^2+(0.39-1.00)^2+(0.00-1.00)^2+(0. 08-0.94)^2+(0.07-1.00)^2+(0.23-0.81)^2+(0.33-0.84)^2)=1.8988154.
[0094] The Euclidean distance between the closing price series of two stock lists is:
[0095] Sqrt((1.00-0.11)^2+(0.81-1.00)^2+(0.46-0.72)^2+(0.00-0.06)^2+(0. 22-0.56)^2+(0.38-0.00)^2+(0.29-0.17)^2+(0.67-0.50)^2)=1.0966768.
[0096] Finally, the Euclidean distance between the two stock list sequences is:
[0097] (1.4551632+1.3543633+1.8988154+1.0966768) / 4=1.4512547.
[0098] The smaller the Euclidean distance between two sequences, the higher the similarity between the two sequences. In the same way, the similarity between all stock lists in the training data set and the target K-line pattern can be calculated.
[0099] In step S3 and step S5, a list of N stocks with similarity ≥ the set threshold F1 is obtained. It should be noted that "stock list" is used here instead of "stock" because it is not accurate to say that a certain stock is taken out alone. The same stock can be bought on different trading dates and sold on different trading dates, and the investment returns that can be obtained are very different. Therefore, the "stock list" is taken in this scheme. The "stock list" contains the stock code and the daily K-line data of T trading days. The stock list thus screened can guide the user when to buy (for example, after selecting a stock list with a similarity of the target K-line shape ≥ the set threshold, buy it at the opening of the next trading day, and sell it at the closing price of the 5th trading day after holding it for 5 trading days (excluding the day of purchase).
[0100] In some embodiments, step S4 specifically includes the following steps:
[0101] S41. Use Python to batch calculate the m-day growth rate of the N stocks selected in step S3. That is, assuming that the stock is bought at the opening price of the trading day after the K-line pattern, held for m trading days (excluding the day of purchase), and then sold at the closing price of the mth trading day, the m-day growth rate = bid-ask spread / purchase cost*100%;
[0102] S42, count the number of stocks with m-day growth rate ≥ F4 as n, calculate the ratio of n / N, and obtain the confidence level corresponding to the stock selection based on the target K-line pattern. Wherein, m is a user-set value, which can be set to 5 in a specific embodiment, that is, the 5-day growth rate of the stock is calculated; F4 is the fourth preset threshold, which can be set to F4=0 in some embodiments, that is, the stock list with 5-day growth rate ≥ 0 is selected.
[0103] In some embodiments, step S5 specifically includes the following steps:
[0104] S51. If the confidence calculated in step S4 is greater than or equal to the set threshold F2, then in the test data set, the similarity between all stock lists and the target K-line pattern is calculated; wherein F2 is a second preset threshold.
[0105] S52, obtain a list of M stocks whose similarity calculated in S51 is ≥ a set threshold F3; wherein F3 is a third preset threshold, and in some embodiments, F1 = F3.
[0106] S53. Display the list of M stocks selected in S52 to the user.
[0107] An embodiment of the present invention also provides a data analysis system based on K-line pattern similarity. The stock selection system includes: a data interface module, a data processing module, a similarity calculation module, a confidence calculation module and an output module.
[0108] The data interface module is used to obtain and preprocess all K-line data within a specified time period and obtain target K-line data.
[0109] The data processing module is used to divide the K-line data into two parts: a training data set and a test data set according to the data length of the target K-line data.
[0110] The similarity calculation module is used to calculate the morphological similarity between each group of K-line data in the training data set and the target K-line data, and screen out the K-line data with a morphological similarity greater than a first preset threshold to form a similar data set.
[0111] The confidence calculation module is used to determine the confidence of a similar data set based on the growth rate of the K-line data in the similar data set.
[0112] The output module is used to screen out and output K-line data whose morphological similarity with the target K-line data is greater than a third set threshold in the test data set if the confidence is greater than a second preset threshold.
[0113] Regarding the system in the above embodiment, the specific steps for each module to perform operations have been described in detail in the embodiment of the method, and will not be described in detail here. Each module in the above data analysis system based on K-line morphology similarity can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0114] It can be understood that the same or similar parts of the above embodiments can be referenced to each other, and the contents not described in detail in some embodiments can refer to the same or similar contents in other embodiments.
[0115] It should be noted that, in the description of this application, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, the meaning of "plurality" refers to at least two.
[0116] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0117] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0118] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0119] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0120] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0121] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0122] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A data analysis method based on K-line morphology similarity, characterized in that: The steps include: Obtain and preprocess all K-line data within the specified time period; Obtain target K-line data, and divide the K-line data into two parts: a training data set and a test data set according to the data length of the target K-line data; Calculate the morphological similarity between each group of K-line data in the training data set and the target K-line data, and select the K-line data whose morphological similarity is greater than a first preset threshold to form a similar data set; Determine the confidence level of similar data sets based on the growth rate of K-line data in similar data sets; If the confidence level is greater than the second preset threshold, K-line data having a morphological similarity with the target K-line data greater than a third set threshold is screened out from the test data set and output.
2. The method according to claim 1, characterized in that The step of obtaining and preprocessing all K-line data within a specified time period includes the following steps: Read all K-line data of the specified trading day from the database. The K-line data of each trading day includes: opening price, highest price, lowest price and closing price; All K-line data are normalized and de-extreme valued.
3. The method according to claim 2, characterized in that The normalization process comprises: Xnor=(X-Xmin) / (Xmax-Xmin); wherein X is the initial value, Xmin is the minimum value in the sequence, and Xmax is the maximum value in the sequence.
4. The method according to any one of claims 1 to 3, characterized in that: The method of dividing the K-line data into a training data set and a test data set according to the data length of the target K-line data comprises the following steps: Determine the initial date, end date and data length T of the target K-line data; The K-line data of the last T trading days are taken as the test data set, and the remaining data are taken as the training data set.
5. The method according to claim 4, characterized in that The step of calculating the morphological similarity between each group of K-line data in the training data set and the target K-line data comprises the following steps: Extract the K-line data of a stock for T consecutive trading days from the training data set as a set of K-line data; Calculate the morphological similarity between a set of K-line data and the target K-line data; Calculate the morphological similarity between each set of K-line data and the target K-line data in a loop.
6. The method according to claim 5, characterized in that The step of calculating the morphological similarity between a group of K-line data and target K-line data comprises the following steps: The Euclidean distance between the two sets of K-line data is calculated respectively as the morphological similarity between the two sets of K-line data.
7. The method according to claim 6, characterized in that The method of respectively calculating the Euclidean distance between two sets of K-line data comprises the following steps: Calculate the Euclidean distance between the opening price sequence, the highest price sequence, the lowest price sequence, and the closing price sequence of the two sets of K-line data in sequence; The average of the four Euclidean distances is taken as the morphological similarity between the two sets of K-line data.
8. The method according to any one of claims 1-3, 5-7, characterized in that: The step of determining the confidence level of a similar data set based on the growth rate of K-line data in the similar data set comprises the following steps: Determine the number of stock lists in the similar data set as N; Calculate the m-day growth rate of a list of N stocks respectively; The number n of stocks whose m-day growth rate is greater than the fourth set threshold is counted, and the confidence level is n / N.
9. The method according to any one of claims 1-3 and 5-7, characterized in that: The step of screening out K-line data having a morphological similarity with the target K-line data greater than a third set threshold value from the test data set and outputting the K-line data comprises the following steps: In the test data set, calculate the morphological similarity between the K-line data of each stock and the target K-line data; Filter out and output the list of stocks whose morphological similarity is greater than the third set threshold.
10. A data analysis system based on K-line morphology similarity, characterized in that: include: The data interface module is used to obtain and pre-process all K-line data within a specified time period and obtain target K-line data; A data processing module, used for dividing the K-line data into two parts: a training data set and a test data set according to the data length of the target K-line data; A similarity calculation module is used to calculate the morphological similarity between each group of K-line data in the training data set and the target K-line data, and screen out the K-line data whose morphological similarity is greater than a first preset threshold to form a similar data set; A confidence calculation module, used to determine the confidence of a similar data set based on the growth rate of K-line data in the similar data set; The output module is used to screen out and output K-line data whose morphological similarity with the target K-line data is greater than a third set threshold in the test data set if the confidence is greater than the second preset threshold.