Stock recommendation method and device, computer equipment and storage medium

By calculating the logarithmic rate of return and random dominance coefficient of stocks in the stock market, and using clustering algorithms to classify stocks, the problem of low recommendation efficiency when recommending stocks for investors with different preferences is solved, and fast and efficient stock screening and recommendation are achieved .

CN119444430APending Publication Date: 2025-02-14CHANGCHUN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411574827.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

When recommending stocks for investors with different preferences, recommendations in the prior art are inefficient and thousands of random dominance tests are required.

Method used

By obtaining the weekly closing price data of multiple stocks in the stock market, calculate the logarithmic rate of return of each stock, and calculate the random dominance coefficient between any two stocks of the target population based on the logarithmic rate of return, and construct a random dominance coefficient. matrix. Then, cluster multiple stocks using the clustering algorithm, select the two types of stocks with the strongest random dominance relationship for comparison, and recommend the dominant one type of stock as the target investment portfolio.

Benefits of technology

Through the clustering method of the random dominant coefficient matrix, the stock stacking of the target population can be quickly achieved, stock screening efficiency can be improved, and stock selection workload and difficulty can be reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119444430A_ABST
    Figure CN119444430A_ABST
Patent Text Reader

Abstract

The invention provides a stock recommendation method and device, computer equipment and a storage medium, and belongs to the technical field of financial transaction analysis, and the method comprises the steps: obtaining the weekly closing price data of a plurality of stocks in a stock market, calculating the logarithmic return rate of each stock, and obtaining a logarithmic return rate set of each stock; calculating a random domination coefficient between any two stocks corresponding to the target crowd based on the logarithmic return rate set to obtain a random domination coefficient matrix; determining an optimal clustering number, and inputting the logarithm yield and the optimal clustering number into a clustering algorithm for clustering; and comparing the random domination relationship between different types of centers, selecting two types of stocks with the strongest random domination relationship for comparison, and carrying out stock recommendation on a target population by taking one type of stocks with the strongest random domination relationship as a target investment portfolio. According to the method, the favorite stocks can be screened out for the target crowd more quickly, and the stock screening efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of financial transaction analysis, and specifically relates to a stock recommendation method, device, computer equipment and storage medium. Background Art

[0002] According to the different risk preferences of investors, investors can be divided into risk-averse and risk-seeking types. Different risk attitudes will lead to different investment stocks. Therefore, using the random dominance method to evaluate the quality of stocks and build investment portfolios has become a good method. However, this method is mostly used for pairwise random variable comparison. If investors want to choose from a large number of stocks, they need to do thousands of random dominance tests, which leads to low efficiency in recommending stocks for investors with different preferences. Summary of the invention

[0003] In order to solve the problem of low recommendation efficiency when recommending stocks to investors with different preferences, the present invention provides a stock recommendation method.

[0004] In order to achieve the above object, the present invention provides the following technical solutions:

[0005] A stock recommendation method, comprising:

[0006] Obtain weekly closing price data of multiple stocks in the stock market, calculate the logarithmic rate of return of each stock based on the closing price data, and obtain the logarithmic rate of return set of each stock;

[0007] Based on the set of logarithmic returns of each stock, the random dominance coefficient between any two stocks corresponding to the target population is calculated to obtain a random dominance coefficient matrix; the target population includes risk-averse people and risk-seeking people, and the random dominance coefficient is the random dominance degree value of any two stocks Y and Z among multiple stocks; the larger the random dominance coefficient, the more significant the random dominance relationship between stocks Y and Z;

[0008] Determine the optimal number of clusters, input the logarithmic return of each stock and the optimal number of clusters into the clustering algorithm, cluster multiple stocks using the random dominance coefficient matrix as a similarity measure, and obtain the clustering results;

[0009] The mean of the logarithmic return of each class of stocks in the clustering results is taken as the class center, the random dominance relationships between different class centers are compared, the two classes of stocks with the strongest random dominance relationships are selected for comparison, and the dominant class of stocks is used as the target investment portfolio to recommend stocks to the target population.

