Stock trend analysis method and apparatus based on machine learning

MYPI2025000498A0Undetermined Publication Date: 2024-02-09SHENZHEN FUTU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
MYPI2025000498
Authority / Receiving Office
MY · MY
Patent Type
Applications
Current Assignee / Owner
Filing Date
2022-08-09
Publication Date
2024-02-09

AI Technical Summary

Technical Problem

Existing stock trend prediction methods are greatly affected by personal understanding, resulting in inaccurate prediction results.

Method used

A method based on machine learning is used to obtain the technical and morphological data of the target stock, split the target model into multiple sub-target models, generate multiple trend prediction results through these sub-models, and determine the final target trend prediction result based on these results.

Benefits of technology

It improves the accuracy of stock trend prediction and provides users with accurate and sufficient market information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure PI2025000498_DRAWING_001
    Figure PI2025000498_DRAWING_001
  • Figure PI2025000498_DRAWING_002
    Figure PI2025000498_DRAWING_002
  • Figure PI2025000498_DRAWING_003
    Figure PI2025000498_DRAWING_003
Patent Text Reader

Abstract

The present application discloses a stock trend analysis method and apparatus based on machine learning, an electronic device, and a storage medium. The method comprises: acquiring a target model and stock data corresponding to a target stock; splitting the target model to obtain a plurality of sub-target models; on the basis of the stock data and the plurality of sub-target models, determining a plurality of trend prediction results corresponding to the target stock; and on the basis of the plurality of trend prediction results, determining a target trend prediction result corresponding to the target stock. According to the present application, the stock data is processed by means of an intelligent model (a target model) to output a trend prediction result corresponding to a target stock, so that the accuracy of the prediction result can be improved. Fig. 2
Need to check novelty before this filing date? Find Prior Art

Description

Stock trend analysis method and device based on machine learning Technical Field

[0001] The present application relates to the technical field of stock analysis, and in particular to a method, device, electronic device, and storage medium for stock trend analysis based on machine learning. Background Art

[0002] Mobile stock trading has become the main channel for investors to trade stocks. Mobile stock trading software provides investors with technical data on stocks, making it easier for them to predict stock trends.

[0003] At present, investors mainly use voting method to predict stock trends. That is, through multiple people's interpretation of the technical data of the stock (including the corresponding indicators and patterns of the stock, etc.), multiple trend prediction results are obtained, and then the trend prediction result recognized by the majority is selected as the final stock trend prediction result.

[0004] However, the prediction results of the above method for predicting stock trends are greatly affected by the degree of personal understanding, resulting in inaccurate prediction results.

[0005] Summary of the Invention

[0006] The embodiments of the present application provide a stock trend analysis method, device, electronic device, and storage medium based on machine learning to improve the accuracy of stock trend prediction.

[0007] In a first aspect, embodiments of the present application provide a method for analyzing stock trends based on machine learning, applicable to electronic devices, the method comprising:

[0008] Obtaining stock data corresponding to a target model and a target stock, wherein the stock data is determined based on technical indicator data and morphological data of the target stock;

[0009] Splitting the target model to obtain multiple sub-target models;

[0010] Determining a plurality of trend prediction results corresponding to the target stock based on the stock data and the plurality of sub-goal models, wherein the plurality of sub-goal models correspond one-to-one to the plurality of trend prediction results;

[0011] Based on the multiple trend prediction results, a target trend prediction result corresponding to the target stock is determined.

[0012] In a second aspect, an embodiment of the present application provides a stock trend analysis device based on machine learning, the device comprising:

[0013] A data acquisition module, configured to acquire stock data corresponding to a target model and a target stock, wherein the stock data is determined based on technical indicator data and morphological data of the target stock;

[0014] A model splitting module is used to split the target model into multiple sub-target models;

[0015] a trend prediction module, configured to determine a plurality of trend prediction results corresponding to the target stock based on the stock data and the plurality of sub-goal models, wherein the plurality of sub-goal models correspond one-to-one to the plurality of trend prediction results;

