A stock screening method and system based on real-time market conditions

By receiving and decoding the original data of the exchange, sending it to Kafka and updating it to Elasticsearch, the problem that stock indicator data cannot be updated in real time in the existing technology is solved, and efficient stock screening based on real-time market conditions is achieved, and the accuracy of investment decisions is improved.

CN114331714BActive Publication Date: 2025-02-28YINGLI DIGITAL TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111497567.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-09
Publication Date
2025-02-28
Estimated Expiration
2041-12-09

AI Technical Summary

Technical Problem

The existing technology cannot achieve real-time update of stock index data, resulting in a certain deviation from the real-time market during stock selection, which may cause users to lose investment.

Method used

By receiving the original data from the exchange, decoded and converted into custom market data, sent to the Kafka message middleware, and then the Elasticsearch distributed search engine updates the stock's indicator data in real time, and uses Elasticsearch's efficient search function to perform stock screening.

Benefits of technology

Realize stock screening based on real-time market conditions, ensure real-time update of indicator data, reduce data deviations during stock selection, and improve the accuracy of investment decisions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114331714B_ABST
    Figure CN114331714B_ABST
Patent Text Reader

Abstract

The present invention provides a stock screening method and system based on real-time market conditions, and relates to the technical field of market data processing. The method comprises the following steps: S1, receiving raw data from an exchange, and providing a query interface for financial indicator data of all codes; S2, updating the indicator data of stocks to Elasticsearch, which is a distributed, highly scalable, and highly real-time search and data analysis engine; S3, calling a stock selection interface, and returning the stock screening result after screening the stocks. By timely updating the real-time market data to Elasticsearch and utilizing the efficient search function of Elasticsearch, stock screening based on real-time market conditions is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of market data processing, and in particular, to a stock screening method and system based on real-time market conditions. Background Art

[0002] There are dozens to hundreds of indicator data for stocks, such as stock price, market value, return on assets, return on net assets, price-earnings ratio, etc. It is necessary to filter out the stocks that users need based on several indicators.

[0003] The existing technical solution is to use MySQL to regularly store stock index data. However, during the trading phase, the stock market is constantly changing, and the stock index data in MySQL cannot be updated in real time. During the stock selection process, the index data has a certain deviation from the real-time market, which may cause investment losses to users and fail to meet user needs. Summary of the invention

[0004] In order to overcome the deficiencies of the prior art, the present invention provides a stock screening method and system based on real-time market conditions to solve the above-mentioned technical problems.

[0005] The technical method adopted by the present invention to solve its technical problem is: a stock screening method based on real-time market conditions, and its improvement lies in: comprising the following steps: S1, receiving the original data of the exchange, and providing a query interface for the financial indicator data of all codes; S2, updating the indicator data of the stock to Elasticsearch, which is a distributed, highly scalable, and highly real-time search and data analysis engine; S3, calling the stock selection interface, and returning the stock screening result after screening the stocks.

[0006] In the above method, step S1 comprises the following steps:

[0007] S11. The market decoding service system receives the original data of the exchange from the network, decodes the data into customized market data, and converts it into Pb data format. Pb is protobuf, which is a mechanism for realizing automatic data serialization and deserialization developed by Google.

[0008] S12. Call the Kafka client library to send Pb data to Kafka. Kafka is a high-throughput distributed publish-subscribe messaging system.

[0009] S13. The indicator data service system calls the Beego library to start the HTTP service and provide a query interface for the financial indicator data of all market codes. Beego is an open source HTTP framework based on Golang. HTTP is a network communication protocol.

[0010] In the above method, step S2 comprises the following steps:

[0011] S21, the stock picker data service system initiates an HTTP request to the indicator data service system, queries and obtains the financial indicator data of all codes, uses the code as the key, and stores it in a hash table;

[0012] S22. Call the Kafka client library to connect to Kafka, consume real-time Pb data, and use the Pb library to parse the Pb data into custom market data;

[0013] S23, using the code in the custom market data as a key, querying the hash table to obtain the financial indicator data of the code, and merging the custom market data with the financial indicator data to obtain complete indicator data;

[0014] S24. Call the Elasticsearch client library to connect to Elasticsearch, and insert the complete indicator data into Elasticsearch.

[0015] In the above method, step S3 comprises the following steps:

[0016] S31. The stock query service system calls the Beego library to start the HTTP service, receives the HTTP stock selection request, and calls the Json library to parse the stock selection parameters;

[0017] S32, calling the Elasticsearch client library to connect to Elasticsearch, using the parsed stock selection parameters, sending a search request to Elasticsearch;

[0018] S33. Return search results.

[0019] The present invention also provides a stock screening system based on real-time market conditions, including a market decoding service system, an index data service system, a stock selector data service system and a stock query service system.