[0010] Optionally, the random dominance coefficient between any two stocks corresponding to the target population is calculated based on the set of logarithmic returns of each stock, including:

[0011] Based on the random dominance function of the target population, the random dominance coefficient under each logarithmic return rate x within the logarithmic return range of stocks Y and Z is calculated, and the maximum value of multiple random dominance coefficients is used as the first random dominance test statistic;

[0012] Taking the same logarithmic return distribution of stocks Y and Z as the null hypothesis, the second random dominance test statistic under the null hypothesis is calculated based on the bootstrap method to construct the sampling distribution;

[0013] The random dominance coefficients between stocks corresponding to the target population are calculated based on the second random dominance test statistic and the sampling distribution.

[0014] Alternatively, the stochastic dominance function of the risk-averse population is:

[0015]

[0016] in, represents the degree to which stock Y randomly dominates stock Z under the logarithmic rate of return x corresponding to the risk-averse population, j represents the dominance order, is the j-order empirical cumulative probability of the logarithmic return of stock Y, is the j-order empirical cumulative probability of the logarithmic return of stock Z, express The empirical variance function of

[0017] The stochastic dominance function of the risk-seeking population is:

[0018]

[0019] in, represents the degree to which stock Y randomly dominates stock Z under logarithmic return x corresponding to the risk-seeking population; is the j-order empirical inverse cumulative probability of the logarithmic return of stock Y, is the j-order empirical inverse cumulative probability of the logarithmic return of stock Z, express The empirical variance function of

[0020] The first random dominance test statistic for stocks in the risk-averse population is:

[0021]

[0022] Where a is the lower bound of the logarithmic returns of stocks Y and Z, and b is the upper bound of the logarithmic returns of stocks Y and Z;

[0023] The first random dominance test statistic for the risk-seeking population corresponding to the stock is:

[0024]

[0025] Optionally, the null hypothesis is that the logarithmic return distributions of stocks Y and Z are the same, and the second random dominance test statistic under the null hypothesis is calculated based on the bootstrap method to construct a sampling distribution, including:

[0026] The logarithmic return set of stock Y and the logarithmic return set of random stock Z are combined into a total logarithmic return set, and random sampling with replacement is performed in the total logarithmic return set to obtain a first sample set and a second sample set; the size of the first sample set is the same as the size of the logarithmic return set of random stock Y, and the size of the second sample set is the same as the size of the logarithmic return set of random stock Z;

[0027] The second random dominance test statistic between the stocks corresponding to the risk-averse population is calculated through the first sample set and the second sample set. The second random dominance test statistic between stocks corresponding to the risk-seeking population

[0028] Repeat the sampling N times, and calculate the first sample set and the second sample set obtained by each sampling and Get N Collection and N Collection

[0029] Alternatively, the random dominance coefficient between stocks corresponding to the risk-averse population is:

[0030]

[0031] The random dominance coefficient between stocks corresponding to the risk-seeking population is:

[0032]

[0033] Where I(·) is the indicator function.

[0034] Alternatively, the formula for calculating the log return of each stock based on closing price data is:

[0035]

[0036] Among them, r t represents the logarithmic rate of return, ln() represents the natural logarithm, P t represents the closing price of the stock in period t, P t-1 represents the closing price of the stock in period t-1.

[0037] Optionally, the silhouette coefficient method is used to select the optimal number of clusters, including:

[0038] Obtaining the reference cluster number, performing clustering according to each cluster number in the reference cluster number, and calculating a plurality of silhouette coefficients;

[0039] The silhouette coefficients of different cluster numbers are compared, and the number of clusters corresponding to the largest silhouette coefficient is determined as the optimal number of clusters.

[0040] The present invention also provides a stock recommendation device, comprising:

[0041] The first calculation module is used to obtain weekly closing price data of multiple stocks in the stock market, calculate the logarithmic rate of return of each stock according to the closing price data, and obtain the logarithmic rate of return set of each stock;