[0016] The target trend determination module is used to determine the target trend prediction result corresponding to the target stock based on the multiple trend prediction results.

[0017] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program comprises instructions for executing the steps of the method described in the first aspect of the embodiment of the present application.

[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which is used to store a computer program. The computer program is executed by a processor to implement some or all of the steps described in the method described in the first aspect of the embodiment of the present application.

[0019] In a fifth aspect, embodiments of the present application provide a computer program product, comprising a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to execute some or all of the steps described in the method described in the first aspect of the embodiments of the present application. The computer program product may be a software installation package.

[0020] The embodiments of the present application have the following beneficial effects:

[0021] Embodiments of the present application provide a machine learning-based stock trend analysis method, apparatus, electronic device, and storage medium. The method comprises: obtaining a target model and stock data corresponding to a target stock; then splitting the target model to obtain multiple sub-target models; then, based on the stock data and the multiple sub-target models, determining multiple trend prediction results corresponding to the target stock; and finally, based on the multiple trend prediction results, determining a target trend prediction result corresponding to the target stock. By processing stock data based on a data model generated by machine learning to output a trend analysis result corresponding to the target stock, the present application can improve the accuracy of the prediction results and provide users with accurate and comprehensive market information. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0023] FIG1 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;

[0024] FIG2 is a flow chart of a method for analyzing stock trends based on machine learning provided in an embodiment of the present application;

[0025] FIG3 is a schematic diagram of a process for obtaining a target model according to an embodiment of the present application;

[0026] FIG4 is a schematic diagram of a technical indicator interpretation page for Tesla provided in an embodiment of the present application;

[0027] FIG5 is a schematic diagram of a Tesla technical morphology interpretation page provided in an embodiment of the present application;

[0028] FIG6 is a flow chart of another method for analyzing stock trends based on machine learning provided in an embodiment of the present application;

[0029] FIG7 is a flow chart of another method for analyzing stock trends based on machine learning provided in an embodiment of the present application;

[0030] FIG8 is a schematic diagram of a model training process provided in an embodiment of the present application;

[0031] FIG9 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;

[0032] FIG10 is a block diagram of the functional units of a stock trend analysis device based on machine learning provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] Electronic devices may include various handheld devices with wireless communication capabilities (mobile phones, tablets, etc.), vehicle-mounted devices, wearable devices (such as smart watches, smart glasses, etc.), computing devices or other processing devices connected to wireless modems, as well as various forms of user equipment (UE), mobile stations (MS), virtual reality / augmented reality devices, terminal devices, etc. Electronic devices may also be servers.

[0034] The following is a detailed introduction to the embodiments of the present application.

[0035] As shown in Figure 1, Figure 1 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device includes a processor, a memory, a random access memory (RAM), and a display screen. Among them, the memory, RAM, and display screen are all connected to the processor.

[0036] Furthermore, the electronic device may also include a speaker, a microphone, a camera, a communication interface, a signal processor and a sensor, the speaker, microphone, camera, signal processor and sensor are all connected to the processor, and the communication interface is connected to the signal processor.

[0037] Among them, the processor is the control center of the electronic device, which uses various interfaces and lines to connect the various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory and calling data stored in the memory, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole.

[0038] The memory is used to store software programs and / or modules. The processor executes the various functional applications and data processing of the electronic device by running the software programs and / or modules stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one software program required for a function, etc.; the data storage area may store data created based on the use of the electronic device, etc. In addition, the memory may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0039] The electronic device described in FIG1 can be used to perform the following steps:

[0040] Obtaining stock data corresponding to a target model and a target stock, wherein the stock data is determined based on technical indicator data and morphological data of the target stock;

[0041] Splitting the target model to obtain multiple sub-target models;

[0042] Determining a plurality of trend prediction results corresponding to the target stock based on the stock data and the plurality of sub-goal models, wherein the plurality of sub-goal models correspond one-to-one to the plurality of trend prediction results;

[0043] Based on the multiple trend prediction results, a target trend prediction result corresponding to the target stock is determined.