[0020] The market decoding service system is used to receive the original data of the exchange from the network, decode the data into customized market data, and convert it into Pb data format, call the Kafka client library, and send the Pb data to Kafka;

[0021] The indicator data service system is used to call the Beego library, start the HTTP service, and provide a query interface for the financial indicator data of all market symbols;

[0022] The stock picker data service system is connected to the indicator data service system, and is used to initiate an HTTP request to the indicator data service system to query and obtain the financial indicator data of all codes, using the code as the key and storing it in a hash table; and calling the Kafka client library to connect to Kafka, consume real-time Pb data, use the Pb library to parse the Pb data into custom market data, use the code in the custom market data as the key, query the hash table, obtain the financial indicator data of the code, merge the custom market data and the financial indicator data, obtain the complete indicator data, call the Elasticsearch client library to connect to Elasticsearch, and insert the complete indicator data into Elasticsearch;

[0023] The stock query service system is used to call the Beego library to start the HTTP service, receive the HTTP stock selection request, call the Json library to parse the stock selection parameters; and call the Elasticsearch client library to connect to Elasticsearch, use the parsed stock selection parameters, send a search request to Elasticsearch, and return the search results.

[0024] The beneficial effect of the present invention is that by timely updating the real-time market data to Elasticsearch and utilizing the efficient search function of Elasticsearch, stock screening based on real-time market conditions is achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Attached Figure 1 The present invention is a flow chart of a stock screening method based on real-time market conditions. DETAILED DESCRIPTION

[0026] The present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0027] The following will clearly and completely describe the concept, specific structure and technical effects of the present invention in combination with the embodiments and drawings, so as to fully understand the purpose, characteristics and effects of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, other embodiments obtained by technicians in this field without creative work are all within the scope of protection of the present invention. In addition, all the connection / connection relationships involved in the patent do not refer to the direct connection of components, but refer to the formation of a better connection structure by adding or reducing connection accessories according to the specific implementation situation. The various technical features in the invention can be combined interchangeably without conflicting with each other.

[0028] Reference Figure 1A stock screening method based on real-time market conditions of the present invention comprises the following steps:

[0029] S1. Receive the original data from the exchange and provide a query interface for the financial indicator data of all codes;

[0030] Specifically, the following steps are included:

[0031] S11. The market decoding service system receives the original data of the exchange from the network, decodes the data into customized market data, and converts it into Pb data format. Pb is protobuf, which is a mechanism for realizing automatic data serialization and deserialization developed by Google.

[0032] S12, calling the Kafka client library to send the Pb data to Kafka. Kafka is a high-throughput distributed publish-subscribe messaging system. Kafka is used as a messaging middleware in the present invention to store real-time market information.

[0033] S13. The indicator data service system calls the Beego library, starts the HTTP service, and provides a query interface for the financial indicator data of all market codes. It provides a query service for the financial indicator data of all market codes. Beego is an open source HTTP framework implemented based on Golang. HTTP is a network communication protocol.

[0034] S2. Update the index data of stocks to Elasticsearch. Elasticsearch is a distributed, highly scalable, and highly real-time search and data analysis engine. Elasticsearch is used in the present invention to store the index data of stocks and is continuously updated by the stock picker data service system.

[0035] Specifically, the steps include:

[0036] S21. The stock picker data service system initiates an HTTP request to the indicator data service system to query and obtain the financial indicator data of all codes, using the code as the key and storing it in a hash table, and the financial indicator data is packaged into a structure as the value;

[0037] S22. Call the Kafka client library to connect to Kafka, consume real-time Pb data, and use the Pb library to parse the Pb data into custom market data;

[0038] S23, using the code in the custom market data described in step S22 as a key, querying the hash table to obtain the financial indicator data of the code, and merging the custom market data and the financial indicator data to obtain complete indicator data;

[0039] S24. Call the Elasticsearch client library to connect to Elasticsearch, and insert the complete indicator data described in step S23 into Elasticsearch.

[0040] S3. Call the stock selection interface, filter the stocks and return the stock screening results.

[0041] Specifically, the following steps are included:

[0042] S31. The stock query service system calls the Beego library to start the HTTP service, receives the HTTP stock selection request, and calls the Json library to parse the stock selection parameters;

[0043] S32, calling the Elasticsearch client library to connect to Elasticsearch, using the parsed stock selection parameters, sending a search request to Elasticsearch;

[0044] S33. Return the search result, which is the stock selection result based on the real-time market conditions, thereby realizing fast stock selection.

[0045] This method stores the index data of stocks for stock selection. During the opening trading period, the fast reading and writing capabilities of Kafka and Elasticsearch are used to update the real-time market data to Elasticsearch in a timely manner. The efficient search function of Elasticsearch is used to achieve fast stock selection, and the stock selection results are based on real-time market conditions.