[0042] The second calculation module is used to calculate the random dominance coefficients between stocks corresponding to the target population based on the logarithmic return set of each stock, and construct a random dominance coefficient matrix; wherein the target population includes risk-averse people and risk-seeking people, and the random dominance coefficient is the random dominance degree value of any two stocks Y and Z among multiple stocks; the larger the random dominance coefficient, the more significant the random dominance relationship between stocks Y and Z;

[0043] The clustering module is used to determine the optimal number of clusters, input the logarithmic return of each stock and the optimal number of clusters into the clustering algorithm, cluster multiple stocks using the random dominance coefficient matrix as a similarity measure, and obtain the clustering results;

[0044] The stock recommendation module is used to take the mean of the logarithmic returns of each class of stocks in the clustering results as the class center, compare the random dominance relationships between different class centers, select the two classes of stocks with the strongest random dominance relationships for comparison, and use the dominant class of stocks as the target investment portfolio to recommend stocks to the target population.

[0045] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned stock recommendation method when executing the program.

[0046] The present invention also provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned stock recommendation method is implemented.

[0047] The stock recommendation method provided by the present invention has the following beneficial effects:

[0048] The present invention calculates the random dominance coefficient between any two stocks corresponding to the target population, and clusters multiple stocks using the random dominance coefficient matrix as a similarity measure. Since the random dominance coefficient is the random dominance value of any two stocks Y and Z among the multiple stocks, the stocks can be classified based on the dominance, and the stocks with a smaller dominance are classified into one category, the dominance relationship of the stocks in the category is not obvious, and the dominance relationship of the stocks between the categories is obvious; in this way, the rapid clustering of the stocks corresponding to the target population can be quickly achieved, and further, the random dominance relationships between the centers of different categories are compared, and the two categories of stocks with the strongest random dominance relationships are selected for comparison, and the dominant category of stocks is used as the target investment portfolio to recommend stocks to the target population. After clustering, only the two categories of stocks with the most obvious dominance relationship need to be judged, and the desired stocks can be screened out for the target population more quickly, thereby improving the stock screening efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiment of the present invention and its design scheme, the following briefly introduces the drawings required for this embodiment. The drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0050] Figure 1 A schematic flow chart of a stock recommendation method provided in an embodiment of the present invention;

[0051] Figure 2 A schematic diagram of the structure of a stock recommendation device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0052] In order to enable those skilled in the art to better understand the technical solution of the present invention and implement it, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the scope of protection of the present invention.

[0053] In the description of the present invention, it is to be understood that the terms “center”, “longitudinal”, “lateral”, “length”, “width”, “thickness”, “up”, “down”, “front”, “back”, “left”, “right”, “vertical”, “horizontal”, “top”, “bottom”, “inside”, “outside”, “axial”, “radial”, “circumferential”, etc., indicating orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are only for the convenience of describing the technical solutions of the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0054] In addition, the terms "first", "second", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance. In the description of the present invention, it should be noted that, unless otherwise clearly specified or limited, the terms "connected" and "connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances. In the description of the present invention, unless otherwise specified, "plurality" means two or more, which will not be described in detail here.

[0055] Before introducing the stock recommendation method provided by the present invention, relevant concepts involved in the embodiments of the present invention are first introduced.

[0056] Stochastic Dominance (SD) is a method for comparing two or more random variables based on the probability distribution of these variables.

[0057] There are several main forms of stochastic dominance: first-order stochastic dominance, second-order stochastic dominance and third-order stochastic dominance.

[0058] Definition of Risk-Averse Stochastic Dominance (ASD): Given random variables Y and Z, F and G are the probability distribution functions corresponding to Y and Z respectively. If Y is better than Z, it is recorded as j represents the dominant order, j = 1, 2, 3; for any x∈[a,b], x represents the logarithmic return of the stock. j=2,3,H=F or G. The concept can be used to study the stochastic dominance theory of risk-averse people. This type of stochastic dominance is called ascending order stochastic dominance (ASD). is the j-order ASD or j-order cumulative probability, because for Obtained from the leftmost ascending integral of the risk in the lower half of the interval.