[0044] It can be seen that the electronic device described in the embodiment of the present application obtains the target model and the stock data corresponding to the target stock, then splits the target model to obtain multiple sub-target models, and then determines multiple trend prediction results corresponding to the target stock based on the stock data and the multiple sub-target models. Finally, based on the multiple trend prediction results, it determines the target trend prediction result corresponding to the target stock. The present application can improve the accuracy of the prediction results by processing the stock data with an intelligent model (target model) to output the trend prediction result corresponding to the target stock.

[0045] Please refer to FIG2 , which shows a stock trend analysis method based on machine learning provided by an embodiment of the present application, which is applied to the electronic device shown in FIG1 , and specifically includes the following steps:

[0046] Step S201: Acquire the target model and stock data corresponding to the target stock.

[0047] Among them, the target model is trained based on the random forest model. The specific training method of the random forest model will be described below and will not be expanded here.

[0048] Since the model in this application is updated asynchronously, that is, the model needs to be updated regularly, but due to R&D limitations, it is impossible to update the model every time with the version update, so the model needs to be placed in external storage for hot update, for example, the file data corresponding to the model is stored in an external storage device or cloud platform, and updated in real time according to the training situation.

[0049] Therefore, this application uses the public cloud's COS (Cloud Object Storage) bucket to perform hot updates on the model. As shown in Figure 3, each time before running the algorithm in the background, it will pre-check whether the latest version of the model is available. That is, there are three ways to obtain the target model: the first is to first determine whether the target file corresponding to the target model exists locally, and obtain a first judgment result. If the first judgment result is no, download and decompress the target file from the COS bucket to obtain the target model. The second is to determine whether the target file corresponding to the target model exists locally, and obtain a first judgment result. If the first judgment result is yes, determine whether the target file is the latest version, and obtain a second result. If the second judgment result is yes, obtain the target model from the target file. The third is to determine whether the target file corresponding to the target model exists locally, and obtain a first judgment result. If the first judgment result is yes, determine whether the target file is the latest version, and obtain a second result. If the second result is no, download and decompress the target file from the COS bucket to obtain the target model.

[0050] Based on the above statements, it can be seen that if the target file corresponding to the target model does not exist locally or the target file corresponding to the local target model is not the latest version, the model version can be queried and updated through the COS bucket. During the new search process, the MD5 value of the object can be obtained first to perform a comparison query to determine whether the model file is the latest. When necessary, the user can directly download and decompress the target file from the COS bucket to obtain the target model. In addition, the COS bucket also stores and manages various versions of the model, and users can directly view past versions of the model through the COS bucket. The above method reduces data redundancy and improves the disaster recovery capability of the system.

[0051] Furthermore, the stock data includes the index data, the morphological data, the label data and the derived indicators corresponding to the target stock. The stock data is determined based on the technical index data and morphological data of the target stock. The acquisition of stock data mainly includes the following steps: first, the technical index data and morphological data of the target stock are obtained. For example, through the mobile software, such as the Futu Niu Niu app page shown in Figures 4 and 5, the stock detailed quotation page is directly entered from the Futu Niu Niu app entrance. By clicking on "Analysis", the technical indicator interpretation and morphological interpretation corresponding to the target stock (such as Tesla) can be directly displayed. The technical indicator data of Tesla can be obtained through the indicator interpretation, and the technical morphological data of Tesla can be obtained through the morphological interpretation. Then, based on the indicator data and the morphological data, the label data and derived indicators corresponding to the target stock are determined. Finally, the indicator data, the morphological data, the label data and the derived indicators are used as stock data.

[0052] Specifically, in this embodiment, the indicator data includes the values ​​corresponding to various indicators of the target stock; the morphological data includes the specific morphological distribution of the target stock, such as whether it has or does not have a certain morphology; the label data includes the label values ​​of overbought, severely overbought, oversold, severely oversold, and neutral corresponding to the indicator data of the target stock; the derived data includes data formed by coupling the historical data of the indicator data, morphological data, and label data, such as the label values ​​of overbought, severely overbought, oversold, severely oversold, neutral, and the range of increase or decrease, as well as the historical opening price, historical closing price, historical increase or decrease, etc.