[0046] The present invention also provides a stock screening system based on real-time market conditions, including a market decoding service system, an index data service system, a stock selector data service system and a stock query service system.

[0047] The market decoding service system is used to receive the original data of the exchange from the network, decode the data into customized market data, and convert it into Pb data format, call the Kafka client library, and send the Pb data to Kafka;

[0048] The indicator data service system is used to call the Beego library, start the HTTP service, and provide a query interface for the financial indicator data of all market symbols;

[0049] The stock picker data service system is connected to the indicator data service system, and is used to initiate an HTTP request to the indicator data service system to query and obtain the financial indicator data of all codes, using the code as the key and storing it in a hash table; and calling the Kafka client library to connect to Kafka, consume real-time Pb data, use the Pb library to parse the Pb data into custom market data, use the code in the custom market data as the key, query the hash table, obtain the financial indicator data of the code, merge the custom market data and the financial indicator data, obtain the complete indicator data, call the Elasticsearch client library to connect to Elasticsearch, and insert the complete indicator data into Elasticsearch;

[0050] The stock query service system is used to call the Beego library to start the HTTP service, receive the HTTP stock selection request, call the Json library to parse the stock selection parameters; and call the Elasticsearch client library to connect to Elasticsearch, use the parsed stock selection parameters, send a search request to Elasticsearch, and return the search results.

[0051] The present invention timely updates the real-time market data to Elasticsearch and utilizes the efficient search function of Elasticsearch to achieve stock screening based on real-time market conditions.

[0052] The above is a specific description of the preferred implementation of the present invention, but the invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.

Claims

1. A stock screening method based on real-time market conditions, characterized in that: The steps include: S1. Receive the original data from the exchange and provide a query interface for the financial indicator data of all codes, including: S11. The market decoding service system receives the original data from the exchange from the network, decodes the data into custom market data, and converts it into Pb data format. Pb is protobuf, which is Google's open source mechanism for automatic data serialization and deserialization; S12. Call the Kafka client library to send Pb data to Kafka. Kafka is a high-throughput distributed publish-subscribe messaging system; S13. The indicator data service system calls the Beego library, starts the HTTP service, and provides a query interface for the financial indicator data of all market codes. Beego is an open source HTTP framework based on Golang. HTTP is a network communication protocol; S2. Update the index data of stocks to Elasticsearch. Elasticsearch is a distributed, highly scalable, and highly real-time search and data analysis engine, including: S21. The stock selector data service system initiates an HTTP request to the index data service system to query and obtain the financial index data of all codes, using the code as the key and storing it in a hash table, and the financial index data is packaged as a structure as the value; S22. Call the Kafka client library to connect to Kafka, consume real-time Pb data, and use the Pb library to parse the Pb data into custom market data; S23. Use the code in the custom market data as the key to query the hash table to obtain the financial index data of the code, merge the custom market data and the financial index data to obtain complete index data; S24. Call the Elasticsearch client library to connect to Elasticsearch, and insert the complete index data into Elasticsearch; S3. Call the stock selection interface, filter the stocks and return the stock screening results, including: S31. The stock query service system calls the Beego library to start the HTTP service, receives the HTTP stock selection request, and calls the Json library to parse the stock selection parameters; S32. Call the Elasticsearch client library to connect to Elasticsearch, use the parsed stock selection parameters, and send a search request to Elasticsearch; S33. Return the search results.

2. A stock screening system based on real-time market conditions, characterized by: Including market decoding service system, index data service system, stock picker data service system and stock query service system, The market decoding service system is used to receive the original data of the exchange from the network, decode the data into customized market data, and convert it into Pb data format, call the Kafka client library, and send the Pb data to Kafka; The indicator data service system is used to call the Beego library, start the HTTP service, and provide a query interface for the financial indicator data of all market symbols; The stock picker data service system is connected to the indicator data service system, and is used to initiate an HTTP request to the indicator data service system, query and obtain the financial indicator data of all codes, use the code as the key, store in a hash table, and package the financial indicator data into a structure as the value; and call the Kafka client library to connect to Kafka, consume real-time Pb data, use the Pb library to parse the Pb data into custom market data, use the code in the custom market data as the key, query in the hash table, obtain the financial indicator data of the code, merge the custom market data and the financial indicator data, obtain the complete indicator data, call the Elasticsearch client library to connect to Elasticsearch, and insert the complete indicator data into Elasticsearch; The stock query service system is used to call the Beego library to start the HTTP service, receive the HTTP stock selection request, call the Json library to parse the stock selection parameters; and call the Elasticsearch client library to connect to Elasticsearch, use the parsed stock selection parameters, send a search request to Elasticsearch, and return the search results.

Citation Information

Patent Citations

  • Information type manipulation automatic identification method based on multi-channel heterogeneous data

    CN110738570A

  • Method and device for calculating fund estimation value and risk index in real time and readable medium

    CN112365355A