[0059] Definition of risk-seeking population random dominance (DSD): Given random variables Y and Z, F and G are the probability distribution functions corresponding to Y and Z respectively. If Y is better than Z, it is recorded as j represents the dominant order, j = 1, 2, 3; for any x∈[a,b], x represents the logarithmic return of the stock. j=2,3.H=F or G. The concept can be used to study the stochastic dominance theory of risk-seeking populations, which is called descending stochastic dominance (DSD). is the j-order DSD or j-order inverse cumulative probability, because for Obtained from the rightmost descending integral of the profits in the upper half of the interval.

[0060] Example 1

[0061] As an important branch of data mining, cluster analysis aims to study the similarity between data and classify data with similar characteristics into the same category. At present, the application of cluster analysis in the financial field has become an effective helper for investors. Based on this, the present invention provides a stock recommendation method, such as Figure 1 As shown, the method comprises the following steps:

[0062] S1, obtain weekly closing price data of multiple stocks in the stock market, calculate the logarithmic rate of return of each stock based on the closing price data, and obtain the logarithmic rate of return set of each stock.

[0063] The stocks are multi-period stocks, and optionally, the time length of the multi-period stocks is more than 3 months; the weekly closing price data is the closing price data of the stocks on the last trading day of each week.

[0064] It should be understood that the logarithmic return of stocks is a way to measure the return on stock investment and can reflect the changes in stock prices. The calculation method of logarithmic return is as follows:

[0065]

[0066] Among them, r t represents the logarithmic rate of return, ln() represents the natural logarithm, P t represents the closing price of the stock in period t, P t-1 represents the closing price of the stock in period t-1.

[0067] S2, based on the set of logarithmic returns of each stock, calculate the random dominance coefficient between any two stocks corresponding to the target population and obtain the random dominance coefficient matrix.

[0068] Among them, the target population includes risk-averse people and risk-seeking people. It should be understood that risk-averse people usually tend to invest in stocks with low volatility and stable returns; risk-seeking people may prefer stocks with high volatility and high potential returns. Usually, the risk characteristics of a stock can be judged by the cumulative probability and inverse cumulative probability of the logarithmic return of the stock, specifically:

[0069] If the cumulative probability distribution of the logarithmic return of a stock is more concentrated in the lower return range, that is, most of the returns fall in a lower but relatively stable range, this indicates that the risk of the stock is low; at the same time, if its reverse cumulative probability drops rapidly in the higher return range, that is, the probability of the return exceeding a certain higher level is very small, this further confirms the low-risk characteristics of the stock. On the contrary, if the cumulative probability distribution of the logarithmic return of a stock is dispersed in a wider range, that is, the fluctuation range of the return is large, this indicates that the risk of the stock is high. At the same time, if its reverse cumulative probability remains at a high level in the higher return range, that is, the return has the potential to reach a very high level (although the probability is small), this also reflects the high-risk characteristics of the stock.

[0070] The random dominance coefficient is the random dominance value of any two stocks Y and Z among multiple stocks. The larger the random dominance coefficient, the more significant the random dominance relationship between stocks Y and Z. Therefore, the size of the random dominance coefficient between two stocks can be used to know which stocks have similar risk characteristics.

[0071] The random dominance coefficient matrix includes the random dominance coefficients of any two stocks among multiple stocks.

[0072] Next, the calculation process of the random dominance coefficient between any two stocks corresponding to the target population is introduced. The embodiment of the present invention calculates the random dominance coefficient by a hypothesis test statistical method, including the following steps:

[0073] Step 1: Calculate the random dominance coefficient for each logarithmic return x within the range of logarithmic returns of stocks Y and Z based on the random dominance function of the target population, and take the maximum value of multiple random dominance coefficient values ​​as the first random dominance test statistic.