[0053] Step S202: splitting the target model to obtain multiple sub-target models;

[0054] Step S203: determining multiple trend prediction results corresponding to the target stock based on the stock data and the multiple sub-target models;

[0055] Step S204: Based on the multiple trend prediction results, determine the target trend prediction result corresponding to the target stock.

[0056] Since the model is trained using historical data, the old model may become distorted over time, resulting in a decrease in prediction accuracy. In this case, it is necessary to automatically train the model regularly. At the same time, the model update cannot interfere with the published version and the main online process. Therefore, this application adopts an asynchronous update model.

[0057] Before performing trend prediction on the target stock, the present application needs to first detect whether the model has been updated. After obtaining the target model through the three methods described in the previous embodiment, the target model is first split to obtain multiple sub-target models. Then, the trend prediction of the target stock is performed by loading multiple sub-target models in batches to obtain multiple trend prediction results, wherein the multiple sub-target models correspond one-to-one to the multiple trend prediction results. The present application adopts the method of loading the target model in batches, which can reduce memory usage and lower cost requirements.

[0058] In actual applications, the original model loading took up too much memory (for example, about 27GB) and the loading time was slow (for example, the average loading time was about 10 minutes). We deconstructed the model from the bottom of the algorithm and rewrote the calculation logic code. The overall memory usage of the existing algorithm can be reduced to about 4GB. The calculation results are also basically consistent with the original model with extremely small errors (the maximum error does not exceed ±2.22e-16).

[0059] Furthermore, in conjunction with FIG6 , the target model is a random forest model as an example to illustrate the process of splitting and loading the target model, and determining the target trend prediction result corresponding to the target stock based on the split target model. The details are as follows:

[0060] After obtaining a random forest model, the number of trees in the random forest model is first determined to be m, where m is a positive integer. Then, the m trees in the random forest model are split as needed, with the splitting method being equal or unequal, determined based on specific needs. If the m trees are divided into three equal parts as needed, three sub-random forest models are obtained: a first random forest model, a second random forest model, and a third random forest model. Each of the first, second, and third random forest models includes m / 3 trees.

[0061] After splitting the random forest model, the first, second, and third random forest models can be loaded sequentially. Specifically, the stock data is input into the first, second, and third random forest models, respectively, and the first, second, and third trend prediction results are output. The first, second, and third trend prediction results are then aggregated to obtain multiple trend prediction results. Based on the multiple trend prediction results, a target trend prediction result corresponding to the target stock is determined.

[0062] Furthermore, after obtaining multiple trend prediction results, it is necessary to perform statistical analysis on the multiple trend prediction results to obtain the target trend prediction result, wherein the statistical analysis is not limited to mean calculation and other methods, wherein the target trend prediction result includes the rise and fall trend of the target stock within a preset time in the future, and the probability value corresponding to the rise and fall trend.

[0063] Furthermore, after obtaining trend prediction results based on each sub-target model and comprehensively determining the prediction results based on the trend prediction results, we calculate the correlation Con(Tre_i, Tar) between the eigenvectors Tre_i corresponding to the k trend prediction results and the eigenvector Tar corresponding to the target trend prediction result:

[0064]

[0065] Among them, α and β represent the eigenvalues ​​corresponding to the eigenvectors of each prediction result, i represents the identifier corresponding to the sub-target model, and k represents the number of sub-target models. After calculating the correlation Con_i corresponding to each sub-model, the correlation is used as the accuracy rate of the sub-model corresponding to the trend prediction result, and the accuracy rate corresponding to each sub-model is statistically calculated as the analysis weight of each trend prediction result in the next comprehensive analysis, and then the corresponding target trend prediction result Tar is obtained as:

[0066]

[0067] It should be noted that the eigenvector corresponding to the prediction result in the above formula is the vector sum of the eigenvectors corresponding to the prediction results of each target trend.

