WO2019205384A1 - Electronic device, machine learning-based stock trade timing method and storage medium - Google Patents

Electronic device, machine learning-based stock trade timing method and storage medium Download PDF

Info

Publication number
WO2019205384A1
WO2019205384A1 PCT/CN2018/102224 CN2018102224W WO2019205384A1 WO 2019205384 A1 WO2019205384 A1 WO 2019205384A1 CN 2018102224 W CN2018102224 W CN 2018102224W WO 2019205384 A1 WO2019205384 A1 WO 2019205384A1
Authority
WO
WIPO (PCT)
Prior art keywords
trend
trading day
objects
trading
factor value
Prior art date
Application number
PCT/CN2018/102224
Other languages
French (fr)
Chinese (zh)
Inventor
李正洋
周璟
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019205384A1 publication Critical patent/WO2019205384A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • G06F18/232Non-hierarchical techniques
    • G06F18/2321Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
    • G06F18/23213Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Definitions

  • the present application relates to the field of financial market analysis, and in particular, to an electronic device, a machine learning-based stock timing method, and a storage medium.
  • timing trading refers to using some method to judge the investment target, such as stocks, futures, foreign exchange, etc., within a predetermined period of time, and according to the trend A means of trading that determines the point of sale.
  • the analysis of stock timing trading requires professionals to study the corresponding trend timing indicators, such as stock trend timing indicators including MA (double moving average), DMA (average line difference), TRIX (triple index smooth movement).
  • MA double moving average
  • DMA average line difference
  • TRIX triple index smooth movement
  • the present application proposes an electronic device, a machine learning-based stock timing method and a storage medium, which can improve the efficiency and accuracy of stock timing transaction analysis.
  • the present application provides an electronic device including a memory and a processor coupled to the memory, the processor for executing a machine learning based stock timing program stored on the memory, The machine learning-based stock timing program is executed by the processor to implement the following steps:
  • the preset type index factors of each acquired trading day are respectively analyzed according to the timing analysis strategy model completed by the pre-training, so as to output the trend factor values corresponding to each trading day;
  • A30 Perform cluster analysis on the trend factor values corresponding to each trading day according to a predetermined clustering algorithm to obtain a trend category corresponding to the trend factor value of each trading day;
  • A40 Determine a timing trading strategy according to the trend category corresponding to the obtained trend factor value of each trading day.
  • the present application also proposes a machine learning-based stock timing method, the method comprising the following steps:
  • S400 Determine a timing trading strategy according to the trend category corresponding to the obtained trend factor value of each trading day.
  • the present application further provides a computer readable storage medium storing a machine learning based stock timing program, the machine learning based stock timing program being executable by at least one processor, Taking the at least one processor to perform the following steps:
  • the preset type index factors of each acquired trading day are respectively analyzed to output the trend factor values corresponding to each trading day;
  • the timing trading strategy is determined according to the trend category corresponding to the trend factor value of each trading day obtained.
  • the electronic device, the machine learning-based stock timing method and the storage medium proposed by the present application firstly obtain a preset corresponding to each trading day of the predetermined stock market index within a preset time period.
  • Type indicator factor then, according to the pre-trained timing analysis model, the preset type index factors of each transaction day are analyzed to output the trend factor values corresponding to each trading day; and then according to a predetermined clustering algorithm
  • the trend factor values corresponding to each trading day are clustered to obtain the trend category corresponding to the trend factor value of each trading day; finally, the timing trading strategy is determined according to the trend category corresponding to the trend factor value of each trading day.
  • FIG. 1 is a schematic diagram of an optional hardware architecture of an electronic device proposed by the present application.
  • FIG. 2 is a schematic diagram of a stock timing program module based on machine learning in an embodiment of an electronic device of the present application
  • FIG. 3 is a flow chart of an implementation of a preferred embodiment of a machine learning based stock timing method of the present application.
  • the electronic device 10 may include, but is not limited to, a memory 11, a processor 12, and a network interface 13 communicably connected to each other through a communication bus 14. It should be noted that FIG. 1 only shows the electronic device 10 having the components 11-14, but it should be understood that not all illustrated components may be implemented, and more or fewer components may be implemented instead.
  • the memory 11 includes at least one type of computer readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (for example, SD or DX memory, etc.), a random access memory (RAM), and a static memory.
  • the memory 11 may be an internal storage unit of the electronic device 10, such as a hard disk or memory of the electronic device 10.
  • the memory 11 may also be an outsourced storage device of the electronic device 10, such as a plug-in hard disk equipped on the electronic device 10, a smart memory card (SMC), and a secure digital (Secure Digital, SD) ) cards, flash cards, etc.
  • the memory 11 can also include both an internal storage unit of the electronic device 10 and an external storage device thereof.
  • the memory 11 is generally used to store an operating system installed on the electronic device 10 and various types of application software, such as a stock learning time-based program based on machine learning. Further, the memory 11 can also be used to temporarily store various types of data that have been output or are to be output.
  • Processor 12 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments.
  • the processor 12 is typically used to control the overall operation of the electronic device 10.
  • the processor 12 is configured to run program code or processing data stored in the memory 11, such as a running machine learning based stock timing program.
  • Network interface 13 may include a wireless network interface or a wired network interface, which is typically used to establish a communication connection between electronic device 10 and other electronic devices.
  • Communication bus 14 is used to implement a communication connection between components 11-13.
  • Figure 1 shows only the electronic device 10 with components 11-14 and a machine learning based stock timing program, but it should be understood that not all illustrated components may be implemented, alternative implementations may be more or less s component.
  • the electronic device 10 may further include a user interface (not shown in FIG. 1), and the user interface may include a display, an input unit such as a keyboard, wherein the user interface may further include a standard wired interface, a wireless interface, and the like.
  • the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED touch device, or the like. Further, the display may also be referred to as a display screen or display unit for displaying information processed in the electronic device 10 and a user interface for displaying visualizations.
  • the pre-determined stock market index refers to stock market reference data that has strong liquidity, large scale, can represent the stock price comprehensive change, and can provide investors with an authoritative investment direction, such as SSE 50, Shanghai and Shenzhen. 300, or commonly used reference data such as CSI 500.
  • SSE 50 corresponds to 50 large-cap stocks in Shanghai stock market
  • CSI 300 corresponds to 300 blue-chip stocks outside the market value of 30 cities, of which only a few are coincident with SSE 50, such as Pufa, Unicom, etc.
  • 500 corresponds to 500 stocks with moderate market capitalization in the two cities, many of which coincide with the Shanghai and Shenzhen 300.
  • the preset type index factor is a macro indicator that affects a predetermined stock market index.
  • the debt yield of China Bond is 10 years - the 10-year period of China Bond National Debt can be seen from the general trend.
  • AAA China Bond
  • the market will also start to rise and the small market will go down.
  • the indicator goes down and the small market goes up. From the chart, the spread of the spread has recently declined, indicating that the market is starting to decline and the small-cap style is dominant.
  • the risk premium and the dividend yield are inversely related.
  • the stock market's yield is higher than the bond market, the funds will flow from the bond market to the stock market.
  • the stock index yield is lower than the bond market, the funds will flow from the stock market to the bond market.
  • MACD Histogram When the MACD Histogram turns from negative to positive, the multi-signal appears, the MACD changes from positive to negative, and the short signal appears;
  • RSRS indicator when zscore>0.7 and the closing price of MA(20) on the same day > the closing price of MA(20) in the past three days, buy signal; when zscore ⁇ -0.7 and the closing price of MA(20) on the same day ⁇ the past three days MA (20) When the closing price is sold, the signal is sold.
  • the Shanghai and Shenzhen 300 actively buy the amount, the premium rate is >0, the market is optimistic; the premium rate is ⁇ 0, the market is pessimistic; historically, the premium rate hits 5 o'clock, it is a sell signal; when the premium rate hits -1, it is a buy signal.
  • the preset time period may be classified into ultra short-term, short-term, medium-term, long-term, and ultra-long-term, etc., for example, in this embodiment, the predefined ultra-short-term included transaction
  • the number of days is less than or equal to 5, and the number of trading days included in the short-term is greater than 5 and less than or equal to 10.
  • the number of trading days included in the medium-term is greater than 10 and less than or equal to 15, and the number of trading days included in the long-term is greater than 15 days and less than one year.
  • the number of trading days included in the long term is greater than one year.
  • time series data in ultra-short-term and short-term time periods have a good fitting effect, but contain less information and can be used for ultra-short-line timing reference; the data of medium- and long-term time series contains There is more information, but the dependence of data between time series is not obvious in the short term, so the fitting effect is not super short-term and short-term, so the macroeconomic situation and economic trend are usually described by ultra-long-term data, and combined with medium and long-term data, Long-term timing reference.
  • the preset type index factors of each acquired trading day are respectively analyzed according to the timing analysis strategy model completed by the pre-training, so as to output the trend factor values corresponding to each trading day;
  • the pre-trained timing strategy model adopts the idea of machine learning, and uses a preset type index factor of each trading day in a preset time period as an input of a machine learning model, and outputs corresponding to each trading day through machine learning prediction.
  • Trend factor value a preset type index factor of each trading day in a preset time period as an input of a machine learning model.
  • the pre-trained completion timing strategy model is a cyclic neural network (RNN), and the cyclic neural network is used as a machine learning algorithm.
  • the cyclic neural network includes an input layer, a hidden layer (state learning layer), and an output layer; in this embodiment, the output layer is configured to output a relative profit rate within a preset time period, specifically, a relative profit rate
  • the rate of return associated with the total return of the stock market over a predetermined period of time in this embodiment, the relative rate of return is used to train the inverse update gradient of the machine learning model, and the different factors corresponding to each trading day of the hidden layer output The value is the trend factor value corresponding to each trading day output by the timing strategy model.
  • the hidden layer of the cyclic neural network includes multiple nodes, and the interconnection between the nodes acts as a key layer of the entire machine learning model.
  • the characteristics of the input layer input pass through the hidden layer training learning transformation and reach the output layer.
  • the hidden layer which contains multiple layers of neurons, it can be regarded as a neural network transmitted in time. Its depth is the length of time. Usually, as the depth deepens, the phenomenon of “gradient disappearance” will appear. At time t, the gradient it produces disappears after several layers of history on the time axis.
  • the neural network of the layer performs training learning corresponding to the preset type indicators of each trading day input by the input layer, and obtains the factor values corresponding to each trading day, and outputs the respective factor values at the corresponding nodes.
  • the timing strategy model used in this scheme is not used for the prediction of the rate of return, and is closer to a generation model in thought.
  • the output of the timing strategy model involved in this scenario is a classification of hidden layer values corresponding to each trading day, which is equivalent to generating a label for each trading day.
  • A30 Perform cluster analysis on the trend factor values corresponding to each trading day according to a predetermined clustering algorithm to obtain a trend category corresponding to the trend factor value of each trading day;
  • the predetermined clustering algorithm is a k-means clustering algorithm
  • the k-means clustering algorithm is one of the more classical clustering algorithms in the partitioning method. Because of its high efficiency, the algorithm is widely used in clustering large-scale data. At present, many algorithms are extended and improved around the algorithm.
  • the k-means algorithm uses k as a parameter to divide n objects into k clusters, so that the clusters have higher similarity and the similarity between clusters is lower.
  • the processing of the k-means algorithm is as follows: First, assuming that there are n trading days, the trend factor values corresponding to k transaction days are randomly selected as objects, where n>k, and n,k are Is a positive integer; each object initially represents the average or center of a cluster; for each of the remaining objects, it is assigned to the nearest cluster based on its distance from the center of each cluster; then each cluster is recalculated average value. This process is repeated until the criterion function converges.
  • the criterion function uses a squared error criterion, which is defined as follows:
  • E is the sum of the squared errors of all objects consisting of the trend factor values corresponding to n trading days
  • p is the point in the space that needs to be clustered.
  • mi is the average of the cluster Ci.
  • the objective function makes the generated cluster as compact and independent as possible, and the distance metric used is the Euclidean distance, although other distance metrics can be used.
  • the algorithm flow of the k-means clustering algorithm is as follows: input the database containing n objects and the number k of clusters.
  • the trend factor values corresponding to n transaction days are taken as the above n objects, and the preset k The class trend category is used as the number of clusters; k clusters are output to minimize the square error criterion.
  • the method specifically includes: selecting a trend factor value of k transaction days as an initial cluster center; assigning each object (re) to the most similar cluster according to the average value of the objects in the cluster; updating the average of the clusters The value, which is the average of the objects in each cluster; until the calculation no longer changes, the cluster ends.
  • the common trend categories can be visually represented in different K-line patterns.
  • the common K-line form has a "V" shape, a reverse cross type, a "W” type, a low position five-yang line, and an arc bottom type.
  • the rise of the bow line in the middle of the rise, the jump of the sword line in the middle of the rise, the jump line of the jump, and so on, and the trend factor value corresponds to one of the various K-line forms.
  • A40 Determine a timing trading strategy according to the trend category corresponding to the obtained trend factor value of each trading day.
  • the trend factor values corresponding to each trading day in a year are clustered and analyzed, and k types corresponding to the trend factor values of each trading day are obtained.
  • the position points corresponding to the corresponding K-line patterns are respectively analyzed on each trading day, and the subsequent K-line variation pattern of the corresponding position points is further determined, specifically, in the historical time period (in this embodiment, the hypothesis analysis period is 1) Years)
  • the hypothesis analysis period is 1) Years
  • There are market trend categories similar to the K-line pattern For example, statistical analysis of the trend pattern of the Shanghai and Shenzhen 300 in a week, assuming that the trend factor corresponding to each trading day in the week has a "w" in the trend category.
  • the electronic device proposed by the present application firstly obtains a preset type index factor corresponding to each trading day of a predetermined stock market index within a preset time period; and then performs a timing strategy based on pre-training.
  • the analysis model separately analyzes the preset type index factors of each acquired trading day to output the trend factor values corresponding to each trading day; and then clusters the trend factor values corresponding to each trading day according to a predetermined clustering algorithm.
  • the timing trading strategy is determined according to the trend category corresponding to the trend factor value of each trading day obtained.
  • the machine learning-based stock timing program of the present application may be described by a program module having the same function according to different functions implemented by the respective parts.
  • FIG. 2 is a schematic diagram of a program module of a machine-based stock timing program according to an embodiment of the electronic device of the present application.
  • the machine timing program based on machine learning may be divided into an obtaining module 201, an analyzing module 202, a clustering module 203, and a determining module 204 according to different functions implemented by the respective parts.
  • the program module referred to in the present application refers to a series of computer program instruction segments capable of performing a specific function, and is more suitable than the program to describe the execution process of the machine learning-based stock timing program in the electronic device 10.
  • the functions or operational steps implemented by the modules 201-204 are similar to the above, and are not described in detail herein, by way of example, for example:
  • the obtaining module 201 is configured to obtain a preset type indicator factor corresponding to each trading day of the predetermined stock market index within a preset time period;
  • the analyzing module 202 is configured to analyze the preset type index factors of each acquired trading day according to the timing analysis strategy model completed by the pre-training, so as to output the trend factor values corresponding to each trading day;
  • the clustering module 203 is configured to perform cluster analysis on the trend factor values corresponding to each trading day according to a predetermined clustering algorithm, to obtain a trend category corresponding to the trend factor value of each trading day;
  • the determining module 204 is configured to determine a timing trading strategy according to the obtained trend category corresponding to the trend factor value of each trading day.
  • the present application also proposes a machine learning-based stock timing method.
  • the machine learning-based stock timing method includes the following steps:
  • the pre-determined stock market index refers to stock market reference data that has strong liquidity, large scale, can represent the stock price comprehensive change, and can provide investors with an authoritative investment direction, such as SSE 50, Shanghai and Shenzhen. 300, or commonly used reference data such as CSI 500.
  • SSE 50 corresponds to 50 large-cap stocks in Shanghai stock market
  • CSI 300 corresponds to 300 blue-chip stocks outside the market value of 30 cities, of which only a few are coincident with SSE 50, such as Pufa, Unicom, etc.
  • 500 corresponds to 500 stocks with moderate market capitalization in the two cities, many of which coincide with the Shanghai and Shenzhen 300.
  • the preset type index factor is a macro indicator that affects a predetermined stock market index.
  • the debt yield of China Bond is 10 years - the 10-year period of China Bond National Debt can be seen from the general trend.
  • AAA China Bond
  • the market will also start to rise and the small market will go down.
  • the indicator goes down and the small market goes up. From the chart, the spread of the spread has recently declined, indicating that the market is starting to decline and the small-cap style is dominant.
  • the risk premium and the dividend yield are inversely related.
  • the stock market's yield is higher than the bond market, the funds will flow from the bond market to the stock market.
  • the stock index yield is lower than the bond market, the funds will flow from the stock market to the bond market.
  • MACD Histogram When the MACD Histogram turns from negative to positive, the multi-signal appears, the MACD changes from positive to negative, and the short signal appears;
  • RSRS indicator when zscore>0.7 and the closing price of MA(20) on the same day > the closing price of MA(20) in the past three days, buy signal; when zscore ⁇ -0.7 and the closing price of MA(20) on the same day ⁇ the past three days MA (20) When the closing price is sold, the signal is sold.
  • the Shanghai and Shenzhen 300 actively buy the amount, the premium rate is >0, the market is optimistic; the premium rate is ⁇ 0, the market is pessimistic; historically, the premium rate hits 5 o'clock, it is a sell signal; when the premium rate hits -1, it is a buy signal.
  • the preset time period may be classified into ultra short-term, short-term, medium-term, long-term, and ultra-long-term, etc., for example, in this embodiment, the predefined ultra-short-term included transaction
  • the number of days is less than or equal to 5, and the number of trading days included in the short-term is greater than 5 and less than or equal to 10.
  • the number of trading days included in the medium-term is greater than 10 and less than or equal to 15, and the number of trading days included in the long-term is greater than 15 days and less than one year.
  • the number of trading days included in the long term is greater than one year.
  • time series data in ultra-short-term and short-term time periods have a good fitting effect, but contain less information and can be used for ultra-short-line timing reference; the data of medium- and long-term time series contains There is more information, but the dependence of data between time series is not obvious in the short term, so the fitting effect is not super short-term and short-term, so the macroeconomic situation and economic trend are usually described by ultra-long-term data, and combined with medium and long-term data, Long-term timing reference.
  • the pre-trained timing strategy model adopts the idea of machine learning, and uses a preset type index factor of each trading day in a preset time period as an input of a machine learning model, and outputs corresponding to each trading day through machine learning prediction.
  • Trend factor value a preset type index factor of each trading day in a preset time period as an input of a machine learning model.
  • the pre-trained completion timing strategy model is a cyclic neural network (RNN), and the cyclic neural network is used as a machine learning algorithm.
  • the cyclic neural network includes an input layer, a hidden layer (state learning layer), and an output layer; in this embodiment, the output layer is configured to output a relative profit rate within a preset time period, specifically, a relative profit rate
  • the rate of return associated with the total return of the stock market over a predetermined period of time in this embodiment, the relative rate of return is used to train the inverse update gradient of the machine learning model, and the different factors corresponding to each trading day of the hidden layer output The value is the trend factor value corresponding to each trading day output by the timing strategy model.
  • the hidden layer which contains multiple layers of neurons, it can be regarded as a neural network transmitted in time. Its depth is the length of time. Usually, as the depth deepens, the phenomenon of “gradient disappearance” will appear. At time t, the gradient it produces disappears after several layers of history on the time axis.
  • the neural network of the layer performs training learning corresponding to the preset type indicators of each trading day input by the input layer, and obtains the factor values corresponding to each trading day, and outputs the respective factor values at the corresponding nodes.
  • the timing strategy model used in this scheme is not used for the prediction of the rate of return, and is closer to a generation model in thought.
  • the output of the timing strategy model involved in this scenario is a classification of hidden layer values corresponding to each trading day, which is equivalent to generating a label for each trading day.
  • the predetermined clustering algorithm is a k-means clustering algorithm
  • the k-means clustering algorithm is one of the more classical clustering algorithms in the partitioning method. Because of its high efficiency, the algorithm is widely used in clustering large-scale data. At present, many algorithms are extended and improved around the algorithm.
  • the k-means algorithm uses k as a parameter to divide n objects into k clusters, so that the clusters have higher similarity and the similarity between clusters is lower.
  • the processing of the k-means algorithm is as follows: First, assuming that there are n trading days, the trend factor values corresponding to k transaction days are randomly selected as objects, where n>k, and n,k are Is a positive integer; each object initially represents the average or center of a cluster; for each of the remaining objects, it is assigned to the nearest cluster based on its distance from the center of each cluster; then each cluster is recalculated average value. This process is repeated until the criterion function converges.
  • the criterion function uses a squared error criterion, which is defined as follows:
  • E is the sum of the squared errors of all objects consisting of the trend factor values corresponding to n trading days
  • p is the point in space
  • mi is the average of the cluster Ci.
  • the objective function makes the generated cluster as compact and independent as possible, and the distance metric used is the Euclidean distance, although other distance metrics can be used.
  • the algorithm flow of the k-means clustering algorithm is as follows: input the database containing n objects and the number k of clusters.
  • the trend factor values corresponding to n transaction days are taken as the above n objects, and the preset k
  • the class trend category is used as the number of clusters; k clusters are output to minimize the square error criterion.
  • the method specifically includes: selecting a trend factor value of k transaction days as an initial cluster center; assigning each object (re) to the most similar cluster according to the average value of the objects in the cluster; updating the average of the clusters The value, which is the average of the objects in each cluster; until the calculation no longer changes, the cluster ends.
  • the common trend categories can be visually represented in different K-line patterns.
  • the common K-line form has a "V" shape, a reverse cross type, a "W” type, a low position five-yang line, and an arc bottom type.
  • the rise of the bow line in the middle of the rise, the jump of the sword line in the middle of the rise, the jump line of the jump, and so on, and the trend factor value corresponds to one of the various K-line forms.
  • S400 Determine a timing trading strategy according to the trend category corresponding to the obtained trend factor value of each trading day.
  • the trend factor values corresponding to each trading day in a year are clustered and analyzed, and k types corresponding to the trend factor values of each trading day are obtained.
  • the position points corresponding to the corresponding K-line patterns are respectively analyzed on each trading day, and the subsequent K-line variation pattern of the corresponding position points is further determined, specifically, in the historical time period (in this embodiment, the hypothesis analysis period is 1) Years)
  • the hypothesis analysis period is 1) Years
  • There are market trend categories similar to the K-line pattern For example, statistical analysis of the trend pattern of the Shanghai and Shenzhen 300 in a week, assuming that the trend factor corresponding to each trading day in the week has a "w" in the trend category.
  • the machine learning-based stock timing method proposed by the present application firstly obtains a preset type index factor corresponding to each trading day of a predetermined stock market index within a preset time period;
  • the training completion timing analysis model separately analyzes the preset type index factors of each transaction day to output the trend factor values corresponding to each trading day; and then according to the predetermined clustering algorithm, the corresponding trend of each trading day
  • the factor value is clustered to obtain the trend category corresponding to the trend factor value of each trading day; finally, the timing trading strategy is determined according to the trend category corresponding to the trend factor value of each trading day.
  • the present application further provides a computer readable storage medium on which a machine learning based stock timing program is stored, and the machine learning based stock timing program is executed by a processor as follows: operating:
  • the preset type index factors of each acquired trading day are respectively analyzed to output the trend factor values corresponding to each trading day;
  • the timing trading strategy is determined according to the trend category corresponding to the trend factor value of each trading day obtained.
  • the specific embodiment of the computer readable storage medium of the present application is substantially the same as the above embodiments of the electronic device and the machine learning based stock method, and will not be described herein.
  • the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is better.
  • Implementation Based on such understanding, the technical solution of the present application, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Finance (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Accounting & Taxation (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Health & Medical Sciences (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Evolutionary Biology (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

Disclosed by the present application are an electronic device, a machine learning-based stock trade timing method and a storage medium, the method comprising: first, acquiring a preset type of index factor corresponding to a predetermined stock market index on each trading day within a preset time period; next, analyzing the acquired preset type of index factor of each trading day respectively according to a completely pre-trained timing strategy analysis model so as to output a trend factor value corresponding to each trading day; then, performing clustering analysis on the trend factor value corresponding to each trading day according to a predetermined clustering algorithm so as to obtain a trend type corresponding to the trend factor value for each trading day; and finally, according to the obtained trend type corresponding to the trend factor value of each trading day, determining a trade timing strategy. Thus, the efficiency and accuracy of stock trade timing are improved.

Description

电子装置、基于机器学习的股票择时方法及存储介质Electronic device, machine learning-based stock timing method and storage medium
本申请要求于2018年4月26日提交中国专利局、申请号为2018103871394,发明名称为“电子装置、基于机器学习的股票择时方法及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese Patent Application entitled "Electronic Device, Machine Learning-Based Stock Timing Method and Storage Medium" submitted by the Chinese Patent Office on April 26, 2018, with the application number 2018103871394. This is incorporated herein by reference.
技术领域Technical field
本申请涉及金融市场分析领域,尤其涉及一种电子装置、基于机器学习的股票择时方法及存储介质。The present application relates to the field of financial market analysis, and in particular, to an electronic device, a machine learning-based stock timing method, and a storage medium.
背景技术Background technique
随着金融市场以及金融理论的不断完善及发展,股票量化投资成为很多金融机构用来吸引股票投资者的有利因素。目前,对股票量化投资的研究主要以择时交易为主,择时交易是指利用某种方法来判断投资标的,如股票、期货、外汇等在预先确定的时间段内的走势,并根据走势确定买卖时间点的一种交易手段。而通常对股票择时交易的分析需要专业人员研究对应的趋势性择时指标,如股票的趋势性择时指标包括MA(双均线)、DMA(平均线差)、TRIX(三重指数平滑移动)等的变化,并根据择时指标的变化确定买卖交易的时间点,存在效率低下,且准确率不高的问题。With the continuous improvement and development of financial markets and financial theory, stock quantitative investment has become a favorable factor for many financial institutions to attract stock investors. At present, the research on stock quantitative investment is mainly based on timing trading. The timing trading refers to using some method to judge the investment target, such as stocks, futures, foreign exchange, etc., within a predetermined period of time, and according to the trend A means of trading that determines the point of sale. Usually, the analysis of stock timing trading requires professionals to study the corresponding trend timing indicators, such as stock trend timing indicators including MA (double moving average), DMA (average line difference), TRIX (triple index smooth movement). Such changes, and the timing of buying and selling transactions based on changes in timing indicators, there are problems of inefficiency and low accuracy.
发明内容Summary of the invention
有鉴于此,本申请提出一种电子装置、基于机器学习的股票择时方法及存储介质,能够提高股票择时交易分析的效率及准确性。In view of this, the present application proposes an electronic device, a machine learning-based stock timing method and a storage medium, which can improve the efficiency and accuracy of stock timing transaction analysis.
首先,本申请提出一种电子装置,所述电子装置包括存储器、及与所述存储器连接的处理器,所述处理器用于执行所述存储器上存储的基于机器学习的股票择时程序,所述基于机器学习的股票择时程序被所述处理器执行时实现如下步骤:First, the present application provides an electronic device including a memory and a processor coupled to the memory, the processor for executing a machine learning based stock timing program stored on the memory, The machine learning-based stock timing program is executed by the processor to implement the following steps:
A10、获取预先确定的股票市场指数在预设时间段内的各交易日对应的预 设类型指标因子;A10. Obtain a preset type indicator factor corresponding to each trading day of the predetermined stock market index within a preset time period;
A20、根据预先训练完成的择时策略分析模型分别对获取的各交易日的预设类型指标因子进行分析,以输出各交易日对应的走势因子值;A20. The preset type index factors of each acquired trading day are respectively analyzed according to the timing analysis strategy model completed by the pre-training, so as to output the trend factor values corresponding to each trading day;
A30、根据预先确定的聚类算法对各交易日对应的走势因子值进行聚类分析,以得到各交易日的走势因子值对应的走势类别;A30. Perform cluster analysis on the trend factor values corresponding to each trading day according to a predetermined clustering algorithm to obtain a trend category corresponding to the trend factor value of each trading day;
A40、根据得到的各交易日的走势因子值对应的走势类别,确定择时交易策略。A40. Determine a timing trading strategy according to the trend category corresponding to the obtained trend factor value of each trading day.
此外,本申请还提出一种基于机器学习的股票择时方法,所述方法包括如下步骤:In addition, the present application also proposes a machine learning-based stock timing method, the method comprising the following steps:
S100、获取预先确定的股票市场指数在预设时间段内的各交易日对应的预设类型指标因子;S100. Obtain a preset type indicator factor corresponding to each trading day of the predetermined stock market index within a preset time period;
S200、根据预先训练完成的择时策略分析模型分别对获取的各交易日的预设类型指标因子进行分析,以输出各交易日对应的走势因子值;S200: analyzing, according to the timing analysis strategy model completed by the pre-training, respectively, the preset type index factors of each acquired trading day are analyzed, so as to output the trend factor values corresponding to each trading day;
S300、根据预先确定的聚类算法对各交易日对应的走势因子值进行聚类分析,以得到各交易日的走势因子值对应的走势类别;S300, performing cluster analysis on the trend factor values corresponding to each trading day according to a predetermined clustering algorithm, to obtain a trend category corresponding to the trend factor value of each trading day;
S400、根据得到的各交易日的走势因子值对应的走势类别,确定择时交易策略。S400: Determine a timing trading strategy according to the trend category corresponding to the obtained trend factor value of each trading day.
此外,本申请还提出一种计算机可读存储介质,所述计算机可读存储介质存储有基于机器学习的股票择时程序,所述基于机器学习的股票择时程序可被至少一个处理器执行,以使所述至少一个处理器执行如下步骤:Furthermore, the present application further provides a computer readable storage medium storing a machine learning based stock timing program, the machine learning based stock timing program being executable by at least one processor, Taking the at least one processor to perform the following steps:
获取预先确定的股票市场指数在预设时间段内的各交易日对应的预设类型指标因子;Obtaining a preset type index factor corresponding to each trading day of the predetermined stock market index within a preset time period;
根据预先训练完成的择时策略分析模型分别对获取的各交易日的预设类型指标因子进行分析,以输出各交易日对应的走势因子值;According to the timing analysis strategy model completed by the pre-training, the preset type index factors of each acquired trading day are respectively analyzed to output the trend factor values corresponding to each trading day;
根据预先确定的聚类算法对各交易日对应的走势因子值进行聚类分析,以得到各交易日的走势因子值对应的走势类别;Perform cluster analysis on the trend factor values corresponding to each trading day according to a predetermined clustering algorithm to obtain a trend category corresponding to the trend factor value of each trading day;
根据得到的各交易日的走势因子值对应的走势类别,确定择时交易策略。The timing trading strategy is determined according to the trend category corresponding to the trend factor value of each trading day obtained.
相较于现有技术,本申请所提出的电子装置、基于机器学习的股票择时方法及存储介质,首先通过获取预先确定的股票市场指数在预设时间段内的各交易日对应的预设类型指标因子;然后根据预先训练完成的择时策略分析模型分别对获取的各交易日的预设类型指标因子进行分析,以输出各交易日对应的走势因子值;再根据预先确定的聚类算法对各交易日对应的走势因子值进行聚类分析,以得到各交易日的走势因子值对应的走势类别;最后根据得到的各交易日的走势因子值对应的走势类别,确定择时交易策略。提高了股票择时交易分析的效率及准确性。Compared with the prior art, the electronic device, the machine learning-based stock timing method and the storage medium proposed by the present application firstly obtain a preset corresponding to each trading day of the predetermined stock market index within a preset time period. Type indicator factor; then, according to the pre-trained timing analysis model, the preset type index factors of each transaction day are analyzed to output the trend factor values corresponding to each trading day; and then according to a predetermined clustering algorithm The trend factor values corresponding to each trading day are clustered to obtain the trend category corresponding to the trend factor value of each trading day; finally, the timing trading strategy is determined according to the trend category corresponding to the trend factor value of each trading day. Improve the efficiency and accuracy of stock timing trading analysis.
附图说明DRAWINGS
图1是本申请提出的电子装置一可选的硬件架构的示意图;1 is a schematic diagram of an optional hardware architecture of an electronic device proposed by the present application;
图2是本申请电子装置一实施例中基于机器学习的股票择时程序模块示意图;2 is a schematic diagram of a stock timing program module based on machine learning in an embodiment of an electronic device of the present application;
图3是本申请基于机器学习的股票择时方法较佳实施例的实施流程图。3 is a flow chart of an implementation of a preferred embodiment of a machine learning based stock timing method of the present application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The implementation, functional features and advantages of the present application will be further described with reference to the accompanying drawings.
具体实施方式detailed description
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the objects, technical solutions, and advantages of the present application more comprehensible, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without departing from the inventive scope are the scope of the present application.
需要说明的是,在本申请中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领 域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。It should be noted that the descriptions of "first", "second" and the like in the present application are for the purpose of description only, and are not to be construed as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. . Thus, features defining "first" or "second" may include at least one of the features, either explicitly or implicitly. In addition, the technical solutions between the various embodiments may be combined with each other, but must be based on the realization of those skilled in the art, and when the combination of the technical solutions is contradictory or impossible to implement, it should be considered that the combination of the technical solutions does not exist. Nor is it within the scope of protection required by this application.
参阅图1所示,是本申请提出的电子装置一可选的硬件架构示意图。本实施例中,电子装置10可包括,但不仅限于,可通过通信总线14相互通信连接的存储器11、处理器12、网络接口13。需要指出的是,图1仅示出了具有组件11-14的电子装置10,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。Referring to FIG. 1 , it is an optional hardware architecture diagram of the electronic device proposed by the present application. In this embodiment, the electronic device 10 may include, but is not limited to, a memory 11, a processor 12, and a network interface 13 communicably connected to each other through a communication bus 14. It should be noted that FIG. 1 only shows the electronic device 10 having the components 11-14, but it should be understood that not all illustrated components may be implemented, and more or fewer components may be implemented instead.
其中,存储器11至少包括一种类型的计算机可读存储介质,计算机可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,存储器11可以是电子装置10的内部存储单元,例如电子装置10的硬盘或内存。在另一些实施例中,存储器11也可以是电子装置10的外包存储设备,例如电子装置10上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,存储器11还可以既包括电子装置10的内部存储单元也包括其外部存储设备。本实施例中,存储器11通常用于存储安装于电子装置10的操作系统和各类应用软件,例如基于机器学习的股票择时程序等。此外,存储器11还可以用于暂时地存储已经输出或者将要输出的各类数据。The memory 11 includes at least one type of computer readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (for example, SD or DX memory, etc.), a random access memory (RAM), and a static memory. Random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disk, optical disk, and the like. In some embodiments, the memory 11 may be an internal storage unit of the electronic device 10, such as a hard disk or memory of the electronic device 10. In other embodiments, the memory 11 may also be an outsourced storage device of the electronic device 10, such as a plug-in hard disk equipped on the electronic device 10, a smart memory card (SMC), and a secure digital (Secure Digital, SD) ) cards, flash cards, etc. Of course, the memory 11 can also include both an internal storage unit of the electronic device 10 and an external storage device thereof. In this embodiment, the memory 11 is generally used to store an operating system installed on the electronic device 10 and various types of application software, such as a stock learning time-based program based on machine learning. Further, the memory 11 can also be used to temporarily store various types of data that have been output or are to be output.
处理器12在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。处理器12通常用于控制电子装置10的总体操作。本实施例中,处理器12用于运行存储器11中存储的程序代码或者处理数据,例如运行的基于机器学习的股票择时程序等。 Processor 12 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 12 is typically used to control the overall operation of the electronic device 10. In this embodiment, the processor 12 is configured to run program code or processing data stored in the memory 11, such as a running machine learning based stock timing program.
网络接口13可包括无线网络接口或有线网络接口,网络接口13通常用 于在电子装置10与其他电子设备之间建立通信连接。 Network interface 13 may include a wireless network interface or a wired network interface, which is typically used to establish a communication connection between electronic device 10 and other electronic devices.
通信总线14用于实现组件11-13之间的通信连接。 Communication bus 14 is used to implement a communication connection between components 11-13.
图1仅示出了具有组件11-14以及基于机器学习的股票择时程序的电子装置10,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。Figure 1 shows only the electronic device 10 with components 11-14 and a machine learning based stock timing program, but it should be understood that not all illustrated components may be implemented, alternative implementations may be more or less s component.
可选地,电子装置10还可以包括用户接口(图1中未示出),用户接口可以包括显示器、输入单元比如键盘,其中,用户接口还可以包括标准的有线接口、无线接口等。Optionally, the electronic device 10 may further include a user interface (not shown in FIG. 1), and the user interface may include a display, an input unit such as a keyboard, wherein the user interface may further include a standard wired interface, a wireless interface, and the like.
可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED触摸器等。进一步地,显示器也可称为显示屏或显示单元,用于显示在电子装置10中处理信息以及用于显示可视化的用户界面。Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED touch device, or the like. Further, the display may also be referred to as a display screen or display unit for displaying information processed in the electronic device 10 and a user interface for displaying visualizations.
在一实施例中,存储器11中存储的基于机器学习的股票择时程序被处理器12执行时,实现如下操作:In an embodiment, when the machine learning based stock timing program stored in the memory 11 is executed by the processor 12, the following operations are implemented:
A10、获取预先确定的股票市场指数在预设时间段内的各交易日对应的预设类型指标因子;A10. Obtain a preset type indicator factor corresponding to each trading day of the predetermined stock market index in a preset time period;
具体地,预先确定的股票市场指数指的是具有流动性强、规模大、能够代表股票的股价综合变动,且能够为投资者提供权威的投资方向的股票市场参考数据,例如上证50、沪深300、或者中证500等的常用参考数据。其中,上证50对应的是沪市的50只大盘股,沪深300对应的是两市市值30名以外的300只蓝筹股,其中只有极少部分与上证50重合,如浦发、联通等,中证500对应的是两市市值适中的500只个股,有许多与沪深300重合。具体地,预设类型指标因子为影响预先确定的股票市场指数的宏观指标,例如,在本实施例中,以沪深300为例,对应的预设类型指标因子包括,但不仅限于,中债国债到期收益率-中债企业债到期收益率、风险溢价、股息率、SlowD、MACD Histogram、Bollinger Bands、MA of RSI(14)[M=22]、4-period MA of4-week MA of modified OBV-(MA4*4)、CR指标、大小盘换手率比值、RSRS 指标、沪深300溢价率、沪深300主动买入额等13维指标。Specifically, the pre-determined stock market index refers to stock market reference data that has strong liquidity, large scale, can represent the stock price comprehensive change, and can provide investors with an authoritative investment direction, such as SSE 50, Shanghai and Shenzhen. 300, or commonly used reference data such as CSI 500. Among them, SSE 50 corresponds to 50 large-cap stocks in Shanghai stock market, and CSI 300 corresponds to 300 blue-chip stocks outside the market value of 30 cities, of which only a few are coincident with SSE 50, such as Pufa, Unicom, etc. 500 corresponds to 500 stocks with moderate market capitalization in the two cities, many of which coincide with the Shanghai and Shenzhen 300. Specifically, the preset type index factor is a macro indicator that affects a predetermined stock market index. For example, in the embodiment, taking the CSI 300 as an example, the corresponding preset type index factors include, but are not limited to, the medium debt. Treasury yield to maturity - China Bond Corporate Bond Yield to maturity, risk premium, dividend yield, SlowD, MACD Histogram, Bollinger Bands, MA of RSI (14) [M=22], 4-period MA of 4-week MA of Modified OBV-(MA4*4), CR indicator, ratio of size and turnover, RSRS indicator, CSI 300 premium rate, and CSI 300 active purchase amount and other 13-dimensional indicators.
其中,中债企业债到期收益率(AAA)10年-中债国债10年期,可以从大致趋势上来看当利差上升阶段,大盘也开始上行,小盘下行。反之当利差下降时指标大盘下行,小盘上行。从图上来看利差近期出现下降拐点,预示大盘开始下行,小盘风格占优。Among them, the debt yield of China Bond (AAA) is 10 years - the 10-year period of China Bond National Debt can be seen from the general trend. When the spread is rising, the market will also start to rise and the small market will go down. Conversely, when the spread falls, the indicator goes down and the small market goes up. From the chart, the spread of the spread has recently declined, indicating that the market is starting to decline and the small-cap style is dominant.
风险溢价与股息率呈现反相关性,当股市的收益率高于债市时,资金将从债市流向股市;反之,当股指收益率低于债市时,资金将从股市流向债市。(平稳通道为average加减1std)The risk premium and the dividend yield are inversely related. When the stock market's yield is higher than the bond market, the funds will flow from the bond market to the stock market. Conversely, when the stock index yield is lower than the bond market, the funds will flow from the stock market to the bond market. (Smooth channel is average plus or minus 1std)
股息率,沪深300股息率与沪深300收盘价呈负相关性。(平稳通道为average加减1std)The dividend yield, the CSI 300 dividend yield and the closing price of the CSI 300 were negatively correlated. (Smooth channel is average plus or minus 1std)
SlowD,当slowD<10超卖信号出现,做多指数;当slowD>10超卖信号消失,做空指数。SlowD, when slowD<10 oversold signal appears, do more index; when slowD>10 oversold signal disappears, short index.
MACD Histogram当MACD Histogram由负转正,做多信号出现,MACD由正转负,做空信号出现;MACD Histogram When the MACD Histogram turns from negative to positive, the multi-signal appears, the MACD changes from positive to negative, and the short signal appears;
Bollinger Bands,当股价<下轨线BN,买入信号出现。Bollinger Bands, when the stock price < lower trajectory BN, the buy signal appears.
MA of RSI(14)[M=22],当22-day MA of RSI(14)<40时,买入信号出现,投资期限为22个交易日。MA of RSI (14) [M = 22], when 22-day MA of RSI (14) < 40, the buy signal appears, the investment period is 22 trading days.
4-period MA of 4-week MA of modified OBV-(MA4*4),当股价走势和MA4*4一致时,买入信号出现,背离时,卖出信号出现。4-period MA of 4-week MA of modified OBV-(MA4*4), when the stock price trend is consistent with MA4*4, the buy signal appears, and when it deviates, the sell signal appears.
CR指标,CR<260,能量较低,加仓信号出现。CR indicator, CR <260, low energy, jiacang signal appears.
大小盘换手率比值Size change ratio
当换手率<=0.1,且振幅<=-10%,市场从小盘转为大盘风格;当换手率>=0.3,且振幅>=10%,市场从大盘转为小盘。When the turnover rate is <=0.1, and the amplitude is <=-10%, the market changes from small to large style; when the turnover rate is >=0.3, and the amplitude is >=10%, the market turns from the market to the small market.
RSRS指标,当zscore>0.7且当日MA(20)收盘价>过去三日MA(20)收盘价的时候,买入信号;当zscore<-0.7且当日MA(20)收盘价<过去三日MA(20)收盘价的时候,卖出信号RSRS indicator, when zscore>0.7 and the closing price of MA(20) on the same day > the closing price of MA(20) in the past three days, buy signal; when zscore<-0.7 and the closing price of MA(20) on the same day < the past three days MA (20) When the closing price is sold, the signal is sold.
沪深300溢价率,溢价率>0,市场乐观;溢价率<0,市场悲观;历史上, 溢价率触及5时,为卖出信号;溢价率触及-1时,为买入信号。The CSI 300 premium rate, premium rate >0, market optimism; premium rate <0, market pessimism; historically, the premium rate hits 5 o'clock, is a sell signal; when the premium rate hits -1, it is a buy signal.
沪深300主动买入额,溢价率>0,市场乐观;溢价率<0,市场悲观;历史上,溢价率触及5时,为卖出信号;溢价率触及-1时,为买入信号。The Shanghai and Shenzhen 300 actively buy the amount, the premium rate is >0, the market is optimistic; the premium rate is <0, the market is pessimistic; historically, the premium rate hits 5 o'clock, it is a sell signal; when the premium rate hits -1, it is a buy signal.
通常,根据预设时间段内包含的交易日数目不同,预设时间段可分为超短期,短期,中期,长期,以及超长期等,例如在本实施例中,预定义超短期包含的交易日数目小于等于5,短期包含的交易日数目大于5,且小于等于10,中期包含的交易日数目大于10,且小于等于15,长期包含的交易日数目大于15日,且小于一年,超长期包含的交易日数目大于一年等。一般而言,在实际应用中,超短期和短期时间段内的时间序列数据具有较好的拟合效果,但是包含的信息较少,可用于超短线择时参考;中长期时间序列的数据包含的信息较多,但是时序间数据的依赖关系没有短期明显,导致拟合效果没有超短期和短期好,所以通常通过超长期数据刻画宏观经济形势与经济走势,并结合中长期数据,用于中长线择时参考。Generally, according to the number of trading days included in the preset time period, the preset time period may be classified into ultra short-term, short-term, medium-term, long-term, and ultra-long-term, etc., for example, in this embodiment, the predefined ultra-short-term included transaction The number of days is less than or equal to 5, and the number of trading days included in the short-term is greater than 5 and less than or equal to 10. The number of trading days included in the medium-term is greater than 10 and less than or equal to 15, and the number of trading days included in the long-term is greater than 15 days and less than one year. The number of trading days included in the long term is greater than one year. In general, in practical applications, time series data in ultra-short-term and short-term time periods have a good fitting effect, but contain less information and can be used for ultra-short-line timing reference; the data of medium- and long-term time series contains There is more information, but the dependence of data between time series is not obvious in the short term, so the fitting effect is not super short-term and short-term, so the macroeconomic situation and economic trend are usually described by ultra-long-term data, and combined with medium and long-term data, Long-term timing reference.
A20、根据预先训练完成的择时策略分析模型分别对获取的各交易日的预设类型指标因子进行分析,以输出各交易日对应的走势因子值;A20. The preset type index factors of each acquired trading day are respectively analyzed according to the timing analysis strategy model completed by the pre-training, so as to output the trend factor values corresponding to each trading day;
具体地,预先训练完成的择时策略模型为采用机器学习的思路,将预设时间段内各交易日的预设类型指标因子作为机器学习模型的输入,通过机器学习预测输出各交易日对应的走势因子值。Specifically, the pre-trained timing strategy model adopts the idea of machine learning, and uses a preset type index factor of each trading day in a preset time period as an input of a machine learning model, and outputs corresponding to each trading day through machine learning prediction. Trend factor value.
优选地,在本实施例中,预先训练完成的择时策略模型为循环神经网络(RNN),通过循环神经网络作为机器学习算法。具体地,循环神经网络包括输入层、隐藏层(状态学习层)、以及输出层;在本实施例中,输出层用于输出预设时间段内的相对收益率,具体地,相对收益率为与预设时间段内股票市场的总收益相关的收益率;在本实施例中,相对收益率用来训练机器学习模型的反向更新梯度,而将隐藏层输出的各交易日对应的不同因子值作为择时策略模型输出的各交易日对应的走势因子值。Preferably, in the present embodiment, the pre-trained completion timing strategy model is a cyclic neural network (RNN), and the cyclic neural network is used as a machine learning algorithm. Specifically, the cyclic neural network includes an input layer, a hidden layer (state learning layer), and an output layer; in this embodiment, the output layer is configured to output a relative profit rate within a preset time period, specifically, a relative profit rate The rate of return associated with the total return of the stock market over a predetermined period of time; in this embodiment, the relative rate of return is used to train the inverse update gradient of the machine learning model, and the different factors corresponding to each trading day of the hidden layer output The value is the trend factor value corresponding to each trading day output by the timing strategy model.
需要说明的是,循环神经网络(RNN)的隐藏层包括多个节点,各节点之间存在互连的作用,为整个机器学习模型的关键层。通常输入层输入的特 征通过隐藏层训练学习变换之后,到达输出层。而在隐藏层包含多层神经元,可以看成一个在时间上传递的神经网络,它的深度是时间的长度,通常随着深度的加深,“梯度消失”的现象就会出现,这是由于在时间t时刻,它产生的梯度在时间轴上向历史传播几层之后就消失了,因此,在训练的过程中,需要借助输出层输出的数据训练机器学习模型的反向更新梯度,而隐藏层的神经网络对应将输入层输入的各个交易日的预设类型指标进行训练学习之后,得到各个交易日对应的因子数值,并将各个因子数值在对应的节点输出。It should be noted that the hidden layer of the cyclic neural network (RNN) includes multiple nodes, and the interconnection between the nodes acts as a key layer of the entire machine learning model. Usually the characteristics of the input layer input pass through the hidden layer training learning transformation and reach the output layer. In the hidden layer, which contains multiple layers of neurons, it can be regarded as a neural network transmitted in time. Its depth is the length of time. Usually, as the depth deepens, the phenomenon of “gradient disappearance” will appear. At time t, the gradient it produces disappears after several layers of history on the time axis. Therefore, in the process of training, it is necessary to train the inverse update gradient of the machine learning model by means of the data output from the output layer, and hide The neural network of the layer performs training learning corresponding to the preset type indicators of each trading day input by the input layer, and obtains the factor values corresponding to each trading day, and outputs the respective factor values at the corresponding nodes.
通过上述分析可知,本方案所使用的择时策略模型并不用于收益率的预测,在思想上更加接近于一个生成模型。本方案所涉及的择时策略模型的输出,是对应于每个交易日的隐藏层数值的分类,相当于对每一个交易日而言,生成一个标签。According to the above analysis, the timing strategy model used in this scheme is not used for the prediction of the rate of return, and is closer to a generation model in thought. The output of the timing strategy model involved in this scenario is a classification of hidden layer values corresponding to each trading day, which is equivalent to generating a label for each trading day.
A30、根据预先确定的聚类算法对各交易日对应的走势因子值进行聚类分析,以得到各交易日的走势因子值对应的走势类别;A30. Perform cluster analysis on the trend factor values corresponding to each trading day according to a predetermined clustering algorithm to obtain a trend category corresponding to the trend factor value of each trading day;
具体地,预先确定的聚类算法为k-means聚类算法,k-means聚类算法是划分方法中较经典的聚类算法之一。由于该算法的效率高,所以在对大规模数据进行聚类时被广泛应用。目前,许多算法均围绕着该算法进行扩展和改进。Specifically, the predetermined clustering algorithm is a k-means clustering algorithm, and the k-means clustering algorithm is one of the more classical clustering algorithms in the partitioning method. Because of its high efficiency, the algorithm is widely used in clustering large-scale data. At present, many algorithms are extended and improved around the algorithm.
k-means算法以k为参数,把n个对象分成k个簇,使簇内具有较高的相似度,而簇间的相似度较低。在本实施例中,k-means算法的处理过程如下:首先,假设有n个交易日,随机地选择k个交易日对应的走势因子值为对象,其中,n>k,且n,k均为正整数;每个对象初始地代表了一个簇的平均值或中心;对剩余的每个对象,根据其与各簇中心的距离,将它赋给最近的簇;然后重新计算每个簇的平均值。这个过程不断重复,直到准则函数收敛。通常,准则函数采用平方误差准则,其定义如下:The k-means algorithm uses k as a parameter to divide n objects into k clusters, so that the clusters have higher similarity and the similarity between clusters is lower. In this embodiment, the processing of the k-means algorithm is as follows: First, assuming that there are n trading days, the trend factor values corresponding to k transaction days are randomly selected as objects, where n>k, and n,k are Is a positive integer; each object initially represents the average or center of a cluster; for each of the remaining objects, it is assigned to the nearest cluster based on its distance from the center of each cluster; then each cluster is recalculated average value. This process is repeated until the criterion function converges. In general, the criterion function uses a squared error criterion, which is defined as follows:
Figure PCTCN2018102224-appb-000001
Figure PCTCN2018102224-appb-000001
其中,E是n个交易日对应的走势因子值构成的所有对象的平方误差的总 和,p是空间中需要聚类的点,在本实施例中,p是n个交易日的走势因子,mi是簇Ci的平均值。该目标函数使生成的簇尽可能紧凑独立,使用的距离度量是欧几里得距离,当然也可以用其他距离度量。k-means聚类算法的算法流程如下:输入包含n个对象的数据库和簇的数目k,在本实施例中,将n个交易日对应的走势因子值作为上述n个对象,预设的k类走势类别作为簇的数目;输出k个簇,使平方误差准则最小。在本实施例中,具体包括:任意选择k个交易日的走势因子值作为初始的簇中心;根据簇中对象的平均值,将每个对象(重新)赋予最类似的簇;更新簇的平均值,即计算每个簇中对象的平均值;直到计算结果不再发生变化,则聚类结束。Where E is the sum of the squared errors of all objects consisting of the trend factor values corresponding to n trading days, and p is the point in the space that needs to be clustered. In this embodiment, p is the trend factor of n trading days, mi Is the average of the cluster Ci. The objective function makes the generated cluster as compact and independent as possible, and the distance metric used is the Euclidean distance, although other distance metrics can be used. The algorithm flow of the k-means clustering algorithm is as follows: input the database containing n objects and the number k of clusters. In this embodiment, the trend factor values corresponding to n transaction days are taken as the above n objects, and the preset k The class trend category is used as the number of clusters; k clusters are output to minimize the square error criterion. In this embodiment, the method specifically includes: selecting a trend factor value of k transaction days as an initial cluster center; assigning each object (re) to the most similar cluster according to the average value of the objects in the cluster; updating the average of the clusters The value, which is the average of the objects in each cluster; until the calculation no longer changes, the cluster ends.
进一步地,常见的走势类别可在不同K线形态中形象地表示,例如常见的K线形态有“V”字型、反转十字型、“W”型、低位档五阳线、圆弧底型、上升中途跳高弓形线、上升中途跳高剑形线、跳空攀援线等等,而走势因子值对应为各种K线形态中的一个点。Further, the common trend categories can be visually represented in different K-line patterns. For example, the common K-line form has a "V" shape, a reverse cross type, a "W" type, a low position five-yang line, and an arc bottom type. The rise of the bow line in the middle of the rise, the jump of the sword line in the middle of the rise, the jump line of the jump, and so on, and the trend factor value corresponds to one of the various K-line forms.
A40、根据得到的各交易日的走势因子值对应的走势类别,确定择时交易策略。A40. Determine a timing trading strategy according to the trend category corresponding to the obtained trend factor value of each trading day.
具体地,在本实施例的一种实施方式中,以沪深300为例,假设将一年内各交易日对应的走势因子值进行聚类分析,得到各交易日的走势因子值对应的k类市场走势类别。分别分析各交易日在各自对应的K线形态中对应的位置点,进一步确定对应的位置点后续的K线变化形态,具体地,获取历史时间段内(本实施例中,假设分析周期为1年)分别出现类似K线形态的市场走势类别,例如,统计分析一周内沪深300的走势形态,假设该一周内的各交易日对应的走势因子值对应的走势类别中有“w”底的K线变化形态,且历史上在一周内出现“w”底的K线变化形态后,在后续预设时间内,假设一周内,对应的K线变化形态更可能接近于另一确定的走势类别,假设为上升中途跳高弓形线,则确定根据上升中途跳高弓形线来确定未来一周的择时交易策略。Specifically, in an embodiment of the present embodiment, taking the CSI 300 as an example, it is assumed that the trend factor values corresponding to each trading day in a year are clustered and analyzed, and k types corresponding to the trend factor values of each trading day are obtained. Market trend category. The position points corresponding to the corresponding K-line patterns are respectively analyzed on each trading day, and the subsequent K-line variation pattern of the corresponding position points is further determined, specifically, in the historical time period (in this embodiment, the hypothesis analysis period is 1) Years) There are market trend categories similar to the K-line pattern. For example, statistical analysis of the trend pattern of the Shanghai and Shenzhen 300 in a week, assuming that the trend factor corresponding to each trading day in the week has a "w" in the trend category. After the K-line change pattern, and the K-line change pattern of the "w" bottom appears in the past week, in the subsequent preset time, it is assumed that the corresponding K-line change pattern is more likely to be close to another determined trend category within one week. Assuming a rising bow line in the middle of the rise, it is determined that the next-day trading strategy for the next week is determined according to the rising midline high bow line.
由上述事实施例可知,本申请提出的电子装置,首先通过获取预先确定的股票市场指数在预设时间段内的各交易日对应的预设类型指标因子;然后 根据预先训练完成的择时策略分析模型分别对获取的各交易日的预设类型指标因子进行分析,以输出各交易日对应的走势因子值;再根据预先确定的聚类算法对各交易日对应的走势因子值进行聚类分析,以得到各交易日的走势因子值对应的走势类别;最后根据得到的各交易日的走势因子值对应的走势类别,确定择时交易策略。提高了股票择时交易的效率及准确性。It can be seen from the above embodiments that the electronic device proposed by the present application firstly obtains a preset type index factor corresponding to each trading day of a predetermined stock market index within a preset time period; and then performs a timing strategy based on pre-training. The analysis model separately analyzes the preset type index factors of each acquired trading day to output the trend factor values corresponding to each trading day; and then clusters the trend factor values corresponding to each trading day according to a predetermined clustering algorithm. In order to obtain the trend category corresponding to the trend factor value of each trading day; finally, the timing trading strategy is determined according to the trend category corresponding to the trend factor value of each trading day obtained. Improve the efficiency and accuracy of stock timing transactions.
进一步需要说明的是,本申请的基于机器学习的股票择时程序依据其各部分所实现的功能不同,可用具有相同功能的程序模块进行描述。请参阅图2所示,是本申请电子装置一实施例中基于机器学习的股票择时程序的程序模块示意图。本实施例中,基于机器学习的股票择时程序依据其各部分所实现的功能的不同,可以被分割成获取模块201、分析模块202、聚类模块203、以及确定模块204。由上面的描述可知,本申请所称的程序模块是指能够完成特定功能的一系列计算机程序指令段,比程序更适合于描述基于机器学习的股票择时程序在电子装置10中的执行过程。所述模块201-204所实现的功能或操作步骤均与上文类似,此处不再详述,示例性地,例如其中:It should be further noted that the machine learning-based stock timing program of the present application may be described by a program module having the same function according to different functions implemented by the respective parts. Please refer to FIG. 2 , which is a schematic diagram of a program module of a machine-based stock timing program according to an embodiment of the electronic device of the present application. In this embodiment, the machine timing program based on machine learning may be divided into an obtaining module 201, an analyzing module 202, a clustering module 203, and a determining module 204 according to different functions implemented by the respective parts. As can be seen from the above description, the program module referred to in the present application refers to a series of computer program instruction segments capable of performing a specific function, and is more suitable than the program to describe the execution process of the machine learning-based stock timing program in the electronic device 10. The functions or operational steps implemented by the modules 201-204 are similar to the above, and are not described in detail herein, by way of example, for example:
获取模块201用于获取预先确定的股票市场指数在预设时间段内的各交易日对应的预设类型指标因子;The obtaining module 201 is configured to obtain a preset type indicator factor corresponding to each trading day of the predetermined stock market index within a preset time period;
分析模块202用于根据预先训练完成的择时策略分析模型分别对获取的各交易日的预设类型指标因子进行分析,以输出各交易日对应的走势因子值;The analyzing module 202 is configured to analyze the preset type index factors of each acquired trading day according to the timing analysis strategy model completed by the pre-training, so as to output the trend factor values corresponding to each trading day;
聚类模块203用于根据预先确定的聚类算法对各交易日对应的走势因子值进行聚类分析,以得到各交易日的走势因子值对应的走势类别;The clustering module 203 is configured to perform cluster analysis on the trend factor values corresponding to each trading day according to a predetermined clustering algorithm, to obtain a trend category corresponding to the trend factor value of each trading day;
确定模块204用于根据得到的各交易日的走势因子值对应的走势类别,确定择时交易策略。The determining module 204 is configured to determine a timing trading strategy according to the obtained trend category corresponding to the trend factor value of each trading day.
此外,本申请还提出一种基于机器学习的股票择时方法,请参阅图3所示,所述基于机器学习的股票择时方法包括如下步骤:In addition, the present application also proposes a machine learning-based stock timing method. Referring to FIG. 3, the machine learning-based stock timing method includes the following steps:
S100、获取预先确定的股票市场指数在预设时间段内的各交易日对应的预设类型指标因子;S100. Obtain a preset type indicator factor corresponding to each trading day of the predetermined stock market index within a preset time period;
具体地,预先确定的股票市场指数指的是具有流动性强、规模大、能够 代表股票的股价综合变动,且能够为投资者提供权威的投资方向的股票市场参考数据,例如上证50、沪深300、或者中证500等的常用参考数据。其中,上证50对应的是沪市的50只大盘股,沪深300对应的是两市市值30名以外的300只蓝筹股,其中只有极少部分与上证50重合,如浦发、联通等,中证500对应的是两市市值适中的500只个股,有许多与沪深300重合。具体地,预设类型指标因子为影响预先确定的股票市场指数的宏观指标,例如,在本实施例中,以沪深300为例,对应的预设类型指标因子包括,但不仅限于,中债国债到期收益率-中债企业债到期收益率、风险溢价、股息率、SlowD、MACD Histogram、Bollinger Bands、MA of RSI(14)[M=22]、4-period MA of4-week MA of modified OBV-(MA4*4)、CR指标、大小盘换手率比值、RSRS指标、沪深300溢价率、沪深300主动买入额等13维指标。Specifically, the pre-determined stock market index refers to stock market reference data that has strong liquidity, large scale, can represent the stock price comprehensive change, and can provide investors with an authoritative investment direction, such as SSE 50, Shanghai and Shenzhen. 300, or commonly used reference data such as CSI 500. Among them, SSE 50 corresponds to 50 large-cap stocks in Shanghai stock market, and CSI 300 corresponds to 300 blue-chip stocks outside the market value of 30 cities, of which only a few are coincident with SSE 50, such as Pufa, Unicom, etc. 500 corresponds to 500 stocks with moderate market capitalization in the two cities, many of which coincide with the Shanghai and Shenzhen 300. Specifically, the preset type index factor is a macro indicator that affects a predetermined stock market index. For example, in the embodiment, taking the CSI 300 as an example, the corresponding preset type index factors include, but are not limited to, the medium debt. Treasury yield to maturity - China Bond Corporate Bond Yield to maturity, risk premium, dividend yield, SlowD, MACD Histogram, Bollinger Bands, MA of RSI (14) [M=22], 4-period MA of 4-week MA of Modified OBV-(MA4*4), CR indicator, ratio of size to disk, RSRS indicator, CSI 300 premium rate, CSI 300 active purchase amount and other 13-dimensional indicators.
其中,中债企业债到期收益率(AAA)10年-中债国债10年期,可以从大致趋势上来看当利差上升阶段,大盘也开始上行,小盘下行。反之当利差下降时指标大盘下行,小盘上行。从图上来看利差近期出现下降拐点,预示大盘开始下行,小盘风格占优。Among them, the debt yield of China Bond (AAA) is 10 years - the 10-year period of China Bond National Debt can be seen from the general trend. When the spread is rising, the market will also start to rise and the small market will go down. Conversely, when the spread falls, the indicator goes down and the small market goes up. From the chart, the spread of the spread has recently declined, indicating that the market is starting to decline and the small-cap style is dominant.
风险溢价与股息率呈现反相关性,当股市的收益率高于债市时,资金将从债市流向股市;反之,当股指收益率低于债市时,资金将从股市流向债市。(平稳通道为average加减1std)The risk premium and the dividend yield are inversely related. When the stock market's yield is higher than the bond market, the funds will flow from the bond market to the stock market. Conversely, when the stock index yield is lower than the bond market, the funds will flow from the stock market to the bond market. (Smooth channel is average plus or minus 1std)
股息率,沪深300股息率与沪深300收盘价呈负相关性。(平稳通道为average加减1std)The dividend yield, the CSI 300 dividend yield and the closing price of the CSI 300 were negatively correlated. (Smooth channel is average plus or minus 1std)
SlowD,当slowD<10超卖信号出现,做多指数;当slowD>10超卖信号消失,做空指数。SlowD, when slowD<10 oversold signal appears, do more index; when slowD>10 oversold signal disappears, short index.
MACD Histogram当MACD Histogram由负转正,做多信号出现,MACD由正转负,做空信号出现;MACD Histogram When the MACD Histogram turns from negative to positive, the multi-signal appears, the MACD changes from positive to negative, and the short signal appears;
Bollinger Bands,当股价<下轨线BN,买入信号出现。Bollinger Bands, when the stock price < lower trajectory BN, the buy signal appears.
MA of RSI(14)[M=22],当22-day MA of RSI(14)<40时,买入信号出现,投资期限为22个交易日。MA of RSI (14) [M = 22], when 22-day MA of RSI (14) < 40, the buy signal appears, the investment period is 22 trading days.
4-period MA of 4-week MA of modified OBV-(MA4*4),当股价走势和MA4*4一致时,买入信号出现,背离时,卖出信号出现。4-period MA of 4-week MA of modified OBV-(MA4*4), when the stock price trend is consistent with MA4*4, the buy signal appears, and when it deviates, the sell signal appears.
CR指标,CR<260,能量较低,加仓信号出现。CR indicator, CR <260, low energy, jiacang signal appears.
大小盘换手率比值Size change ratio
当换手率<=0.1,且振幅<=-10%,市场从小盘转为大盘风格;当换手率>=0.3,且振幅>=10%,市场从大盘转为小盘。When the turnover rate is <=0.1, and the amplitude is <=-10%, the market changes from small to large style; when the turnover rate is >=0.3, and the amplitude is >=10%, the market turns from the market to the small market.
RSRS指标,当zscore>0.7且当日MA(20)收盘价>过去三日MA(20)收盘价的时候,买入信号;当zscore<-0.7且当日MA(20)收盘价<过去三日MA(20)收盘价的时候,卖出信号RSRS indicator, when zscore>0.7 and the closing price of MA(20) on the same day > the closing price of MA(20) in the past three days, buy signal; when zscore<-0.7 and the closing price of MA(20) on the same day < the past three days MA (20) When the closing price is sold, the signal is sold.
沪深300溢价率,溢价率>0,市场乐观;溢价率<0,市场悲观;历史上,溢价率触及5时,为卖出信号;溢价率触及-1时,为买入信号。The Shanghai-Shenzhen 300 premium rate, premium rate >0, market optimism; premium rate <0, market pessimism; historically, the premium rate hits 5 o'clock, is a sell signal; when the premium rate hits -1, it is a buy signal.
沪深300主动买入额,溢价率>0,市场乐观;溢价率<0,市场悲观;历史上,溢价率触及5时,为卖出信号;溢价率触及-1时,为买入信号。The Shanghai and Shenzhen 300 actively buy the amount, the premium rate is >0, the market is optimistic; the premium rate is <0, the market is pessimistic; historically, the premium rate hits 5 o'clock, it is a sell signal; when the premium rate hits -1, it is a buy signal.
通常,根据预设时间段内包含的交易日数目不同,预设时间段可分为超短期,短期,中期,长期,以及超长期等,例如在本实施例中,预定义超短期包含的交易日数目小于等于5,短期包含的交易日数目大于5,且小于等于10,中期包含的交易日数目大于10,且小于等于15,长期包含的交易日数目大于15日,且小于一年,超长期包含的交易日数目大于一年等。一般而言,在实际应用中,超短期和短期时间段内的时间序列数据具有较好的拟合效果,但是包含的信息较少,可用于超短线择时参考;中长期时间序列的数据包含的信息较多,但是时序间数据的依赖关系没有短期明显,导致拟合效果没有超短期和短期好,所以通常通过超长期数据刻画宏观经济形势与经济走势,并结合中长期数据,用于中长线择时参考。Generally, according to the number of trading days included in the preset time period, the preset time period may be classified into ultra short-term, short-term, medium-term, long-term, and ultra-long-term, etc., for example, in this embodiment, the predefined ultra-short-term included transaction The number of days is less than or equal to 5, and the number of trading days included in the short-term is greater than 5 and less than or equal to 10. The number of trading days included in the medium-term is greater than 10 and less than or equal to 15, and the number of trading days included in the long-term is greater than 15 days and less than one year. The number of trading days included in the long term is greater than one year. In general, in practical applications, time series data in ultra-short-term and short-term time periods have a good fitting effect, but contain less information and can be used for ultra-short-line timing reference; the data of medium- and long-term time series contains There is more information, but the dependence of data between time series is not obvious in the short term, so the fitting effect is not super short-term and short-term, so the macroeconomic situation and economic trend are usually described by ultra-long-term data, and combined with medium and long-term data, Long-term timing reference.
S200、根据预先训练完成的择时策略分析模型分别对获取的各交易日的预设类型指标因子进行分析,以输出各交易日对应的走势因子值;S200: analyzing, according to the timing analysis strategy model completed by the pre-training, respectively, the preset type index factors of each acquired trading day are analyzed, so as to output the trend factor values corresponding to each trading day;
具体地,预先训练完成的择时策略模型为采用机器学习的思路,将预设时间段内各交易日的预设类型指标因子作为机器学习模型的输入,通过机器 学习预测输出各交易日对应的走势因子值。Specifically, the pre-trained timing strategy model adopts the idea of machine learning, and uses a preset type index factor of each trading day in a preset time period as an input of a machine learning model, and outputs corresponding to each trading day through machine learning prediction. Trend factor value.
优选地,在本实施例中,预先训练完成的择时策略模型为循环神经网络(RNN),通过循环神经网络作为机器学习算法。具体地,循环神经网络包括输入层、隐藏层(状态学习层)、以及输出层;在本实施例中,输出层用于输出预设时间段内的相对收益率,具体地,相对收益率为与预设时间段内股票市场的总收益相关的收益率;在本实施例中,相对收益率用来训练机器学习模型的反向更新梯度,而将隐藏层输出的各交易日对应的不同因子值作为择时策略模型输出的各交易日对应的走势因子值。Preferably, in the present embodiment, the pre-trained completion timing strategy model is a cyclic neural network (RNN), and the cyclic neural network is used as a machine learning algorithm. Specifically, the cyclic neural network includes an input layer, a hidden layer (state learning layer), and an output layer; in this embodiment, the output layer is configured to output a relative profit rate within a preset time period, specifically, a relative profit rate The rate of return associated with the total return of the stock market over a predetermined period of time; in this embodiment, the relative rate of return is used to train the inverse update gradient of the machine learning model, and the different factors corresponding to each trading day of the hidden layer output The value is the trend factor value corresponding to each trading day output by the timing strategy model.
需要说明的是,循环神经网络(RNN)的隐藏层节点之间存在互连的作用,为整个机器学习模型的关键层。通常输入层输入的特征通过隐藏层训练学习变换之后,到达输出层。而在隐藏层包含多层神经元,可以看成一个在时间上传递的神经网络,它的深度是时间的长度,通常随着深度的加深,“梯度消失”的现象就会出现,这是由于在时间t时刻,它产生的梯度在时间轴上向历史传播几层之后就消失了,因此,在训练的过程中,需要借助输出层输出的数据训练机器学习模型的反向更新梯度,而隐藏层的神经网络对应将输入层输入的各个交易日的预设类型指标进行训练学习之后,得到各个交易日对应的因子数值,并将各个因子数值在对应的节点输出。It should be noted that there is an interconnection between hidden layer nodes of the cyclic neural network (RNN), which is a key layer of the entire machine learning model. Usually the input layer input features pass through the hidden layer training learning transformation and reach the output layer. In the hidden layer, which contains multiple layers of neurons, it can be regarded as a neural network transmitted in time. Its depth is the length of time. Usually, as the depth deepens, the phenomenon of “gradient disappearance” will appear. At time t, the gradient it produces disappears after several layers of history on the time axis. Therefore, in the process of training, it is necessary to train the inverse update gradient of the machine learning model by means of the data output from the output layer, and hide The neural network of the layer performs training learning corresponding to the preset type indicators of each trading day input by the input layer, and obtains the factor values corresponding to each trading day, and outputs the respective factor values at the corresponding nodes.
通过上述分析可知,本方案所使用的择时策略模型并不用于收益率的预测,在思想上更加接近于一个生成模型。本方案所涉及的择时策略模型的输出,是对应于每个交易日的隐藏层数值的分类,相当于对每一个交易日而言,生成一个标签。According to the above analysis, the timing strategy model used in this scheme is not used for the prediction of the rate of return, and is closer to a generation model in thought. The output of the timing strategy model involved in this scenario is a classification of hidden layer values corresponding to each trading day, which is equivalent to generating a label for each trading day.
S300、根据预先确定的聚类算法对各交易日对应的走势因子值进行聚类分析,以得到各交易日的走势因子值对应的走势类别;S300, performing cluster analysis on the trend factor values corresponding to each trading day according to a predetermined clustering algorithm, to obtain a trend category corresponding to the trend factor value of each trading day;
具体地,预先确定的聚类算法为k-means聚类算法,k-means聚类算法是划分方法中较经典的聚类算法之一。由于该算法的效率高,所以在对大规模数据进行聚类时被广泛应用。目前,许多算法均围绕着该算法进行扩展和改进。Specifically, the predetermined clustering algorithm is a k-means clustering algorithm, and the k-means clustering algorithm is one of the more classical clustering algorithms in the partitioning method. Because of its high efficiency, the algorithm is widely used in clustering large-scale data. At present, many algorithms are extended and improved around the algorithm.
k-means算法以k为参数,把n个对象分成k个簇,使簇内具有较高的相似度,而簇间的相似度较低。在本实施例中,k-means算法的处理过程如下:首先,假设有n个交易日,随机地选择k个交易日对应的走势因子值为对象,其中,n>k,且n,k均为正整数;每个对象初始地代表了一个簇的平均值或中心;对剩余的每个对象,根据其与各簇中心的距离,将它赋给最近的簇;然后重新计算每个簇的平均值。这个过程不断重复,直到准则函数收敛。通常,准则函数采用平方误差准则,其定义如下:The k-means algorithm uses k as a parameter to divide n objects into k clusters, so that the clusters have higher similarity and the similarity between clusters is lower. In this embodiment, the processing of the k-means algorithm is as follows: First, assuming that there are n trading days, the trend factor values corresponding to k transaction days are randomly selected as objects, where n>k, and n,k are Is a positive integer; each object initially represents the average or center of a cluster; for each of the remaining objects, it is assigned to the nearest cluster based on its distance from the center of each cluster; then each cluster is recalculated average value. This process is repeated until the criterion function converges. In general, the criterion function uses a squared error criterion, which is defined as follows:
Figure PCTCN2018102224-appb-000002
Figure PCTCN2018102224-appb-000002
其中,E是n个交易日对应的走势因子值构成的所有对象的平方误差的总和,p是空间中的点,mi是簇Ci的平均值。该目标函数使生成的簇尽可能紧凑独立,使用的距离度量是欧几里得距离,当然也可以用其他距离度量。k-means聚类算法的算法流程如下:输入包含n个对象的数据库和簇的数目k,在本实施例中,将n个交易日对应的走势因子值作为上述n个对象,预设的k类走势类别作为簇的数目;输出k个簇,使平方误差准则最小。在本实施例中,具体包括:任意选择k个交易日的走势因子值作为初始的簇中心;根据簇中对象的平均值,将每个对象(重新)赋予最类似的簇;更新簇的平均值,即计算每个簇中对象的平均值;直到计算结果不再发生变化,则聚类结束。Where E is the sum of the squared errors of all objects consisting of the trend factor values corresponding to n trading days, p is the point in space, and mi is the average of the cluster Ci. The objective function makes the generated cluster as compact and independent as possible, and the distance metric used is the Euclidean distance, although other distance metrics can be used. The algorithm flow of the k-means clustering algorithm is as follows: input the database containing n objects and the number k of clusters. In this embodiment, the trend factor values corresponding to n transaction days are taken as the above n objects, and the preset k The class trend category is used as the number of clusters; k clusters are output to minimize the square error criterion. In this embodiment, the method specifically includes: selecting a trend factor value of k transaction days as an initial cluster center; assigning each object (re) to the most similar cluster according to the average value of the objects in the cluster; updating the average of the clusters The value, which is the average of the objects in each cluster; until the calculation no longer changes, the cluster ends.
进一步地,常见的走势类别可在不同K线形态中形象地表示,例如常见的K线形态有“V”字型、反转十字型、“W”型、低位档五阳线、圆弧底型、上升中途跳高弓形线、上升中途跳高剑形线、跳空攀援线等等,而走势因子值对应为各种K线形态中的一个点。Further, the common trend categories can be visually represented in different K-line patterns. For example, the common K-line form has a "V" shape, a reverse cross type, a "W" type, a low position five-yang line, and an arc bottom type. The rise of the bow line in the middle of the rise, the jump of the sword line in the middle of the rise, the jump line of the jump, and so on, and the trend factor value corresponds to one of the various K-line forms.
S400、根据得到的各交易日的走势因子值对应的走势类别,确定择时交易策略。S400: Determine a timing trading strategy according to the trend category corresponding to the obtained trend factor value of each trading day.
具体地,在本实施例的一种实施方式中,以沪深300为例,假设将一年内各交易日对应的走势因子值进行聚类分析,得到各交易日的走势因子值对应的k类市场走势类别。分别分析各交易日在各自对应的K线形态中对应的 位置点,进一步确定对应的位置点后续的K线变化形态,具体地,获取历史时间段内(本实施例中,假设分析周期为1年)分别出现类似K线形态的市场走势类别,例如,统计分析一周内沪深300的走势形态,假设该一周内的各交易日对应的走势因子值对应的走势类别中有“w”底的K线变化形态,且历史上在一周内出现“w”底的K线变化形态后,在后续预设时间内,假设一周内,对应的K线变化形态更可能接近于另一确定的走势类别,假设为上升中途跳高弓形线,则确定根据上升中途跳高弓形线来确定未来一周的择时交易策略。Specifically, in an embodiment of the present embodiment, taking the CSI 300 as an example, it is assumed that the trend factor values corresponding to each trading day in a year are clustered and analyzed, and k types corresponding to the trend factor values of each trading day are obtained. Market trend category. The position points corresponding to the corresponding K-line patterns are respectively analyzed on each trading day, and the subsequent K-line variation pattern of the corresponding position points is further determined, specifically, in the historical time period (in this embodiment, the hypothesis analysis period is 1) Years) There are market trend categories similar to the K-line pattern. For example, statistical analysis of the trend pattern of the Shanghai and Shenzhen 300 in a week, assuming that the trend factor corresponding to each trading day in the week has a "w" in the trend category. After the K-line change pattern, and the K-line change pattern of the "w" bottom appears in the past week, in the subsequent preset time, it is assumed that the corresponding K-line change pattern is more likely to be close to another determined trend category within one week. Assuming a rising bow line in the middle of the rise, it is determined that the next-day trading strategy for the next week is determined according to the rising midline high bow line.
由上述事实施例可知,本申请提出的基于机器学习的股票择时方法,首先通过获取预先确定的股票市场指数在预设时间段内的各交易日对应的预设类型指标因子;然后根据预先训练完成的择时策略分析模型分别对获取的各交易日的预设类型指标因子进行分析,以输出各交易日对应的走势因子值;再根据预先确定的聚类算法对各交易日对应的走势因子值进行聚类分析,以得到各交易日的走势因子值对应的走势类别;最后根据得到的各交易日的走势因子值对应的走势类别,确定择时交易策略。提高了股票择时交易的效率及准确性。It can be seen from the above embodiments that the machine learning-based stock timing method proposed by the present application firstly obtains a preset type index factor corresponding to each trading day of a predetermined stock market index within a preset time period; The training completion timing analysis model separately analyzes the preset type index factors of each transaction day to output the trend factor values corresponding to each trading day; and then according to the predetermined clustering algorithm, the corresponding trend of each trading day The factor value is clustered to obtain the trend category corresponding to the trend factor value of each trading day; finally, the timing trading strategy is determined according to the trend category corresponding to the trend factor value of each trading day. Improve the efficiency and accuracy of stock timing transactions.
此外,本申请还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有基于机器学习的股票择时程序,所述基于机器学习的股票择时程序被处理器执行时实现如下操作:In addition, the present application further provides a computer readable storage medium on which a machine learning based stock timing program is stored, and the machine learning based stock timing program is executed by a processor as follows: operating:
获取预先确定的股票市场指数在预设时间段内的各交易日对应的预设类型指标因子;Obtaining a preset type index factor corresponding to each trading day of the predetermined stock market index within a preset time period;
根据预先训练完成的择时策略分析模型分别对获取的各交易日的预设类型指标因子进行分析,以输出各交易日对应的走势因子值;According to the timing analysis strategy model completed by the pre-training, the preset type index factors of each acquired trading day are respectively analyzed to output the trend factor values corresponding to each trading day;
根据预先确定的聚类算法对各交易日对应的走势因子值进行聚类分析,以得到各交易日的走势因子值对应的走势类别;Perform cluster analysis on the trend factor values corresponding to each trading day according to a predetermined clustering algorithm to obtain a trend category corresponding to the trend factor value of each trading day;
根据得到的各交易日的走势因子值对应的走势类别,确定择时交易策略。The timing trading strategy is determined according to the trend category corresponding to the trend factor value of each trading day obtained.
本申请计算机可读存储介质具体实施方式与上述电子装置以及基于机器学习的股票方法各实施例基本相同,在此不作累述。The specific embodiment of the computer readable storage medium of the present application is substantially the same as the above embodiments of the electronic device and the machine learning based stock method, and will not be described herein.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the embodiments of the present application are merely for the description, and do not represent the advantages and disadvantages of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is better. Implementation. Based on such understanding, the technical solution of the present application, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, The optical disc includes a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present application.
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above is only a preferred embodiment of the present application, and is not intended to limit the scope of the patent application, and the equivalent structure or equivalent process transformations made by the specification and the drawings of the present application, or directly or indirectly applied to other related technical fields. The same is included in the scope of patent protection of this application.

Claims (20)

  1. 一种电子装置,其特征在于,所述电子装置包括存储器、及与所述存储器连接的处理器,所述处理器用于执行所述存储器上存储的基于机器学习的股票择时程序,所述基于机器学习的股票择时程序被所述处理器执行时实现如下步骤:An electronic device, comprising: a memory, and a processor coupled to the memory, the processor configured to execute a machine learning based stock timing program stored on the memory, the based The machine learning stock timing program is executed by the processor to implement the following steps:
    A10、获取预先确定的股票市场指数在预设时间段内的各交易日对应的预设类型指标因子;A10. Obtain a preset type indicator factor corresponding to each trading day of the predetermined stock market index in a preset time period;
    A20、根据预先训练完成的择时策略分析模型分别对获取的各交易日的预设类型指标因子进行分析,以输出各交易日对应的走势因子值;A20. The preset type index factors of each acquired trading day are respectively analyzed according to the timing analysis strategy model completed by the pre-training, so as to output the trend factor values corresponding to each trading day;
    A30、根据预先确定的聚类算法对各交易日对应的走势因子值进行聚类分析,以得到各交易日的走势因子值对应的走势类别;A30. Perform cluster analysis on the trend factor values corresponding to each trading day according to a predetermined clustering algorithm to obtain a trend category corresponding to the trend factor value of each trading day;
    A40、根据得到的各交易日的走势因子值对应的走势类别,确定择时交易策略。A40. Determine a timing trading strategy according to the trend category corresponding to the obtained trend factor value of each trading day.
  2. 如权利要求1所述的电子装置,其特征在于,所述预先训练完成的择时策略分析模型为循环神经网络模型;The electronic device according to claim 1, wherein the pre-trained timing analysis strategy analysis model is a cyclic neural network model;
    所述循环神经网络包括输入层、隐藏层、以及输出层;所述输入层用于输入预设时间段内各交易日对应的预设类型指标因子;所述输出层用于输出预设时间段内的相对收益率;所述隐藏层包含多层神经元,且各神经元的各个节点之间存在互连的作用,用于将所述输入层输入的预设类型指标因子通过神经元训练学习变换之后,生成各交易日对应的走势因子值。The looping neural network includes an input layer, a hidden layer, and an output layer; the input layer is configured to input a preset type index factor corresponding to each trading day in a preset time period; and the output layer is configured to output a preset time period The relative yield within the layer; the hidden layer comprises a plurality of layers of neurons, and an interconnection function exists between each node of each neuron, and the preset type index factor input by the input layer is trained through neuron training After the transformation, the trend factor value corresponding to each trading day is generated.
  3. 如权利要求2所述的电子装置,其特征在于,所述预先确定的聚类算法为k-means聚类算法;所述步骤A30包括如下步骤:The electronic device according to claim 2, wherein the predetermined clustering algorithm is a k-means clustering algorithm; and the step A30 comprises the following steps:
    E1、分别假设n个对象以及簇的数目,所述n个对象为获取的各个交易日对应的走势因子值,所述簇的数目为预定义的k类走势类别,其中n≥k,且均为正整数;E1, respectively, assuming n objects and a number of clusters, wherein the n objects are trend factor values corresponding to the acquired respective transaction days, and the number of the clusters is a predefined k-type trend category, wherein n≥k, and both Is a positive integer;
    F1、从所述n个对象中任意选取k个对象分别作为预定义的初始簇,k个对象分别为预定义的初始簇的平均值;F1, arbitrarily selecting k objects from the n objects as pre-defined initial clusters, and k objects are respectively average values of pre-defined initial clusters;
    G1、分别计算所述n个对象与各个初始簇的平均值之间的欧几里得距离,并根据计算结果,将所述n个对象分别赋予对应欧几里得距离最小的簇;G1, respectively calculating a Euclidean distance between the average values of the n objects and each initial cluster, and according to the calculation result, respectively assigning the n objects to the cluster corresponding to the smallest Euclidean distance;
    H1、重新计算各个簇的平均值,并重复执行上述步骤G1,直至预定义的准则函数收敛,则聚类结束。H1, recalculate the average value of each cluster, and repeat the above step G1 until the predefined criterion function converges, then the cluster ends.
  4. 如权利要求3所述的电子装置,其特征在于,所述预定义的准则函数为平方误差准则函数,所述平方误差准则函数为:The electronic device of claim 3 wherein said predefined criterion function is a squared error criterion function, said squared error criterion function is:
    Figure PCTCN2018102224-appb-100001
    Figure PCTCN2018102224-appb-100001
    其中,E是n个交易日对应的走势因子值构成的所有对象的平方误差的总和,p是n个交易日的走势因子,mi是簇Ci的平均值。Where E is the sum of the squared errors of all objects consisting of the trend factor values corresponding to n trading days, p is the trend factor of n trading days, and mi is the average of the cluster Ci.
  5. 如权利要求1所述的电子装置,其特征在于,所述走势因子值对应为不同K线形态中的点,所述走势因子值对应的走势类别包括不同的K线形态。The electronic device according to claim 1, wherein the trend factor value corresponds to a point in a different K-line form, and the trend category corresponding to the trend factor value comprises a different K-line form.
  6. 如权利要求2所述的电子装置,其特征在于,所述走势因子值对应为不同K线形态中的点,所述走势因子值对应的走势类别包括不同的K线形态。The electronic device according to claim 2, wherein the trend factor value corresponds to a point in a different K-line form, and the trend category corresponding to the trend factor value comprises a different K-line form.
  7. 如权利要求3所述的电子装置,其特征在于,所述走势因子值对应为不同K线形态中的点,所述走势因子值对应的走势类别包括不同的K线形态。The electronic device according to claim 3, wherein the trend factor value corresponds to a point in a different K-line form, and the trend category corresponding to the trend factor value comprises a different K-line form.
  8. 如权利要求4所述的电子装置,其特征在于,所述走势因子值对应为不同K线形态中的点,所述走势因子值对应的走势类别包括不同的K线形态。The electronic device according to claim 4, wherein the trend factor value corresponds to a point in a different K-line form, and the trend category corresponding to the trend factor value comprises a different K-line form.
  9. 一种基于机器学习的股票择时方法,其特征在于,所述方法包括如下步骤:A machine learning-based stock timing method, characterized in that the method comprises the following steps:
    S100、获取预先确定的股票市场指数在预设时间段内的各交易日对应的预设类型指标因子;S100. Obtain a preset type indicator factor corresponding to each trading day of the predetermined stock market index within a preset time period;
    S200、根据预先训练完成的择时策略分析模型分别对获取的各交易日的预设类型指标因子进行分析,以输出各交易日对应的走势因子值;S200: analyzing, according to the timing analysis strategy model completed by the pre-training, respectively, the preset type index factors of each acquired trading day are analyzed, so as to output the trend factor values corresponding to each trading day;
    S300、根据预先确定的聚类算法对各交易日对应的走势因子值进行聚类分析,以得到各交易日的走势因子值对应的走势类别;S300, performing cluster analysis on the trend factor values corresponding to each trading day according to a predetermined clustering algorithm, to obtain a trend category corresponding to the trend factor value of each trading day;
    S400、根据得到的各交易日的走势因子值对应的走势类别,确定择时交 易策略。S400: Determine a timing transaction strategy according to the trend category corresponding to the obtained trend factor value of each trading day.
  10. 如权利要求9所述的基于机器学习的股票择时方法,其特征在于,所述预先训练完成的择时策略分析模型为循环神经网络模型;The machine learning-based stock timing method according to claim 9, wherein the pre-trained completion timing analysis model is a cyclic neural network model;
    所述循环神经网络包括输入层、隐藏层、以及输出层;所述输入层用于输入预设时间段内各交易日对应的预设类型指标因子;所述输出层用于输出预设时间段内的相对收益率;所述隐藏层包含多层神经元,且各神经元的各个节点之间存在互连的作用,用于将所述输入层输入的预设类型指标因子通过神经元训练学习变换之后,生成各交易日对应的走势因子值。The looping neural network includes an input layer, a hidden layer, and an output layer; the input layer is configured to input a preset type index factor corresponding to each trading day in a preset time period; and the output layer is configured to output a preset time period The relative yield within the layer; the hidden layer comprises a plurality of layers of neurons, and an interconnection function exists between each node of each neuron, and the preset type index factor input by the input layer is trained through neuron training After the transformation, the trend factor value corresponding to each trading day is generated.
  11. 如权利要求10所述的基于机器学习的股票择时方法,其特征在于,所述预先确定的聚类算法为k-means聚类算法;所述步骤S300包括如下步骤:The machine learning-based stock timing method according to claim 10, wherein the predetermined clustering algorithm is a k-means clustering algorithm; and the step S300 comprises the following steps:
    E2、分别假设n个对象以及簇的数目,所述n个对象为获取的各个交易日对应的走势因子值,所述簇的数目为预定义的k类走势类别,其中n≥k,且均为正整数;E2, respectively, assuming n objects and a number of clusters, wherein the n objects are trend factor values corresponding to the acquired respective trading days, and the number of the clusters is a predefined k-category trend category, wherein n≥k, and both Is a positive integer;
    F2、从所述n个对象中任意选取k个对象分别作为预定义的初始簇,k个对象分别为预定义的初始簇的平均值;F2, arbitrarily selecting k objects from the n objects as pre-defined initial clusters, and k objects are respectively average values of pre-defined initial clusters;
    G2、分别计算所述n个对象与各个初始簇的平均值之间的欧几里得距离,并根据计算结果,将所述n个对象分别赋予对应欧几里得距离最小的簇;G2, respectively calculating a Euclidean distance between the average values of the n objects and each of the initial clusters, and according to the calculation result, respectively assigning the n objects to the cluster corresponding to the smallest Euclidean distance;
    H2、重新计算各个簇的平均值,并重复执行上述步骤G2,直至预定义的准则函数收敛,则聚类结束。H2, recalculate the average value of each cluster, and repeat step G2 above until the predefined criterion function converges, then the cluster ends.
  12. 如权利要求11所述的基于机器学习的股票择时方法,其特征在于,所述预定义的准则函数为平方误差准则函数,所述平方误差准则函数为:The machine learning-based stock timing method according to claim 11, wherein the predefined criterion function is a square error criterion function, and the square error criterion function is:
    Figure PCTCN2018102224-appb-100002
    Figure PCTCN2018102224-appb-100002
    其中,E是n个交易日对应的走势因子值构成的所有对象的平方误差的总和,p是n个交易日的走势因子,mi是簇Ci的平均值。Where E is the sum of the squared errors of all objects consisting of the trend factor values corresponding to n trading days, p is the trend factor of n trading days, and mi is the average of the cluster Ci.
  13. 如权利要求9所述的基于机器学习的股票择时方法,其特征在于,所述走势因子值对应为不同K线形态中的点,所述走势因子值对应的走势类别 包括不同的K线形态。The machine learning-based stock timing method according to claim 9, wherein the trend factor value corresponds to a point in a different K-line form, and the trend category corresponding to the trend category includes different K-line forms. .
  14. 如权利要求10所述的基于机器学习的股票择时方法,其特征在于,所述走势因子值对应为不同K线形态中的点,所述走势因子值对应的走势类别包括不同的K线形态。The machine learning-based stock timing method according to claim 10, wherein the trend factor value corresponds to a point in a different K-line form, and the trend factor value corresponding to the trend category includes different K-line forms. .
  15. 如权利要求11所述的基于机器学习的股票择时方法,其特征在于,所述走势因子值对应为不同K线形态中的点,所述走势因子值对应的走势类别包括不同的K线形态。The machine learning-based stock timing method according to claim 11, wherein the trend factor value corresponds to a point in a different K-line form, and the trend factor value corresponding to the trend category includes different K-line forms. .
  16. 如权利要求12所述的基于机器学习的股票择时方法,其特征在于,所述走势因子值对应为不同K线形态中的点,所述走势因子值对应的走势类别包括不同的K线形态。The machine learning-based stock timing method according to claim 12, wherein the trend factor value corresponds to a point in a different K-line form, and the trend factor value corresponding to the trend category includes different K-line forms. .
  17. 一种计算机可读存储介质,所述计算机可读存储介质存储有基于机器学习的股票择时程序,所述基于机器学习的股票择时程序可被至少一个处理器执行,以使所述至少一个处理器执行如下步骤:A computer readable storage medium storing a machine learning based stock timing program, the machine learning based stock timing program being executable by at least one processor to cause the at least one The processor performs the following steps:
    获取预先确定的股票市场指数在预设时间段内的各交易日对应的预设类型指标因子;Obtaining a preset type index factor corresponding to each trading day of the predetermined stock market index within a preset time period;
    根据预先训练完成的择时策略分析模型分别对获取的各交易日的预设类型指标因子进行分析,以输出各交易日对应的走势因子值;According to the timing analysis strategy model completed by the pre-training, the preset type index factors of each acquired trading day are respectively analyzed to output the trend factor values corresponding to each trading day;
    根据预先确定的聚类算法对各交易日对应的走势因子值进行聚类分析,以得到各交易日的走势因子值对应的走势类别;Perform cluster analysis on the trend factor values corresponding to each trading day according to a predetermined clustering algorithm to obtain a trend category corresponding to the trend factor value of each trading day;
    根据得到的各交易日的走势因子值对应的走势类别,确定择时交易策略。The timing trading strategy is determined according to the trend category corresponding to the trend factor value of each trading day obtained.
  18. 如权利要求17所述的存储介质,其特征在于,所述预先训练完成的择时策略分析模型为循环神经网络模型;所述循环神经网络包括输入层、隐藏层、以及输出层;所述输入层用于输入预设时间段内各交易日对应的预设类型指标因子;所述输出层用于输出预设时间段内的相对收益率;所述隐藏层包含多层神经元,且各神经元的各个节点之间存在互连的作用,用于将所述输入层输入的预设类型指标因子通过神经元训练学习变换之后,生成各交易日对应的走势因子值。The storage medium according to claim 17, wherein said pre-trained completion timing analysis model is a cyclic neural network model; said cyclic neural network comprises an input layer, a hidden layer, and an output layer; said input The layer is configured to input a preset type indicator factor corresponding to each trading day in the preset time period; the output layer is configured to output a relative rate of return in the preset time period; the hidden layer comprises a plurality of layers of neurons, and each nerve There is an interconnection function between the nodes of the element, and the preset type index factor input by the input layer is transformed by the neuron training learning, and the trend factor value corresponding to each trading day is generated.
  19. 如权利要求2所述的电子装置,其特征在于,所述预先确定的聚类算法为k-means聚类算法;所述根据预先确定的聚类算法对各交易日对应的走势因子值进行聚类分析,以得到各交易日的走势因子值对应的走势类别的步骤包括:The electronic device according to claim 2, wherein the predetermined clustering algorithm is a k-means clustering algorithm; and the clustering factor corresponding to each trading day is aggregated according to a predetermined clustering algorithm The steps of class analysis to obtain the trend category corresponding to the trend factor value of each trading day include:
    E1、分别假设n个对象以及簇的数目,所述n个对象为获取的各个交易日对应的走势因子值,所述簇的数目为预定义的k类走势类别,其中n≥k,且均为正整数;E1, respectively, assuming n objects and a number of clusters, wherein the n objects are trend factor values corresponding to the acquired respective transaction days, and the number of the clusters is a predefined k-type trend category, wherein n≥k, and both Is a positive integer;
    F1、从所述n个对象中任意选取k个对象分别作为预定义的初始簇,k个对象分别为预定义的初始簇的平均值;F1, arbitrarily selecting k objects from the n objects as pre-defined initial clusters, and k objects are respectively average values of pre-defined initial clusters;
    G1、分别计算所述n个对象与各个初始簇的平均值之间的欧几里得距离,并根据计算结果,将所述n个对象分别赋予对应欧几里得距离最小的簇;G1, respectively calculating a Euclidean distance between the average values of the n objects and each initial cluster, and according to the calculation result, respectively assigning the n objects to the cluster corresponding to the smallest Euclidean distance;
    H1、重新计算各个簇的平均值,并重复执行上述步骤G1,直至预定义的准则函数收敛,则聚类结束。H1, recalculate the average value of each cluster, and repeat the above step G1 until the predefined criterion function converges, then the cluster ends.
  20. 如权利要求19所述的存储介质,其特征在于,所述预定义的准则函数为平方误差准则函数,所述平方误差准则函数为:The storage medium of claim 19 wherein said predefined criterion function is a squared error criterion function, said squared error criterion function is:
    Figure PCTCN2018102224-appb-100003
    Figure PCTCN2018102224-appb-100003
    其中,E是n个交易日对应的走势因子值构成的所有对象的平方误差的总和,p是n个交易日的走势因子,mi是簇Ci的平均值。Where E is the sum of the squared errors of all objects consisting of the trend factor values corresponding to n trading days, p is the trend factor of n trading days, and mi is the average of the cluster Ci.
PCT/CN2018/102224 2018-04-26 2018-08-24 Electronic device, machine learning-based stock trade timing method and storage medium WO2019205384A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810387139.4A CN108764291A (en) 2018-04-26 2018-04-26 Method and storage medium when electronic device, the stock based on machine learning are selected
CN201810387139.4 2018-04-26

Publications (1)

Publication Number Publication Date
WO2019205384A1 true WO2019205384A1 (en) 2019-10-31

Family

ID=64012111

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/102224 WO2019205384A1 (en) 2018-04-26 2018-08-24 Electronic device, machine learning-based stock trade timing method and storage medium

Country Status (2)

Country Link
CN (1) CN108764291A (en)
WO (1) WO2019205384A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113435623A (en) * 2020-03-23 2021-09-24 北京沃东天骏信息技术有限公司 Early warning method and device

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110895585B (en) * 2019-10-18 2022-08-23 深圳市富途网络科技有限公司 Stock data acquisition method and device, terminal equipment and storage medium
CN111402042B (en) * 2020-02-17 2023-10-27 中信建投证券股份有限公司 Data analysis and display method for stock market big disk shape analysis
CN111429272B (en) * 2020-02-20 2023-08-22 中信建投证券股份有限公司 Method and device for automatically generating quantized transaction factors and importance judgment
CN114638701A (en) * 2022-03-28 2022-06-17 中国银行股份有限公司 Method and device for analyzing cost performance of stocks and debts

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106952161A (en) * 2017-03-31 2017-07-14 洪志令 A kind of recent forward prediction method of stock based on shot and long term memory depth learning network
CN107832897A (en) * 2017-11-30 2018-03-23 浙江工业大学 A kind of Stock Price Forecasting method based on deep learning
CN107844865A (en) * 2017-11-20 2018-03-27 天津科技大学 Feature based parameter chooses the stock index prediction method with LSTM models

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106952161A (en) * 2017-03-31 2017-07-14 洪志令 A kind of recent forward prediction method of stock based on shot and long term memory depth learning network
CN107844865A (en) * 2017-11-20 2018-03-27 天津科技大学 Feature based parameter chooses the stock index prediction method with LSTM models
CN107832897A (en) * 2017-11-30 2018-03-23 浙江工业大学 A kind of Stock Price Forecasting method based on deep learning

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
WANG, GUORUI: "Time Series Data Clustering Algorithm based on Recurrent Neural Network and Its Parallelization", ELECTRONIC TECHNOLOGY & INFORMATION SCIENCE, no. 2, 15 February 2018 (2018-02-15) *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113435623A (en) * 2020-03-23 2021-09-24 北京沃东天骏信息技术有限公司 Early warning method and device

Also Published As

Publication number Publication date
CN108764291A (en) 2018-11-06

Similar Documents

Publication Publication Date Title
WO2019205384A1 (en) Electronic device, machine learning-based stock trade timing method and storage medium
Li et al. Deep robust reinforcement learning for practical algorithmic trading
Li et al. Online portfolio selection: A survey
US10152752B2 (en) Methods and systems for computing trading strategies for use in portfolio management and computing associated probability distributions for use in option pricing
Huang et al. Robust median reversion strategy for online portfolio selection
WO2019019346A1 (en) Asset allocation strategy acquisition method and apparatus, computer device, and storage medium
CN112988840A (en) Time series prediction method, device, equipment and storage medium
WO2019192135A1 (en) Electronic device, bond yield analysis method, system, and storage medium
Golub et al. Multi-scale representation of high frequency market liquidity
US20180060959A1 (en) Option pricing
El-Berawi et al. Adaptive deep learning based cryptocurrency price fluctuation classification
US20220044325A1 (en) Option pricing
US20210103990A1 (en) Automated real time mortgage servicing and whole loan valuation
Yang et al. Applying k-means technique and decision tree analysis to predict Taiwan ETF performance
Shu Identification and forecasts of bubbles and crashes in stock market
Gaete et al. Diversification benefits of commodities in portfolio allocation: A dynamic factor copula approach
CN112200389A (en) Data prediction method, device, equipment and storage medium
Rahimi Forecast comparison of financial models
US20240221069A1 (en) Determining implied interest rates based on cryptoasset derivative trade data
Verma et al. Automated Stock Trading using Machine Learning Approaches
Chorro et al. Testing for leverage effect in financial returns
US20240242120A1 (en) System, method, and computer program product for time series forecasting using integrable multivariate pattern matching
Olsen et al. Forecasting implied volatilities of currency options with machine learning techniques and econometrics models
Yahayah Modelling and Forecasting of the Nigerian Stock Exchange.
Agnihotri et al. Next-Generation Stock Market Prediction: Integrating CNN and LSTM Model

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18916212

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 08.02.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18916212

Country of ref document: EP

Kind code of ref document: A1