[0074] It should be understood that for different target groups, the random dominance coefficient under each logarithmic rate of return x can be calculated by the random dominance function corresponding to the group, where the random dominance function of the risk-averse group is:

[0075]

[0076] in, represents the degree of random dominance of stock Y to Z under logarithmic return rate x corresponding to the risk-averse population, j represents the dominance order, is the j-order empirical cumulative probability of the logarithmic return of stock Y, is the j-order empirical cumulative probability of the logarithmic return of stock Z, express The empirical variance function of .

[0077] The stochastic dominance function of the risk-seeking population is:

[0078]

[0079] in, represents the degree to which stock Y randomly dominates stock Z under logarithmic return x corresponding to the risk-seeking population; is the j-order empirical inverse cumulative probability of the logarithmic return of stock Y, is the j-order empirical inverse cumulative probability of the logarithmic return of stock Z, express The empirical variance function of .

[0080] in, H=F or G; h=f or g.

[0081]

[0082] H=F or G; h=f or g.

[0083] It should be understood that the “+” in the formula means that h i - If x is positive, then h i -x=h i -x, otherwise h i -x=0.

[0084] Furthermore, the maximum value among the multiple random dominance coefficients is used as the first random dominance test statistic, wherein the first random dominance test statistic of the risk-averse population corresponding to the stock is expressed as:

[0085]

[0086] Among them, a is the lower bound of the logarithmic returns of stocks Y and Z, and b is the upper bound of the logarithmic returns of stocks Y and Z.

[0087] The first random dominance test statistic for the risk-seeking population corresponding to the stock is:

[0088]

[0089] Step 2: Take the same logarithmic return distribution of stocks Y and Z as the null hypothesis, calculate the second random dominance test statistic under the null hypothesis based on the bootstrap method, and construct the sampling distribution.

[0090] Specifically, first, the logarithmic return set of stock Y {f i ; i=1,2,…,N f} and the set of logarithmic returns of random stocks Z {g i ; i=1,2,…,N g} is merged into a total logarithmic return set {f(i) ,g (j) ; i=1,2,…,N f ,j=1,2,…,N g}, perform random sampling with replacement in the total logarithmic return set to obtain the first sample set and the second sample set The size of the first sample set is the same as the size of the logarithmic return set of random stock Y, and the size of the second sample set is the same as the logarithmic return set of random stock Z. Then, the second random dominance test statistic between the corresponding stocks of the risk-averse population is calculated using the first sample set and the second sample set. The second random dominance test statistic between stocks corresponding to the risk-seeking population The calculation method can refer to A j and D j .

[0091] Repeat the sampling N times (for example, 1000), and calculate the first sample set and the second sample set obtained by each sampling and Get N Collection and N Collection

[0092] Step 3: Calculate the random dominance coefficients between stocks corresponding to the target population based on the second random dominance test statistic and the sampling distribution.

[0093] First, the P value is calculated. In the embodiment of the present invention, the P value is the proportion of test statistics found in the sampling distribution that are larger than the first random dominant test statistic under the premise that the null hypothesis is true. Further, the random dominant coefficient is obtained based on the proportion.

[0094] Specifically, the random dominance coefficient between stocks corresponding to the risk-averse population is:

[0095]

[0096] The random dominance coefficient between stocks corresponding to the risk-seeking population is:

[0097]

[0098] Where I(·) is the indicator function.

[0099] Through the above S1 and S2, the random dominance relationship between any two stocks among multiple stocks is obtained according to the random dominance theory of the target population.

[0100] S3, determine the optimal number of clusters, input the logarithmic return of each stock and the optimal number of clusters into the clustering algorithm, cluster multiple stocks using the random dominance coefficient matrix as a similarity measure, and obtain the clustering results.

[0101] The clustering algorithm may be a K-means clustering algorithm or other clustering algorithms, which is not specifically limited in the embodiment of the present invention.