[0068] In addition, in this embodiment, the model effect of each sub-model can be evaluated based on the accuracy and the preset threshold. When the accuracy is less than the preset threshold, the sub-model is trained in a targeted manner to improve the accuracy of the sub-model, thereby improving the accuracy of the entire model.

[0069] Please refer to FIG7 , which shows another stock trend analysis method based on machine learning provided in an embodiment of the present application, which is applied to the electronic device shown in FIG1 , and specifically includes the following steps:

[0070] Step S701: Obtain an initial model and training data.

[0071] Wherein, the initial model is a random forest model.

[0072] The present application includes the following steps for obtaining training data: retrieving K-line data, then calculating initial indicator data and initial morphological data through the K-line data, then cleaning the initial indicator data and the initial morphological data to obtain target indicator data and target morphological data, and finally determining the training data based on the target indicator data and the target morphological data.

[0073] Wherein, based on the target indicator data and the target morphological data, the training data is determined, including: first determining the label data based on the target indicator data, the target morphological data and a first preset threshold, then coupling the label data and historical data to obtain a derived indicator, and then summarizing the target indicator data, the target morphological data, the label data and the derived indicator to obtain the training data.

[0074] The process of obtaining training data is detailed in conjunction with Figure 8. Before training the initial model, training data must be obtained. The main steps in obtaining training data are: first, retrieve K-line data. Initial indicator data and initial pattern data can be directly calculated from this K-line data. Then, these initial indicator and pattern data are cleaned to obtain 14 target indicator data and 8 target pattern data. Target patterns refer to the K-line itself or its derivatives possessing specific patterns, such as intersections and extreme points. These patterns can be interpreted as overbought or oversold signals. Target indicators are calculated based on historical K-line values. Unlike patterns, indicators have specific values. Different threshold ranges can be assigned to indicators based on the historical performance of different markets. Within these ranges, indicators can be interpreted as severely oversold, oversold, neutral, severely overbought, or overbought, among other conclusions.

[0075] Since both the target indicator data and the target form data can determine corresponding label data based on their own states or value ranges, wherein the label data represents the degree of overbought or oversold of the target indicator data and the target form data, the target indicator data and the target form data can be compared with the first preset threshold value respectively to directly determine the label data corresponding to the target indicator data and the target form data, i.e., whether the market is severely oversold, oversold, neutral, severely overbought, or overbought.

[0076] After the label data is determined, derived indicators can be obtained based on the coupling of the label data and historical data, where the historical data at least includes historical opening prices, historical closing prices, and historical price fluctuations. After the target indicator data, the target form data, the label data, and the derived indicators are obtained in sequence through the above steps, the target indicator data, the target form data, the label data, and the derived indicators are aggregated to obtain the training data.

[0077] From the above statements, it can be seen that in addition to the 14 target indicator data and 8 target pattern data, the label data in this embodiment also includes: thresholds established according to each indicator pattern (i.e., the first preset threshold), forming overbought, severely overbought, oversold, severely oversold and neutral label values, etc.

[0078] For example, the derived data in this embodiment also includes historical data such as price fluctuations, opening prices, and closing prices over the past three trading days, as well as the difference, price fluctuations, and original values ​​of all 14 target indicators over the past three trading days, totaling 295 different indicator dimensions. Specifically, overbought and oversold indicators in this embodiment include but are not limited to trend indicators, stochastic indicators, relative strength indicators, Williams index, deviation rate, willingness index, volume anomaly, psychological line index, oscillator index, and popularity index.

[0079] Step S702: Use the training data to train the initial model to obtain the target model.

[0080] After obtaining the training data, the training data can be directly input into the random forest model, and grid search can be used to optimize the hyperparameters in the random forest model. When the hyperparameters reach a second preset threshold, the target model is obtained. The hyperparameters may include, but are not limited to, the model's complexity, maximum complexity, and maximum feature parameter.

[0081] Step S703: Obtain the stock data corresponding to the target model and the target stock;