[0102] Alternatively, the optimal number of clusters can be selected based on the silhouette coefficient method. The specific steps are as follows:

[0103] First, given a series of reference cluster numbers {k1, k2, …, k s}, first cluster each k value, calculate the silhouette coefficient of each sample, obtain s silhouette coefficients, compare their values, and select the cluster number k corresponding to the value of the largest silhouette coefficient as the optimal cluster number.

[0104] The formula for calculating the silhouette coefficient is as follows:

[0105]

[0106] Among them, S(i) represents the silhouette coefficient, b(i) represents the average distance between sample point i and all points in the nearest other clusters, and a(i) represents the average distance between sample point i and other points in the same cluster.

[0107] The optimal number of clusters may also be selected by using methods such as the elbow rule and the Gap statistic, which is not specifically limited in the embodiment of the present invention.

[0108] Furthermore, the optimal number of clusters and the logarithmic returns of stocks are input into the clustering algorithm, and the random dominance coefficient matrix is ​​used as the similarity measure for clustering. Specifically:

[0109] 1. Randomly select K samples as the initial class centers.

[0110] 2. Set the maximum number of iterations.

[0111] 3. For each sample, calculate its random dominance coefficient with the K class centers, and divide the sample into the class with the smallest random dominance coefficient.

[0112] 4. Take the mean of the samples in each class as the new class center.

[0113] 5. Determine whether the two class centers are consistent or whether the number of iterations has been reached. If any of these conditions is met, the iteration stops. Otherwise, repeat steps 3-5 until the iteration stops.

[0114] It should be understood that through the clustering process of S3, the stocks corresponding to the target population with no obvious random dominance relationship can be divided into one category, and there is an obvious dominance relationship between the categories.

[0115] S4, take the mean of the logarithmic return of each class of stocks in the clustering results as the class center, compare the random dominance relationships between different class centers, select the two classes of stocks with the strongest random dominance relationships for comparison, and use the dominant class of stocks as the target investment portfolio to recommend stocks to the target population.

[0116] Since the present invention groups stocks according to different risk preference groups, in the classification results, the strongest random dominant relationship indicates that the dominant relationship between the two types of stocks is the most obvious, and the dominant type of stock is more in line with the risk preference of the target group.

[0117] For example, suppose the logarithmic returns of the two class centers are {j i ; i=1,2,…,N j} and {k i ; i=1,2,…,N k}, use the SD theory of risk-averse people and the SD theory of risk-seeking people to determine which class center is dominant. For the risk-averse people, calculate the j-order cumulative probability:

[0118]

[0119] For the risk-seeking population, calculate the j-th order inverse cumulative probability:

[0120]

[0121] Then determine the dominant relationship under first-order, second-order, and third-order random dominance, and recommend the dominant class of stocks as the target investment portfolio for investment.

[0122] In summary, the stock clustering algorithm provided by the present invention can group a large number of stocks for risk-averse investors and risk-seeking investors, and thus make stock recommendations more accurately and efficiently. Investors with different risk preferences can quickly choose a favorite type of stock from a large number of stocks for subsequent investment or build a portfolio for investment, which greatly reduces the workload and difficulty of stock selection.

[0123] Based on the same inventive concept, the embodiment of the present invention further provides a stock recommendation device, exemplarily, as Figure 2 As shown, the device comprises:

[0124] The first calculation module 21 is used to obtain weekly closing price data of multiple stocks in the stock market, calculate the logarithmic rate of return of each stock according to the closing price data, and obtain a set of logarithmic rates of return of each stock.

[0125] The second calculation module 22 is used to calculate the random dominance coefficient between the stocks corresponding to the target population based on the logarithmic return set of each stock, and construct a random dominance coefficient matrix; wherein the target population includes a risk-averse population and a risk-seeking population, and the random dominance coefficient is the random dominance degree value of any two stocks Y and Z among multiple stocks; the larger the random dominance coefficient, the more significant the random dominance relationship between stocks Y and Z.