[0082] Step S704: splitting the target model to obtain multiple sub-target models;

[0083] Step S705: determining multiple trend prediction results corresponding to the target stock based on the stock data and the multiple sub-target models;

[0084] Step S706: Based on the multiple trend prediction results, determine the target trend prediction result corresponding to the target stock.

[0085] The contents of steps S703 to S706 are the same as those of steps S201 to S204 and are not repeated here.

[0086] It can be seen that the machine learning-based stock trend analysis method described in the embodiment of the present application obtains a target model and stock data corresponding to the target stock, then splits the target model to obtain multiple sub-target models, and then determines multiple trend prediction results corresponding to the target stock based on the stock data and the multiple sub-target models. Finally, based on the multiple trend prediction results, it determines the target trend prediction result corresponding to the target stock. The present application processes the stock data using an intelligent model (target model) to output the trend prediction result corresponding to the target stock, which can improve the accuracy of the prediction result.

[0087] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0088] The following are device embodiments of the present invention. For details not fully described therein, reference may be made to the corresponding method embodiments described above.

[0089] Please refer to Figure 9, which is a structural diagram of an electronic device provided in an embodiment of the present application. As shown in the figure, the electronic device includes a processor, a memory, a communication interface and one or more programs, wherein the above-mentioned one or more programs are stored in the above-mentioned memory and are configured to be executed by the above-mentioned processor. The above-mentioned program includes instructions for executing the method corresponding to Figure 1, which will not be repeated here.

[0090] Please refer to FIG10 , which shows a stock trend analysis device based on machine learning provided by an embodiment of the present application, which is applied to an electronic device. The device includes: a data acquisition module 1001, a model splitting module 1002, a trend prediction module 1003, and a target trend determination module 1004, wherein:

[0091] The data acquisition module 1001 is used to acquire stock data corresponding to the target model and the target stock, wherein the stock data is determined based on technical indicator data and morphological data of the target stock;

[0092] A model splitting module 1002 is used to split the target model into multiple sub-target models;

[0093] A trend prediction module 1003 is configured to determine a plurality of trend prediction results corresponding to the target stock based on the stock data and the plurality of sub-goal models, wherein the plurality of sub-goal models correspond one-to-one to the plurality of trend prediction results;

[0094] The target trend determination module 1004 is configured to determine a target trend prediction result corresponding to the target stock based on the multiple trend prediction results.

[0095] Optionally, the data acquisition module 1001 includes:

[0096] A first judgment submodule is used to judge whether a target file corresponding to the target model exists locally, and obtain a first judgment result;

[0097] The first decision submodule is configured to obtain the target model based on the first judgment result.

[0098] Optionally, the first decision submodule includes:

[0099] The first decision unit is configured to download and decompress the target file from the COS storage bucket to obtain the target model if the first judgment result is no.

[0100] Optionally, the first decision-making unit includes:

[0101] A first judging subunit is configured to, if the first judging result is yes, judge whether the target file is the latest version, and obtain a second result;

[0102] The first decision subunit is configured to obtain the target model from the target file if the second judgment result is yes.

[0103] Optionally, the first decision submodule includes:

[0104] The second decision unit is configured to download and decompress the target file from the COS storage bucket to obtain the target model if the second result is no.

[0105] Optionally, the data acquisition module 1001 includes:

[0106] A data acquisition submodule, for acquiring technical indicator data and morphological data of the target stock;

[0107] a data generation submodule, configured to determine label data and derived indicators corresponding to the target stock based on the indicator data and the morphological data;

[0108] The stock data determination submodule is used to use the indicator data, the morphological data, the label data and the derived indicator as the stock data.

[0109] Optionally, the trend prediction module 1003 includes:

[0110] A model processing submodule, configured to input the stock data into each of the plurality of sub-target models to obtain a trend prediction result corresponding to each sub-target model;

[0111] The trend prediction submodule is used to summarize the trend prediction results corresponding to each sub-target model to obtain the multiple trend prediction results.

[0112] Optionally, the target trend determination module 1004 includes:

[0113] The target trend determination submodule is used to perform statistical analysis on the multiple trend prediction results to obtain the target trend prediction result, wherein the target trend prediction result includes the rise and fall trend of the target stock within a preset time in the future, and the probability value corresponding to the rise and fall trend.

[0114] Optionally, before the data acquisition module 1001, the following steps are included:

[0115] A model acquisition module is used to obtain an initial model and training data, wherein the initial model is a random forest model;

[0116] The model training module is used to train the initial model using the training data to obtain the target model.

[0117] Optional, model acquisition module, including:

[0118] Data retrieval submodule, used to retrieve K-line data;

[0119] The indicator calculation submodule is used to calculate the initial indicator data and initial shape data through the K-line data;

[0120] A data cleaning submodule, configured to clean the initial indicator data and the initial morphological data to obtain target indicator data and target morphological data;

[0121] The training data acquisition submodule is used to determine the training data based on the target indicator data and the target morphology data.

[0122] Optional training data acquisition submodule, including:

[0123] a label data determining unit, configured to determine label data based on the target indicator data, the target form data, and a first preset threshold, wherein the label data represents a degree of overbought or oversold of the target indicator data and the target form data;

[0124] a derivative indicator determination unit, configured to couple the tag data with historical data to obtain a derivative indicator, wherein the historical data at least includes a historical opening price, a historical closing price, and a historical increase or decrease;

[0125] The training data acquisition unit is used to aggregate the target indicator data, the target morphology data, the label data and the derived indicators to obtain the training data.

[0126] Optional model training module, including:

[0127] A data input submodule, configured to input the training data into the random forest model and optimize the hyperparameters of the random forest model using a grid search;

[0128] The target model determination submodule is used to obtain the target model when the hyperparameter reaches a second preset threshold.

[0129] It can be seen that the machine learning-based stock trend analysis device described in the embodiment of the present application is applied to an electronic device, obtains a target model and stock data corresponding to a target stock, splits the target model to obtain multiple sub-target models, determines multiple trend prediction results corresponding to the target stock based on the stock data and the multiple sub-target models, and determines a target trend prediction result corresponding to the target stock based on the multiple trend prediction results. By processing the stock data with an intelligent model (target model) to output a trend prediction result corresponding to the target stock, the accuracy of the prediction result can be improved.

[0130] It can be understood that the functions of each program module of the machine learning-based stock trend analysis device of this embodiment can be specifically implemented according to the method in the above method embodiment. The specific implementation process can refer to the relevant description of the above method embodiment, which will not be repeated here.

[0131] An embodiment of the present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute some or all of the steps described for the electronic device in the above method embodiment.

[0132] The present application also provides a computer program product, including a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to execute some or all of the steps described for the electronic device in the above method. The computer program product may be a software installation package.

[0133] The steps of the method or algorithm described in the embodiments of the present application can be implemented in hardware or by executing software instructions by a processor. The software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, read-only compact disks (CD-ROMs), or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in an access network device, a target network device, or a core network device. Of course, the processor and the storage medium can also exist as discrete components in an access network device, a target network device, or a core network device.

[0134] Those skilled in the art will appreciate that, in one or more of the above examples, the functions described in the embodiments of the present application can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).

[0135] The specific implementation methods described above further illustrate the purpose, technical solutions and beneficial effects of the embodiments of the present application. It should be understood that the above description is only a specific implementation method of the embodiments of the present application and is not intended to limit the scope of protection of the embodiments of the present application. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solutions of the embodiments of the present application should be included in the scope of protection of the embodiments of the present application.

Claims

1. A stock trend analysis method based on machine learning, characterized in that: Applicable to electronic devices, the method includes: Obtaining stock data corresponding to a target model and a target stock, wherein the stock data is determined based on technical indicator data and morphological data of the target stock; Splitting the target model to obtain multiple sub-target models; Determining a plurality of trend prediction results corresponding to the target stock based on the stock data and the plurality of sub-goal models, wherein the plurality of sub-goal models correspond one-to-one to the plurality of trend prediction results; Based on the multiple trend prediction results, a target trend prediction result corresponding to the target stock is determined.