[0126] The clustering module 23 is used to determine the optimal number of clusters, input the logarithmic return rate of each stock and the optimal number of clusters into the clustering algorithm, cluster multiple stocks using the random dominance coefficient matrix as a similarity measure, and obtain a clustering result.

[0127] The stock recommendation module 24 is used to take the mean of the logarithmic returns of each class of stocks in the clustering results as the class center, compare the random dominance relationships between different class centers, select the two classes of stocks with the strongest random dominance relationships for comparison, and use the dominant class of stocks as the target investment portfolio to recommend stocks to the target population.

[0128] Each module in the above stock clustering device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0129] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps in the stock recommendation method embodiment. The specific implementation method can be found in the method embodiment, which will not be described in detail here.

[0130] Furthermore, the present invention also provides a non-temporary computer-readable storage medium containing instructions, and a computer program is stored on the storage medium. For example, a memory containing instructions, the above instructions can be executed by a processor of a computer device to complete the above method. For example, a non-temporary computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device. When the computer program is executed by the processor, the steps in the stock recommendation method embodiment can be implemented. The specific implementation method can be found in the method embodiment, which will not be repeated here.

[0131] It will be appreciated by those skilled in the art that embodiments of the present invention may provide methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0132] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as a combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0133] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0134] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0135] It should be pointed out that the specific implementation methods described above can enable those skilled in the art to understand the invention more comprehensively, but do not limit the invention in any way. Therefore, although the invention has been described in detail in this specification and embodiments, those skilled in the art should understand that the invention can still be modified or replaced by equivalents; and all technical solutions and improvements that do not deviate from the spirit and scope of the invention are included in the protection scope of the patent for the invention. Any figure mark in the claims should not be regarded as limiting the claims involved. Any simple change or equivalent replacement of the technical solution that can be obviously obtained by any technician familiar with the field within the technical scope disclosed in the present invention belongs to the protection scope of the present invention.

Claims

1. A stock recommendation method, characterized in that: include: Obtain weekly closing price data of multiple stocks in the stock market, calculate the logarithmic rate of return of each stock based on the closing price data, and obtain the logarithmic rate of return set of each stock; Based on the set of logarithmic returns of each stock, the random dominance coefficient between any two stocks corresponding to the target population is calculated to obtain a random dominance coefficient matrix; the target population includes risk-averse people and risk-seeking people, and the random dominance coefficient is the random dominance degree value of any two stocks Y and Z among multiple stocks; the larger the random dominance coefficient, the more significant the random dominance relationship between stocks Y and Z; Determine the optimal number of clusters, input the logarithmic return of each stock and the optimal number of clusters into the clustering algorithm, cluster multiple stocks using the random dominance coefficient matrix as a similarity measure, and obtain the clustering results; The mean of the logarithmic return of each class of stocks in the clustering results is taken as the class center, the random dominance relationships between different class centers are compared, the two classes of stocks with the strongest random dominance relationships are selected for comparison, and the dominant class of stocks is used as the target investment portfolio to recommend stocks to the target population.

2. The stock recommendation method according to claim 1, characterized in that: The random dominance coefficient between any two stocks corresponding to the target population is calculated based on the logarithmic return set of each stock, including: Based on the random dominance function of the target population, the random dominance coefficient under each logarithmic return rate x within the logarithmic return range of stocks Y and Z is calculated, and the maximum value of multiple random dominance coefficients is used as the first random dominance test statistic; Taking the same logarithmic return distribution of stocks Y and Z as the null hypothesis, the second random dominance test statistic under the null hypothesis is calculated based on the bootstrap method to construct the sampling distribution; The random dominance coefficients between stocks corresponding to the target population are calculated based on the second random dominance test statistic and the sampling distribution.