2. The method according to claim 1, characterized in that The acquiring of the target model includes: Determine whether a target file corresponding to the target model exists locally, and obtain a first determination result; Based on the first judgment result, the target model is obtained.

3. The method according to claim 2, characterized in that The acquiring the target model based on the first judgment result includes: If the first judgment result is no, download and decompress the target file from the object storage bucket to obtain the target model.

4. The method according to claim 2, characterized in that The acquiring the target model based on the first judgment result includes: If the first judgment result is yes, determine whether the target file is the latest version to obtain a second result; If the second judgment result is yes, the target model is obtained from the target file.

5. The method according to claim 4, characterized in that The acquiring the target model based on the first judgment result includes: If the second result is no, download and decompress the target file from the object storage bucket to obtain the target model.

6. The method according to claim 1, wherein The obtaining of stock data corresponding to the target stock includes: Obtain technical indicator data and pattern data of the target stock; Determining label data and derived indicators corresponding to the target stock based on the indicator data and the morphological data; The indicator data, the morphological data, the label data and the derived indicator are used as the stock data.

7. The method according to claim 1, characterized in that The determining, based on the stock data and the multiple sub-target models, multiple trend prediction results corresponding to the target stock includes: Inputting the stock data into each of the multiple sub-target models to obtain a trend prediction result corresponding to each sub-target model; The trend prediction results corresponding to each sub-goal model are aggregated to obtain the multiple trend prediction results.

8. The method according to claim 1, characterized in that Determining a target trend prediction result corresponding to the target stock based on the multiple trend prediction results includes: Statistical analysis is performed on the multiple trend prediction results to obtain the target trend prediction result, wherein the target trend prediction result includes the rising and falling trends of the target stock within a preset time in the future, and the probability values ​​corresponding to the rising and falling trends.

9. The method according to any one of claims 1 to 8, characterized in that Before obtaining the target model and the stock data corresponding to the target stock, the method further includes: Obtaining an initial model and training data, wherein the initial model is a random forest model; The initial model is trained using the training data to obtain the target model.

10. The method according to claim 9, characterized in that The obtaining of training data includes: Retrieve K-line data; Calculate initial indicator data and initial shape data through the K-line data; Cleaning the initial indicator data and the initial morphological data to obtain target indicator data and target morphological data; The training data is determined based on the target indicator data and the target morphology data.

11. The method according to claim 10, characterized in that The determining of the training data based on the target indicator data and the target morphology data includes: Determining label data based on the target indicator data, the target form data, and a first preset threshold, wherein the label data represents the degree to which the target indicator data and the target form data are overbought or oversold; The tag data and historical data are coupled to obtain a derived indicator, wherein the historical data at least includes a historical opening price, a historical closing price, and a historical increase or decrease; The target indicator data, the target morphology data, the label data and the derived indicators are aggregated to obtain the training data.

12. The method according to claim 11, characterized in that The step of training the initial model using the training data to obtain the target model includes: Inputting the training data into the random forest model, and optimizing the hyperparameters in the random forest model using grid search; When the hyperparameter reaches a second preset threshold, the target model is obtained.

13. A stock trend analysis device based on machine learning, characterized in that: The device comprises: A data acquisition module, configured to acquire stock data corresponding to a target model and a target stock, wherein the stock data is determined based on technical indicator data and morphological data of the target stock; A model splitting module is used to split the target model into multiple sub-target models; a trend prediction module, configured to determine a plurality of trend prediction results corresponding to the target stock based on the stock data and the plurality of sub-goal models, wherein the plurality of sub-goal models correspond one-to-one to the plurality of trend prediction results; The target trend determination module is used to determine the target trend prediction result corresponding to the target stock based on the multiple trend prediction results.

14. An electronic device, characterized in that: The method comprises a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the steps in the method according to any one of claims 1 to 12.

15. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 12.