3. The stock recommendation method according to claim 2, characterized in that: The stochastic dominance function of the risk-averse population is: in, represents the degree to which stock Y randomly dominates stock Z under the logarithmic rate of return x corresponding to the risk-averse population, j represents the dominance order, is the j-order empirical cumulative probability of the logarithmic return of stock Y, is the j-order empirical cumulative probability of the logarithmic return of stock Z, express The empirical variance function of The stochastic dominance function of the risk-seeking population is: in, represents the degree to which stock Y randomly dominates stock Z under logarithmic return x corresponding to the risk-seeking population; is the j-order empirical inverse cumulative probability of the logarithmic return of stock Y, is the j-order empirical inverse cumulative probability of the logarithmic return of stock Z, express The empirical variance function of The first random dominance test statistic for stocks in the risk-averse population is: Where a is the lower bound of the logarithmic returns of stocks Y and Z, and b is the upper bound of the logarithmic returns of stocks Y and Z; The first random dominance test statistic for the risk-seeking population corresponding to the stock is:

4. The stock recommendation method according to claim 3, characterized in that: Taking the same logarithmic return distribution of stocks Y and Z as the null hypothesis, the second random dominance test statistic under the null hypothesis is calculated based on the bootstrap method, and the sampling distribution is constructed, including: The logarithmic return set of stock Y and the logarithmic return set of random stock Z are combined into a total logarithmic return set, and random sampling with replacement is performed in the total logarithmic return set to obtain a first sample set and a second sample set; the size of the first sample set is the same as the size of the logarithmic return set of random stock Y, and the size of the second sample set is the same as the size of the logarithmic return set of random stock Z; The second random dominance test statistic between the stocks corresponding to the risk-averse population is calculated through the first sample set and the second sample set. The second random dominance test statistic between stocks corresponding to the risk-seeking population Repeat the sampling N times, and calculate the first sample set and the second sample set obtained by each sampling and Get N Collection and N Collection 5. The stock recommendation method according to claim 4, characterized in that: The random dominance coefficient between stocks corresponding to the risk-averse population is: The random dominance coefficient between stocks corresponding to the risk-seeking population is: Where I(·) is the indicator function.

6. The stock recommendation method according to any one of claims 1 to 5, characterized in that: The formula for calculating the log return of each stock based on closing price data is: Among them, r t represents the logarithmic rate of return, ln() represents the natural logarithm, P t represents the closing price of the stock in period t, P t-1 represents the closing price of the stock in period t-1.

7. The stock recommendation method according to any one of claims 1 to 5, characterized in that: The silhouette coefficient method is used to select the optimal number of clusters, including: Obtaining the reference cluster number, performing clustering according to each cluster number in the reference cluster number, and calculating a plurality of silhouette coefficients; The silhouette coefficients of different cluster numbers are compared, and the number of clusters corresponding to the largest silhouette coefficient is determined as the optimal number of clusters.

8. A stock recommendation device, characterized in that: include: The first calculation module is used to obtain weekly closing price data of multiple stocks in the stock market, calculate the logarithmic rate of return of each stock according to the closing price data, and obtain the logarithmic rate of return set of each stock; The second calculation module is used to calculate the random dominance coefficients between stocks corresponding to the target population based on the logarithmic return set of each stock, and construct a random dominance coefficient matrix; wherein the target population includes risk-averse people and risk-seeking people, and the random dominance coefficient is the random dominance degree value of any two stocks Y and Z among multiple stocks; the larger the random dominance coefficient, the more significant the random dominance relationship between stocks Y and Z; The clustering module is used to determine the optimal number of clusters, input the logarithmic return of each stock and the optimal number of clusters into the clustering algorithm, cluster multiple stocks using the random dominance coefficient matrix as a similarity measure, and obtain the clustering results; The stock recommendation module is used to take the mean of the logarithmic returns of each class of stocks in the clustering results as the class center, compare the random dominance relationships between different class centers, select the two classes of stocks with the strongest random dominance relationships for comparison, and use the dominant class of stocks as the target investment portfolio to recommend stocks to the target population.

9. A computer device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the stock recommendation method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the stock recommendation method according to any one of claims 1 to 7 is implemented.