A multi-market data query method, system and device
By pre-constructing a multi-market data query location set, the problems of slow query speed and insufficient accuracy caused by the growth of data volume in existing technologies are solved, and efficient and fast multi-market data query is achieved.
Patent Information
- Application Number
- CN202211499063.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-28
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2042-11-28
AI Technical Summary
Existing technologies, when querying multi-market data, suffer from slow response times, low efficiency, and insufficient accuracy as the query scope and filtering parameters increase.
By pre-constructing a multi-market data query location set, the first dataset is obtained from the target data source. Based on the query conditions, the multi-market data query location set is matched and constructed, narrowing the data range and storing only product codes and sorting position information, thereby reducing the amount of data and improving query efficiency.
It significantly improves query response speed and accuracy, reduces data processing volume, and maintains almost unchanged response time, especially in frequent or multi-market queries, while optimizing user experience and stability.
Smart Images

Figure CN115718768B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data processing technology, and specifically relates to a method, system and device for multi-market data query. Background Technology
[0002] With the continuous development of information technology, big data querying has been widely applied to varying degrees in different industries, especially in the financial sector. Not only are there increasingly more data sources, but the demand for multi-market data querying and comparison is also strong. This places higher demands on data processing efficiency, data filtering accuracy, and rapid query response. Currently, although multi-data source and multi-market querying functions are already possible, existing technologies have many areas for optimization. For example, current query operations require processing large amounts of data, especially as the query scope expands and the number of markets queried increases, leading to a significant increase in data volume. Furthermore, the number of query loops also increases rapidly with the expansion of the query scope. As the query scope and filtering parameters increase, the response speed is directly affected. Clearly, with the ever-increasing data volume, it is impossible to meet the requirements for improving data processing efficiency and rapid query response.
[0003] Therefore, optimizing data query processing methods to minimize the impact of data volume on query operations, reduce data processing volume, improve query processing efficiency, shorten query response time, and improve the accuracy of query results are problems that need to be solved. Summary of the Invention
[0004] In view of the above problems, this application provides a multi-market data query method, system and apparatus to solve the above technical problems.
[0005] This application provides the following technical solutions:
[0006] Firstly, this application provides a method for querying multi-market data, the method comprising:
[0007] Obtain the first dataset from the target data source;
[0008] Based on the first dataset, a multi-market data query location set matching the query conditions is constructed in advance;
[0009] Obtain the query instruction, select output data from the matched multi-market data query location set according to the query instruction, and output the query results;
[0010] The target data source is the initial data source, i.e., the data source for multi-market data queries. The data includes, but is not limited to: market codes and their associated data, product codes in the market and their associated data, and the storage location of the associated data.
[0011] The market code includes the code of the market and the codes of all products belonging to that market; the associated data of the market code includes the associated data of the market code and the associated data of all product codes belonging to that market.
[0012] The product code, the associated data of the product code, and the storage location of the associated data are mutually related data and together form a set of data;
[0013] Specifically, after obtaining a product code, you can obtain the associated data of that product code and the storage location of the associated data;
[0014] The market refers to a product trading market, including but not limited to: securities or futures exchanges; such as the Shanghai Stock Exchange, Shanghai Futures Exchange, Shenzhen Stock Exchange, Hong Kong Stock Exchange, and US stock exchanges; the market code is an identification code for that market at the data processing level; the associated data of the market code is all data related to that market at the data processing level.
[0015] The product refers to specific products included in the market, including but not limited to: securities or futures; the product code is the identification code of the product at the data processing level; the associated data of the product code is all data related to the product at the data processing level.
[0016] Specifically, at the data processing level, the market code and its associated data are all labeled with the same identification code for the market and its contained data, or the market code is associated with the data contained in the market. Similarly, at the data processing level, the product code and its associated data are all labeled with the same identification code for the product and its contained data, or the product code is associated with the data contained in the product. This significantly improves the integrity and efficiency of data processing for the market and product, as well as the specific data contained in the market and product, throughout the entire data processing process.
[0017] The first dataset is a snapshot of the target data source, i.e., a copy of the data from the target data source at a certain moment; it also includes market codes and their associated data, product codes in the market and their associated data, as well as the storage location of the above specific data.
[0018] Specifically, the snapshot information of the target data source is the snapshot information of market conditions for all markets, which is the latest market information of all products in all markets within the target data source; the market information is also part of the associated data, such as the latest price, highest price, lowest price, opening price, trading volume, trading value, buy and sell levels, price change, and price change percentage of all products.
[0019] The query conditions are preset query-related filtering parameters and sorting rules;
[0020] The multi-market data query location set is the data sorting result of all markets and each individual market constructed based on the first dataset;
[0021] The query command refers to the filtering parameters and sorting rules specified during the query.
[0022] The query results are the returned data obtained according to the specific requirements of the query instruction;
[0023] This application obtains a first dataset from the target data source and, based on the first dataset, pre-constructs a multi-market data query location set that matches the query conditions. This allows for the pre-construction of data sorting results for all markets and each individual market before the query, which not only provides more accurate query results for subsequent query operations but also significantly shortens the response time of the query operation and improves query efficiency.
[0024] Furthermore, the step of pre-constructing a multi-market data query location set matching the query conditions based on the first dataset includes:
[0025] Get the first query condition;
[0026] From the first dataset, extract all market codes related to the first query condition, the associated data of the market codes, and the storage location of the specific data to form the second dataset;
[0027] From the second dataset, based on the different filtering parameters in the first query condition, the first list data corresponding to the filtering parameters are extracted respectively, and the extracted first list data are sorted according to the sorting rules corresponding to the filtering parameters. The sorting position information of the first list data is marked according to the sorting result, and then the sorting position information is used to form the first list.
[0028] The first list is divided into two markets. Data is extracted from each market to form a second list for each market. Each second list is then sorted separately according to the same sorting rules as the first list. The sorting position information is then combined with the corresponding sorting position information in the first list to form a second list. The number of the second lists is the number of markets.
[0029] The first list that meets the same filtering parameters and its corresponding second lists within multiple markets are combined to form a multi-market data query location set.
[0030] The first query condition is a preset query-related filtering parameter and sorting rule, that is, various filtering parameters set by the query terminal and their corresponding sorting rules;
[0031] Specifically, the first query condition changes its content according to the preset query filtering rules and parameters of the query terminal; that is, the first query condition corresponds one-to-one with the content that the query terminal can query. The second dataset differs from the first dataset in that the first dataset is a direct copy of the target data source at a certain moment, while the second dataset is a subset of data extracted from the first dataset based on the first query condition—that is, data related to the first query condition. For example, if the first dataset contains a product code in a certain market and its associated data, then the data extracted from the second dataset is the portion of that product code and its associated data that is related to the first query condition.
[0032] Since obtaining a product code allows access to its associated data and storage location, subsequent extraction, filtering, and sorting of all products from all markets in the second dataset suffices to create both the first and second lists. This eliminates the need to store the product code and its corresponding sorting position information, thus enabling operations on the associated data. This significantly reduces the amount of data processed and improves efficiency, resulting in a much faster response time for subsequent queries.
[0033] The first list data consists of specific data related to a certain filtering parameter in the second dataset and all product codes in all corresponding markets.
[0034] The second list data is obtained by dividing the first list data according to individual markets, into second list data for each market. All markets correspond to one first list data, and each market corresponds to one second list data.
[0035] Specifically, the first list data is sorted according to the sorting rules corresponding to the filtering parameter. This sorting is only performed on the data in the associated data of each product code that are consistent with the filtering parameter. The first list obtained is also the sorted result set corresponding to the data that are consistent with the filtering parameter. In other words, different filtering parameters correspond to different first list data, and thus different first lists will be generated. The number of filtering parameters determines the number of first lists generated.
[0036] The second list has the same filtering parameters and sorting rules as the first list. That is, under the same filtering parameters, a first list containing all market codes and multiple second lists containing single market codes together form a multi-market data query location set; one filtering parameter corresponds to one multi-market data query location set.
[0037] This application employs a method of pre-constructing a multi-market data query location set. Starting from a first dataset, the data range is progressively narrowed. First, a second dataset matching the first query condition is extracted. Then, based on filtering parameters and sorting rules, a first list and multiple corresponding second lists are generated from the second dataset, collectively forming the multi-market data query location set. This layered extraction of the original data not only makes the final multi-market data query location set more accurate but also further reduces the data volume because the first and second lists in the multi-market data query location set only contain product codes and their corresponding sorting position information. This further improves the efficiency of data processing during subsequent queries, significantly increasing the response speed of query operations. Therefore, this application not only improves the efficiency of multi-market data queries but also further enhances the accuracy of query results.
[0038] Furthermore, the step of obtaining the query instruction and selecting output data from the matched multi-market data query location set according to the query instruction, and outputting the query results, includes:
[0039] Retrieve the second query condition from the query command;
[0040] Based on the second query condition, match the multiple market data query location sets with the same filter parameters;
[0041] In the set of matched multi-market data query locations, relevant data is extracted and sorted according to the second query condition to form the returned data output query results;
[0042] The query instruction is the instruction and related information issued during the query operation; the second query condition is the parameter related to the multi-market data query location set that matches the same filtering parameters.
[0043] Furthermore, obtaining the second query condition from the query instruction includes:
[0044] From the query instruction, the query scope is determined, namely the market code and market quantity to be queried, and keywords related to the first query condition are extracted, and specific filtering parameters and sorting rules are parsed out.
[0045] Specifically, since a set of multi-market data query locations corresponding to each filtering parameter has already been constructed in the early stages, subsequent queries only require determining the filtering parameters, sorting rules, and query range in the query command. Then, the query location set with the same filtering parameters is directly matched. Within this matched set, either the first or second list is selected based on the query range. Simple operations on the selected first or second list immediately return the data and output the query results. Thus, the entire query process only requires retrieving the first or second list from the pre-constructed multi-market data query location set according to specific needs. This application obtains the required data without using existing query methods. It directly queries the target data source and then identifies and filters the data layer by layer from the target data source. Therefore, compared with existing query methods, this application not only greatly reduces the actual amount of data processing, but also simplifies the data operations required after obtaining the query command, resulting in extremely fast query response. This advantage is even more pronounced when query operations are frequent or when there are many queryers. Furthermore, since the multi-market data query location set is constructed from multi-market data, the number of markets has little impact on the query response time. That is, the query response time remains almost unchanged as the number of markets increases in the later stages.
[0046] In summary, this application can guarantee a low response time, a small amount of data to be processed, a short processing time, and a fast return of query results even when query operations are frequent, the number of queryers is large, and the number of markets being queried is large.
[0047] Furthermore, the step of extracting and sorting relevant data from the matched multi-market data query location set according to the second query condition to form the returned data output query result includes:
[0048] Based on the query scope in the second query condition, relevant data from the first or second list of the matched multi-market data query location set is extracted, as follows:
[0049] (1) When the query range is a single market, first obtain the second list of the corresponding markets in the matched multi-market data query location set, perform synchronization operation on it, then select the output data, form the return data, and output the query results;
[0050] The synchronization operation is to determine whether the sorting rule in the second list is the same as the sorting rule in the second query condition. If they are the same, no operation is performed and the output data is returned directly. If they are opposite, the second list is reversed and the processed output data is returned.
[0051] The returned data is the final data after the selected second list is processed synchronously and then the output data is selected, that is, the product codes and their corresponding data arranged according to the sorting rules required by the second query condition, as well as other associated data to be output;
[0052] (2) When the query range is multiple markets, it is divided into cases:
[0053] a. If the query range is all markets, first obtain the first list in the set of query positions of the matched multiple-market data, perform a synchronization operation on it, then select the output data, form the returned data, and output the query result;
[0054] b. If the query range is partial markets, first determine the market codes of the query range, and obtain the second list of the corresponding multiple markets in the set of query positions of the matched multiple-market data, perform a synchronization operation on it, then select the output data, generate the required returned data, and output the query result;
[0055] Furthermore, the selection of the output data includes:
[0056] Suppose there are a total of S markets, the query range is X markets, and the query result needs to output the first Y product codes and their corresponding data, that is, the query result to be output is: under a certain screening parameter, among the X markets, the first Y product codes and their corresponding data according to a certain sorting rule; then the method for selecting the output data is as follows:
[0057] (1) If X = 1, indicating that the query range is a single market, when selecting the output data, directly select the first Y product codes and their corresponding data in the required second list;
[0058] (2) If X = S, indicating that the query range is all markets, when selecting the output data, directly select the first Y product codes and their corresponding data in the required first list;
[0059] (3) If 1 < X < S, indicating that the query range is partial markets, the method is as follows:
[0060] Label the second list of the X markets in the query range as the second list numbered 1 - X in sequence;
[0061] Extract the product codes and their corresponding data at the forefront of the sorting in the second list numbered 1 - X, that is, extract a total of X groups of data;
[0062] Compare the X groups of data extracted according to the required sorting rules, and select the group of data that best conforms to the sorting rules;
[0063] Take this group of data as the output data ranked 1 in the returned data, and when extracting data later, skip this output data ranked 1;
[0064] Repeat the above process of extracting output data until the output data sorted by Y in the returned data is selected;
[0065] The selected Y output data are used to assemble the required return data;
[0066] The process of repeatedly selecting output data is repeated so that the number of times the output data is extracted is equal to the number of output data required. That is, if Y output data are needed, the process of extracting output data only needs to be repeated Y times to complete the task.
[0067] Specifically, existing query methods require traversing the target data source, resulting in a large data load. Furthermore, since data from X markets must be compared and sorted before determining the required top Y product codes and their corresponding data, the computational load for each query is substantial. This inevitably leads to a significant decrease in response speed with each query, and the data processing load increases dramatically with the number of queries, negatively impacting query stability and user experience. In contrast, this application, by pre-constructing a multi-market data query location set, only requires... In the data extraction for each market, Y iterations are sufficient to obtain the required Y output data (i.e., the first Y product codes and their corresponding data). In other words, with existing query methods, under the ideal scenario of no sorting required, at least X*Y iterations are needed to extract the required Y output data. If sorting is required, the number of iterations will increase exponentially, and the number of iterations will also increase exponentially if the number of markets being queried increases. However, with the query method of this application, the number of markets being queried is not limited by the number of markets being queried, and only Y iterations of the output data extraction process are needed to obtain the output data. Therefore, this application not only reduces the amount of data processing, lowers the data processing load, increases the efficiency of query processing, and improves the speed of query response, but also significantly optimizes the stability of query operations and the user experience.
[0068] Furthermore, the step of selecting the Y output data to form the required return data also includes:
[0069] When selecting Y output data, the degree of change of each output data is also marked as a reference indicator on the corresponding output data and then added to the return data to form the required return data.
[0070] The degree of change in the output data refers to the rate of change of the specific data corresponding to the output data within a preset time period in the data processing layer, which is the multi-market data query location set constructed within the data processing layer.
[0071] Specifically, since the returned query results are selected from a multi-market data query location set consistent with the required filtering parameters and sorted according to the required sorting rules, the output results are the corresponding data and their sorting of the output products under the same filtering parameters. However, the information contained in the sorting is only the position of a product in the list. Although the change in sorting can only indicate whether the corresponding data of the product has increased or decreased, it cannot know the degree of increase or decrease, especially the specific degree of change compared with other data changing in the same direction within the filtering range. This application will, when selecting Y output data, simultaneously include the degree of change of each output data. After the query results are output, not only can the sorting result of each output data be obtained, but the degree of change of the corresponding output data can also be used as a reference indicator. This makes the information presented in the query results not only have qualitative sorting results in terms of data change, but also quantitative degree indicators. The query results are intuitive, accurate, and highly referential.
[0072] Furthermore, the degree of variation in the output data is represented by a data volatility index, and the specific data volatility index model is as follows:
[0073]
[0074] Among them, Z k This is the data fluctuation index for the product sorted by k in the output data;
[0075] n1 represents the number of products within the query range whose data changes in the direction of increase within a preset time period;
[0076] n2 represents the number of products within the query range whose data changes in a decreasing direction within a preset time period;
[0077] n is the sum of the number of products whose data changes in the direction of increase and decrease within a preset time period within the query range, i.e., n = n1 + n2;
[0078] c k2 This is the second data point for the product ranked k in the output data within a preset time period;
[0079] c k1 This is the first data item of the product sorted by k within a preset time period in the output data;
[0080] c i2 Within the query range, for products whose data changes in the direction of increase within a preset time period, the second data of the i-th product is defined.
[0081] c i1 Within the query range, among products whose data changes in the direction of increase within a preset time period, the first data of the i-th product is defined.
[0082] c j2 Within the query range, the second data of the i-th product among products whose data changes in a decreasing direction within a preset time period;
[0083] c j1 Within the query range, the first data of the i-th product among products whose data changes in a decreasing direction within a preset time period;
[0084] The second data is the data at the current moment within a preset time period; the second data is the data at the previous moment within a preset time period; the preset time period is between the current moment and the previous moment.
[0085] The above parameters are all data corresponding to products with the same filter parameter within the query range;
[0086] Specifically, in the output data, the meaning of the data volatility index of the product ranked k is represented as follows:
[0087] (1) If c k2 >c k1 If the data fluctuation direction is increasing, then Z k >0, and Z k The larger the value, the greater the fluctuation in the data.
[0088] (2) If c k2 =c k1 If the data fluctuation direction is increasing, then Z k =0 indicates that the data has no fluctuation;
[0089] (3) If c k2 <c k1 If the data fluctuation direction is decreasing, then Z k <0, and Z k The smaller the value, the greater the fluctuation in the data.
[0090] Because the data fluctuation index model of this application uses the direction of change within a preset time period as the basis for division, it divides all data within the query range into datasets with increasing and decreasing directions of change. Then, it calculates the degree of change of each output data in the data with the same direction of change. Finally, after weighting the data within the entire query range, it obtains the data fluctuation index of the product ranked k in the output data. This accurately quantifies the degree of data change, especially obtaining a specific indicator that can accurately measure the data in its direction of change. This not only further enriches the output parameters of the query results, but also quantifies the data change based on the ranking, improving the accuracy and comprehensiveness of the output results.
[0091] Secondly, this application provides a multi-market data query system, the system comprising:
[0092] The data acquisition module is used to obtain the first dataset from the target data source;
[0093] The data construction module is used to pre-build a set of multi-market data query locations that match the query conditions based on the first dataset;
[0094] The data output module is used to obtain query instructions, select output data from the matched multi-market data query locations according to the query instructions, and output the query results.
[0095] The target data source is the initial data source, i.e., the data source for multi-market data queries. The data includes, but is not limited to: market codes and their associated data, product codes in the market and their associated data, and the storage location of the associated data.
[0096] The market code includes the code of the market and the codes of all products belonging to that market; the associated data of the market code includes the associated data of the market code and the associated data of all product codes belonging to that market.
[0097] The product code, the associated data of the product code, and the storage location of the associated data are mutually related data and together form a set of data;
[0098] The market refers to a product trading market, including but not limited to: securities or futures exchanges; the market code is an identification code for the market at the data processing level; the associated data of the market code is all data related to the market at the data processing level.
[0099] The product refers to specific products included in the market, including but not limited to: securities or futures; the product code is the identification code of the product at the data processing level; the associated data of the product code is all data related to the product at the data processing level.
[0100] The first dataset is a snapshot of the target data source, i.e., a copy of the data from the target data source at a certain moment; it also includes market codes and their associated data, product codes in the market and their associated data, as well as the storage location of the above specific data.
[0101] The query conditions are preset query-related filtering parameters and sorting rules;
[0102] The multi-market data query location set is the data sorting result of all markets and each individual market constructed based on the first dataset;
[0103] The query command refers to the filtering parameters and sorting rules specified during the query.
[0104] The query results are the returned data obtained according to the specific requirements of the query instruction.
[0105] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the method described in the first aspect.
[0106] Fourthly, this application provides a computer device including a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program to implement the method as described in the first aspect.
[0107] In summary, this application constructs a multi-market data query location set corresponding to the filtering parameters, which reduces the impact of data volume on query operations, decreases data processing volume, and improves query processing efficiency. This not only shortens query response time but also improves the accuracy of query results. Attached Figure Description
[0108] For ease of explanation, this application is described in detail below with reference to specific embodiments and accompanying drawings.
[0109] Figure 1 This is one of the flowcharts illustrating the method of this application;
[0110] Figure 2 This is the second schematic diagram of the method flow of this application;
[0111] Figure 3 This is the third schematic diagram of the method flow of this application;
[0112] Figure 4 This is a schematic diagram of the prior art solution query operation process according to an embodiment of this application;
[0113] Figure 5 This is a schematic diagram of the overall result set and the corresponding single-market PosMap of the embodiments of this application;
[0114] Figure 6 This is a schematic diagram of the query operation process according to an embodiment of this application;
[0115] Figure 7 This is a schematic diagram of the system architecture of this application;
[0116] Figure 8 This is a schematic diagram of a computer-readable storage medium according to this application;
[0117] Figure 9 This is a schematic diagram of the computer device described in this application. Detailed Implementation
[0118] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the figures. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0119] Example 1
[0120] like Figure 1 As shown in the figure, this embodiment provides a multi-market data query method, the method including:
[0121] Obtain the first dataset from the target data source;
[0122] Based on the first dataset, a multi-market data query location set matching the query conditions is constructed in advance;
[0123] Obtain the query instruction, select output data from the matched multi-market data query location set according to the query instruction, and output the query results;
[0124] The target data source is the initial data source, i.e., the data source for multi-market data queries. The data includes, but is not limited to: market codes and their associated data, product codes in the market and their associated data, and the storage location of the associated data.
[0125] The market code includes the code of the market and the codes of all products belonging to that market; the associated data of the market code includes the associated data of the market code and the associated data of all product codes belonging to that market.
[0126] The product code, the associated data of the product code, and the storage location of the associated data are mutually related data and together form a set of data;
[0127] Specifically, after obtaining a product code, you can obtain the associated data of that product code and the storage location of the associated data;
[0128] The market refers to a product trading market, including but not limited to: securities or futures exchanges; such as the Shanghai Stock Exchange, Shanghai Futures Exchange, Shenzhen Stock Exchange, Hong Kong Stock Exchange, and US stock exchanges; the market code is an identification code for that market at the data processing level; the associated data of the market code is all data related to that market at the data processing level.
[0129] The product refers to specific products included in the market, including but not limited to: securities or futures; the product code is the identification code of the product at the data processing level; the associated data of the product code is all data related to the product at the data processing level.
[0130] Specifically, at the data processing level, the market code and its associated data are all labeled with the same identification code for the market and its contained data, or the market code is associated with the data contained in the market. Similarly, at the data processing level, the product code and its associated data are all labeled with the same identification code for the product and its contained data, or the product code is associated with the data contained in the product. This significantly improves the integrity and efficiency of data processing for the market and product, as well as the specific data contained in the market and product, throughout the entire data processing process.
[0131] The first dataset is a snapshot of the target data source, i.e., a copy of the data from the target data source at a certain moment; it also includes market codes and their associated data, product codes in the market and their associated data, as well as the storage location of the above specific data.
[0132] Specifically, the snapshot information of the target data source is the snapshot information of market conditions for all markets, which is the latest market information of all products in all markets within the target data source; the market information is also part of the associated data, such as the latest price, highest price, lowest price, opening price, trading volume, trading value, buy and sell levels, price change, and price change percentage of all products.
[0133] The query conditions are preset query-related filtering parameters and sorting rules;
[0134] The multi-market data query location set is the data sorting result of all markets and each individual market constructed based on the first dataset;
[0135] The query command refers to the filtering parameters and sorting rules specified during the query.
[0136] The query results are the returned data obtained according to the specific requirements of the query instruction;
[0137] This application obtains a first dataset from the target data source and, based on the first dataset, pre-constructs a multi-market data query location set that matches the query conditions. This allows for the pre-construction of data sorting results for all markets and each individual market before the query, which not only provides more accurate query results for subsequent query operations but also significantly shortens the response time of the query operation and improves query efficiency.
[0138] Furthermore, the step of pre-constructing a multi-market data query location set matching the query conditions based on the first dataset includes:
[0139] Get the first query condition;
[0140] From the first dataset, extract all market codes related to the first query condition, the associated data of the market codes, and the storage location of the specific data to form the second dataset;
[0141] From the second dataset, based on the different filtering parameters in the first query condition, the first list data corresponding to the filtering parameters are extracted respectively, and the extracted first list data are sorted according to the sorting rules corresponding to the filtering parameters. The sorting position information of the first list data is marked according to the sorting result, and then the sorting position information is used to form the first list.
[0142] The first list is divided into two markets. Data is extracted from each market to form a second list for each market. Each second list is then sorted separately according to the same sorting rules as the first list. The sorting position information is then combined with the corresponding sorting position information in the first list to form a second list. The number of the second lists is the number of markets.
[0143] The first list that meets the same filtering parameters and its corresponding second lists within multiple markets are combined to form a multi-market data query location set.
[0144] The first query condition is a preset query-related filtering parameter and sorting rule, that is, various filtering parameters set by the query terminal and their corresponding sorting rules;
[0145] Specifically, the first query condition changes its content according to the preset query filtering rules and parameters of the query terminal; that is, the first query condition corresponds one-to-one with the content that the query terminal can query. The second dataset differs from the first dataset in that the first dataset is a direct copy of the target data source at a certain moment, while the second dataset is a subset of data extracted from the first dataset based on the first query condition—that is, data related to the first query condition. For example, if the first dataset contains a product code in a certain market and its associated data, then the data extracted from the second dataset is the portion of that product code and its associated data that is related to the first query condition.
[0146] Since obtaining a product code allows access to its associated data and storage location, subsequent extraction, filtering, and sorting of all products from all markets in the second dataset suffices to create both the first and second lists. This eliminates the need to store the product code and its corresponding sorting position information, thus enabling operations on the associated data. This significantly reduces the amount of data processed and improves efficiency, resulting in a much faster response time for subsequent queries.
[0147] The first list data consists of specific data related to a certain filtering parameter in the second dataset and all product codes in all corresponding markets.
[0148] The second list data is obtained by dividing the first list data according to individual markets, into second list data for each market. All markets correspond to one first list data, and each market corresponds to one second list data.
[0149] Specifically, the first list data is sorted according to the sorting rules corresponding to the filtering parameter. This sorting is only performed on the data in the associated data of each product code that are consistent with the filtering parameter. The first list obtained is also the sorted result set corresponding to the data that are consistent with the filtering parameter. In other words, different filtering parameters correspond to different first list data, and thus different first lists will be generated. The number of filtering parameters determines the number of first lists generated.
[0150] The second list has the same filtering parameters and sorting rules as the first list. That is, under the same filtering parameters, a first list containing all market codes and multiple second lists containing single market codes together form a multi-market data query location set; one filtering parameter corresponds to one multi-market data query location set.
[0151] This application employs a method of pre-constructing a multi-market data query location set. Starting from a first dataset, the data range is progressively narrowed. First, a second dataset matching the first query condition is extracted. Then, based on filtering parameters and sorting rules, a first list and multiple corresponding second lists are generated from the second dataset, collectively forming the multi-market data query location set. This layered extraction of the original data not only makes the final multi-market data query location set more accurate but also further reduces the data volume because the first and second lists in the multi-market data query location set only contain product codes and their corresponding sorting position information. This further improves the efficiency of data processing during subsequent queries, significantly increasing the response speed of query operations. Therefore, this application not only improves the efficiency of multi-market data queries but also further enhances the accuracy of query results.
[0152] Furthermore, the step of obtaining the query instruction and selecting output data from the matched multi-market data query location set according to the query instruction, and outputting the query results, includes:
[0153] Retrieve the second query condition from the query command;
[0154] Based on the second query condition, match the multiple market data query location sets with the same filter parameters;
[0155] In the set of matched multi-market data query locations, relevant data is extracted and sorted according to the second query condition to form the returned data output query results;
[0156] The query instruction is the instruction and related information issued during the query operation; the second query condition is the parameter related to the multi-market data query location set that matches the same filtering parameters.
[0157] Furthermore, obtaining the second query condition from the query instruction includes:
[0158] From the query instruction, the query scope is determined, namely the market code and market quantity to be queried, and keywords related to the first query condition are extracted, and specific filtering parameters and sorting rules are parsed out.
[0159] Specifically, since a set of multi-market data query locations corresponding to each filtering parameter has already been constructed in the early stages, subsequent queries only require determining the filtering parameters, sorting rules, and query range in the query command. Then, the query location set with the same filtering parameters is directly matched. Within this matched set, either the first or second list is selected based on the query range. Simple operations on the selected first or second list immediately return the data and output the query results. Thus, the entire query process only requires retrieving the first or second list from the pre-constructed multi-market data query location set according to specific needs. This application obtains the required data without using existing query methods. It directly queries the target data source and then identifies and filters the data layer by layer from the target data source. Therefore, compared with existing query methods, this application not only greatly reduces the actual amount of data processing, but also simplifies the data operations required after obtaining the query command, resulting in extremely fast query response. This advantage is even more pronounced when query operations are frequent or when there are many queryers. Furthermore, since the multi-market data query location set is constructed from multi-market data, the number of markets has little impact on the query response time. That is, the query response time remains almost unchanged as the number of markets increases in the later stages.
[0160] In summary, this application can guarantee a low response time, a small amount of data to be processed, a short processing time, and a fast return of query results even when query operations are frequent, the number of queryers is large, and the number of markets being queried is large.
[0161] Furthermore, the step of extracting and sorting relevant data from the matched multi-market data query location set according to the second query condition to form the returned data output query result includes:
[0162] Based on the query scope in the second query condition, relevant data from the first or second list of the matched multi-market data query location set is extracted, as follows:
[0163] (1) When the query range is a single market, first obtain the second list of the corresponding markets in the matched multi-market data query location set, perform synchronization operation on it, then select the output data, form the return data, and output the query results;
[0164] The synchronization operation is to determine whether the sorting rule in the second list is the same as the sorting rule in the second query condition. If they are the same, no operation is performed and the output data is returned directly. If they are opposite, the second list is reversed and the processed output data is returned.
[0165] The returned data is the final data after the selected second list has been synchronized and the output data has been selected, namely the product codes and their corresponding data arranged according to the sorting rules required by the second query conditions, as well as other related data that need to be output.
[0166] (2) When the query scope involves multiple markets, the following situations apply:
[0167] a. If the query scope is all markets, first obtain the first list of the matched multi-market data query location set, synchronize it, then select the output data, form the returned data, and output the query results;
[0168] b. If the query scope is a subset of markets, first determine the market codes for the query scope, obtain the second list of the corresponding multiple markets in the matched multi-market data query location set, synchronize them, then select the output data, generate the required return data, and output the query results.
[0169] Furthermore, the selection of output data includes:
[0170] Suppose there are a total of S markets, the query scope is X markets, and the query results need to output the top Y product codes and their corresponding data. That is, the required query results are: under a certain filter parameter, the top Y product codes and their corresponding data in X markets according to a certain sorting rule. The method for selecting the output data is as follows:
[0171] (1) If X = 1, it means the query range is a single market. When selecting the output data, directly select the product codes and their corresponding data of the top Y sorted in the required second list.
[0172] (2) If X = S, it means the query range is all markets. When selecting the output data, directly select the product codes and their corresponding data of the top Y sorted in the required first list.
[0173] (3) If 1 < X < S, it means the query range is partial markets. The method is as follows:
[0174] Label the second lists of the X markets in the query range as the second lists numbered 1 - X in sequence.
[0175] Extract the product codes and their corresponding data that are ranked at the very front in the second lists numbered 1 - X, that is, a total of X groups of data are extracted.
[0176] Compare the X groups of extracted data according to the required sorting rule, and select the group of data that best conforms to the sorting rule.
[0177] Take this group of data as the output data ranked 1 in the return data, and skip this output data ranked 1 when extracting data later.
[0178] Repeat the above process of extracting output data until the output data ranked Y in the return data is selected.
[0179] Form the required return data with the Y selected output data.
[0180] For the above process of repeating the selection of output data, the number of operations for extracting output data is equal to the number of required output data. That is, when Y output data are required, only need to loop the process of extracting output data Y times to complete.
[0181] Specifically, existing query methods require traversing the target data source, resulting in a large data load. Furthermore, since data from X markets must be compared and sorted before determining the required top Y product codes and their corresponding data, the computational load for each query is substantial. This inevitably leads to a significant decrease in response speed with each query, and the data processing load increases dramatically with the number of queries, negatively impacting query stability and user experience. In contrast, this application, by pre-constructing a multi-market data query location set, only requires... In the data extraction for each market, Y iterations are sufficient to obtain the required Y output data (i.e., the first Y product codes and their corresponding data). In other words, with existing query methods, under the ideal scenario of no sorting required, at least X*Y iterations are needed to extract the required Y output data. If sorting is required, the number of iterations will increase exponentially, and the number of iterations will also increase exponentially if the number of markets being queried increases. However, with the query method of this application, the number of markets being queried is not limited by the number of markets being queried, and only Y iterations of the output data extraction process are needed to obtain the output data. Therefore, this application not only reduces the amount of data processing, lowers the data processing load, increases the efficiency of query processing, and improves the speed of query response, but also significantly optimizes the stability of query operations and the user experience.
[0182] Furthermore, the step of selecting the Y output data to form the required return data also includes:
[0183] When selecting Y output data, the degree of change of each output data is also marked as a reference indicator on the corresponding output data and then added to the return data to form the required return data.
[0184] The degree of change in the output data refers to the rate of change of the specific data corresponding to the output data within a preset time period in the data processing layer, which is the multi-market data query location set constructed within the data processing layer.
[0185] Specifically, since the returned query results are selected from a multi-market data query location set consistent with the required filtering parameters and sorted according to the required sorting rules, the output results are the corresponding data and their sorting of the output products under the same filtering parameters. However, the information contained in the sorting is only the position of a product in the list. Although the change in sorting can only indicate whether the corresponding data of the product has increased or decreased, it cannot know the degree of increase or decrease, especially the specific degree of change compared with other data changing in the same direction within the filtering range. This application will, when selecting Y output data, simultaneously include the degree of change of each output data. After the query results are output, not only can the sorting result of each output data be obtained, but the degree of change of the corresponding output data can also be used as a reference indicator. This makes the information presented in the query results not only have qualitative sorting results in terms of data change, but also quantitative degree indicators. The query results are intuitive, accurate, and highly referential.
[0186] Furthermore, the degree of variation in the output data is represented by a data volatility index, and the specific data volatility index model is as follows:
[0187]
[0188] Among them, Z k This is the data fluctuation index for the product sorted by k in the output data;
[0189] n1 represents the number of products within the query range whose data changes in the direction of increase within a preset time period;
[0190] n2 represents the number of products within the query range whose data changes in a decreasing direction within a preset time period;
[0191] n is the sum of the number of products whose data changes in the direction of increase and decrease within a preset time period within the query range, i.e., n = n1 + n2;
[0192] c k2 This is the second data point for the product ranked k in the output data within a preset time period;
[0193] c k1 This is the first data item of the product sorted by k within a preset time period in the output data;
[0194] c i2 Within the query range, for products whose data changes in the direction of increase within a preset time period, the second data of the i-th product is defined.
[0195] c i1 Within the query range, among products whose data changes in the direction of increase within a preset time period, the first data of the i-th product is defined.
[0196] c j2 Within the query range, the second data of the i-th product among products whose data changes in a decreasing direction within a preset time period;
[0197] c j1 Within the query range, the first data of the i-th product among products whose data changes in a decreasing direction within a preset time period;
[0198] The second data is the data at the current moment within a preset time period; the second data is the data at the previous moment within a preset time period; the preset time period is between the current moment and the previous moment.
[0199] The above parameters are all data corresponding to products with the same filter parameter within the query range;
[0200] Specifically, in the output data, the meaning of the data volatility index of the product ranked k is represented as follows:
[0201] (1) If c k2 >c k1 If the data fluctuation direction is increasing, then Z k >0, and Z k The larger the value, the greater the fluctuation in the data.
[0202] (2) If c k2 =c k1 If the data fluctuation direction is increasing, then Z k =0 indicates that the data has no fluctuation;
[0203] (3) If c k2 <c k1 If the data fluctuation direction is decreasing, then Z k <0, and Z k The smaller the value, the greater the fluctuation in the data.
[0204] Because the data fluctuation index model of this application uses the direction of change within a preset time period as the basis for division, it divides all data within the query range into datasets with increasing and decreasing directions of change. Then, it calculates the degree of change of each output data in the data with the same direction of change. Finally, after weighting the data within the entire query range, it obtains the data fluctuation index of the product ranked k in the output data. This accurately quantifies the degree of data change, especially obtaining a specific indicator that can accurately measure the data in its direction of change. This not only further enriches the output parameters of the query results, but also quantifies the data change based on the ranking, improving the accuracy and comprehensiveness of the output results.
[0205] To illustrate the beneficial effects of this technical solution in detail, the following practical examples are provided:
[0206] According to the existing technical solution, assuming the total number of markets is M, and each market contains N products, the latest market data of all products (i.e., the associated data of product codes) is put into a result set for sorting, and the total number of products processed is M*N. The market data sorting interface supports filtering and sorting the result set by market. Currently, a full loop operation is required to find the product codes and corresponding data that meet the filtering parameters and sorting rules, and obtain the final sorted result set (i.e., select the source of the output data).
[0207] A schematic diagram of the existing technical solution query operation process is shown below. Figure 4 As shown.
[0208] Taking stock quotes as an example, the diagram illustrates the complete front-end and back-end data transfer process from the user inputting the market they want to query to the return of the query results. Steps 101-105 are repeated whenever the user modifies the requested data parameters.
[0209] Step 101: On the client page, the user selects the leaderboard for the mixed market to be displayed and clicks "Get Sorting Results Set";
[0210] Step 102: The client transmits the client's request parameters to the server via the network;
[0211] Step 103: The server iterates through each stock code in the sorted results set of all market snapshots, matching the filtering parameters and sorting rules until the number of matching records is returned and then exits the loop. The number of iterations is M*N.
[0212] Step 104: The server transmits the returned result set to the client over the network;
[0213] Step 105: The client displays the returned result set on the client page, and the user interface displays the leaderboard information.
[0214] According to the technical solution of this application, assuming the total number of markets is M and each market contains N products, the difference from the existing technical solution is that this application pre-constructs a multi-market data query location set corresponding to the filtering parameters, including a first list of the entire market (i.e., the total result set, the location information of all product codes in the total sorting result set and their corresponding data) and a second list of each individual market (i.e., a single market posMap, the sorting information of all product codes in a certain market). In this way, when querying, the location of the corresponding market code and product code can be quickly located according to the query instructions in the request (i.e., query range, filtering parameters and sorting rules).
[0215] For single-market queries, the corresponding maintained single-market PosMap information can be directly found according to the query command, and the results are returned to the client after traversing the PosMap information. For multi-market queries, the PosMap information of multiple single markets is searched, and the results are returned to the client according to the method of selecting output data in this application. This avoids traversing the entire market code and quickly returns the query results.
[0216] The steps and methods for constructing the overall result set and the corresponding single-market PosMap are as follows:
[0217] (1) Obtain market snapshot information for all market codes (M markets). The market snapshot is the latest market information for the security or futures code, including the latest price, highest price, lowest price, opening price, trading volume, trading value, buy and sell orders, price change, and price change percentage.
[0218] (2) All market snapshots are aggregated into the corresponding datasets according to the filtering parameters (i.e., the second dataset, each dataset has M*N codes);
[0219] (3) Sort each corresponding dataset according to the sorting rules to generate the total result set of all codes in the entire market; then generate the corresponding single market PosMap by market to form a multi-market data query location set;
[0220] (4) When querying, find the corresponding multi-market data query location set, and then select the required data from the total result set or single market PosMap in the corresponding multi-market data query location set according to the query instructions, form the returned data, and output the query results.
[0221] From the above process, it can be seen that after constructing the multi-market data query location set, it is only necessary to update and maintain the PosMap information of all product codes in each single market according to the preset cycle, that is, the location information of all product codes in each single market in the corresponding total result set.
[0222] The posMap information, or position mapping information, is the number of product codes for that market.
[0223] A diagram illustrating the total result set and the corresponding single-market PosMap is shown below. Figure 5 As shown.
[0224] The main steps for searching this application are as follows:
[0225] (1) Obtain the list of markets required in the query command.
[0226] (2) Find the corresponding market PosMap information. If it is not a supported market, immediately return the error message of invalid market.
[0227] (3) When querying the sorted results of a single market, the PosMap information of the corresponding market is obtained. Based on the information of the PosMap, the corresponding position is found in the total result set, and then the associated market snapshot information (which is updated periodically in the total result set) is packaged and sent to the client.
[0228] (4) When querying the sorting results of multiple markets, the PosMap information of multiple single markets is obtained. The number of sorting items required in the query instruction (i.e., the data that needs to be sorted in the first N) is taken as the number of loops. The PosMap information of multiple single markets is traversed in a loop. Since the PosMap information of each single market is unique, the query operation can select the required data by looping only N times, package the data and return it to the client.
[0229] A schematic diagram of the query operation process in this embodiment is shown below. Figure 6 As shown.
[0230] Taking stock quotes as an example, the diagram illustrates the complete front-end and back-end data transfer process from the user inputting market quotes to the return of sorted results. Steps 301-308 are repeated whenever the user modifies the requested data parameters.
[0231] Step 301: The user selects the market to be displayed, filter parameters, and sorting rules on the client page, and the client encapsulates the request message;
[0232] Step 302: The client transmits its request message to the server via the network.
[0233] Step 303: Parse the customer's request message and obtain the market group list parameter information (i.e., which markets are needed, the data-related filtering parameters and sorting rules, to obtain the total result set and single market PosMap of the corresponding market combination). In the maintained single market PosMap information, query the multi-market data query location set of the corresponding market in the request parameters.
[0234] Step 304: If the market in the request parameters is not in the maintained single-market PosMap information, it means that the market server does not support the market, and an error message indicating that the market is not supported is returned to the client.
[0235] Step 305: If it is a single market query, locate the single market PosMap information maintained by that market, loop through the single market PosMap information, and obtain the position of each product code in the total result set, as well as the corresponding data;
[0236] Step 306: If it is a multi-market query, locate the multiple single-market PosMap information that need to be maintained, take the number of sorting items required in the query instruction (i.e. the data that needs to be sorted into the first N) as the number of loops, and traverse the multiple single-market PosMap information. Since the single-market PosMap information is ordered data, after the synchronization operation, the associated snapshot information can be obtained directly by position.
[0237] Step 307: The server encapsulates the returned result into a response message and transmits it to the client over the network.
[0238] Step 308: The client displays the returned data on the client page, allowing users to view the interface in a user-friendly manner.
[0239] The optimized query operations performed in the above embodiments can be implemented as a new service or by modifying existing services; this application does not impose any limitations on this.
[0240] Since the market and query result set have already been associated in the backend market service, the client does not need to perform complex traversal query operations when querying again. This not only enables accurate market search but also saves the server's computing power.
[0241] This solution is more flexible and intelligent than existing full-market query solutions. By constructing PosMap information for each individual market, it can reduce the number of loop traversals. If a market is not supported, it can be returned immediately without querying all data, reducing the time complexity from O(M*N) to O(0). If a market is supported, its position in the total result set can be quickly found using the PosMap information for each market, reducing the time complexity from O(M*N) to O(N). This improves query efficiency.
[0242] Example 2
[0243] like Figure 7 As shown, a multi-market data query system includes:
[0244] The data acquisition module is used to obtain the first dataset from the target data source;
[0245] The data construction module is used to pre-build a set of multi-market data query locations that match the query conditions based on the first dataset;
[0246] The data output module is used to obtain query instructions, select output data from the matched multi-market data query locations according to the query instructions, and output the query results.
[0247] The target data source is the initial data source, i.e., the data source for multi-market data queries. The data includes, but is not limited to: market codes and their associated data, product codes in the market and their associated data, and the storage location of the associated data.
[0248] The market code includes the code of the market and the codes of all products belonging to that market; the associated data of the market code includes the associated data of the market code and the associated data of all product codes belonging to that market.
[0249] The product code, the associated data of the product code, and the storage location of the associated data are mutually related data and together form a set of data;
[0250] Specifically, after obtaining a product code, you can obtain the associated data of that product code and the storage location of the associated data;
[0251] The market refers to a product trading market, including but not limited to: securities or futures exchanges; such as the Shanghai Stock Exchange, Shanghai Futures Exchange, Shenzhen Stock Exchange, Hong Kong Stock Exchange, and US stock exchanges; the market code is an identification code for that market at the data processing level; the associated data of the market code is all data related to that market at the data processing level.
[0252] The product refers to specific products included in the market, including but not limited to: securities or futures; the product code is the identification code of the product at the data processing level; the associated data of the product code is all data related to the product at the data processing level.
[0253] Specifically, at the data processing level, the market code and its associated data are all labeled with the same identification code for the market and its contained data, or the market code is associated with the data contained in the market. Similarly, at the data processing level, the product code and its associated data are all labeled with the same identification code for the product and its contained data, or the product code is associated with the data contained in the product. This significantly improves the integrity and efficiency of data processing for the market and product, as well as the specific data contained in the market and product, throughout the entire data processing process.
[0254] The first dataset is a snapshot of the target data source, i.e., a copy of the data from the target data source at a certain moment; it also includes market codes and their associated data, product codes in the market and their associated data, as well as the storage location of the above specific data.
[0255] Specifically, the snapshot information of the target data source is the snapshot information of market conditions for all markets, which is the latest market information of all products in all markets within the target data source; the market information is also part of the associated data, such as the latest price, highest price, lowest price, opening price, trading volume, trading value, buy and sell levels, price change, and price change percentage of all products.
[0256] The query conditions are preset query-related filtering parameters and sorting rules;
[0257] The multi-market data query location set is the data sorting result of all markets and each individual market constructed based on the first dataset;
[0258] The query command refers to the filtering parameters and sorting rules specified during the query.
[0259] The query results are the returned data obtained according to the specific requirements of the query instruction;
[0260] This application obtains a first dataset from the target data source and, based on the first dataset, pre-constructs a multi-market data query location set that matches the query conditions. This allows for the pre-construction of data sorting results for all markets and each individual market before the query, which not only provides more accurate query results for subsequent query operations but also significantly shortens the response time of the query operation and improves query efficiency.
[0261] Furthermore, the step of pre-constructing a multi-market data query location set matching the query conditions based on the first dataset includes:
[0262] Get the first query condition;
[0263] From the first dataset, extract all market codes related to the first query condition, the associated data of the market codes, and the storage location of the specific data to form the second dataset;
[0264] From the second dataset, based on the different filtering parameters in the first query condition, the first list data corresponding to the filtering parameters are extracted respectively, and the extracted first list data are sorted according to the sorting rules corresponding to the filtering parameters. The sorting position information of the first list data is marked according to the sorting result, and then the sorting position information is used to form the first list.
[0265] The first list is divided into two markets. Data is extracted from each market to form a second list for each market. Each second list is then sorted separately according to the same sorting rules as the first list. The sorting position information is then combined with the corresponding sorting position information in the first list to form a second list. The number of the second lists is the number of markets.
[0266] The first list that meets the same filtering parameters and its corresponding second lists within multiple markets are combined to form a multi-market data query location set.
[0267] The first query condition is a preset query-related filtering parameter and sorting rule, that is, various filtering parameters set by the query terminal and their corresponding sorting rules;
[0268] Specifically, the first query condition changes its content according to the preset query filtering rules and parameters of the query terminal; that is, the first query condition corresponds one-to-one with the content that the query terminal can query. The second dataset differs from the first dataset in that the first dataset is a direct copy of the target data source at a certain moment, while the second dataset is a subset of data extracted from the first dataset based on the first query condition—that is, data related to the first query condition. For example, if the first dataset contains a product code in a certain market and its associated data, then the data extracted from the second dataset is the portion of that product code and its associated data that is related to the first query condition.
[0269] Since obtaining a product code allows access to its associated data and storage location, subsequent extraction, filtering, and sorting of all products from all markets in the second dataset suffices to create both the first and second lists. This eliminates the need to store the product code and its corresponding sorting position information, thus enabling operations on the associated data. This significantly reduces the amount of data processed and improves efficiency, resulting in a much faster response time for subsequent queries.
[0270] The first list data consists of specific data related to a certain filtering parameter in the second dataset and all product codes in all corresponding markets.
[0271] The second list data is obtained by dividing the first list data according to individual markets, into second list data for each market. All markets correspond to one first list data, and each market corresponds to one second list data.
[0272] Specifically, the first list data is sorted according to the sorting rules corresponding to the filtering parameter. This sorting is only performed on the data in the associated data of each product code that are consistent with the filtering parameter. The first list obtained is also the sorted result set corresponding to the data that are consistent with the filtering parameter. In other words, different filtering parameters correspond to different first list data, and thus different first lists will be generated. The number of filtering parameters determines the number of first lists generated.
[0273] The second list has the same filtering parameters and sorting rules as the first list. That is, under the same filtering parameters, a first list containing all market codes and multiple second lists containing single market codes together form a multi-market data query location set; one filtering parameter corresponds to one multi-market data query location set.
[0274] This application employs a method of pre-constructing a multi-market data query location set. Starting from a first dataset, the data range is progressively narrowed. First, a second dataset matching the first query condition is extracted. Then, based on filtering parameters and sorting rules, a first list and multiple corresponding second lists are generated from the second dataset, collectively forming the multi-market data query location set. This layered extraction of the original data not only makes the final multi-market data query location set more accurate but also further reduces the data volume because the first and second lists in the multi-market data query location set only contain product codes and their corresponding sorting position information. This further improves the efficiency of data processing during subsequent queries, significantly increasing the response speed of query operations. Therefore, this application not only improves the efficiency of multi-market data queries but also further enhances the accuracy of query results.
[0275] Furthermore, the step of obtaining the query instruction and selecting output data from the matched multi-market data query location set according to the query instruction, and outputting the query results, includes:
[0276] Retrieve the second query condition from the query command;
[0277] Based on the second query condition, match the multiple market data query location sets with the same filter parameters;
[0278] In the set of matched multi-market data query locations, relevant data is extracted and sorted according to the second query condition to form the returned data output query results;
[0279] The query instruction is the instruction and related information issued during the query operation; the second query condition is the parameter related to the multi-market data query location set that matches the same filtering parameters.
[0280] Furthermore, obtaining the second query condition from the query instruction includes:
[0281] From the query instruction, the query scope is determined, namely the market code and market quantity to be queried, and keywords related to the first query condition are extracted, and specific filtering parameters and sorting rules are parsed out.
[0282] Specifically, since a set of multi-market data query locations corresponding to each filtering parameter has already been constructed in the early stages, subsequent queries only require determining the filtering parameters, sorting rules, and query range in the query command. Then, the query location set with the same filtering parameters is directly matched. Within this matched set, either the first or second list is selected based on the query range. Simple operations on the selected first or second list immediately return the data and output the query results. Thus, the entire query process only requires retrieving the first or second list from the pre-constructed multi-market data query location set according to specific needs. This application obtains the required data without using existing query methods. It directly queries the target data source and then identifies and filters the data layer by layer from the target data source. Therefore, compared with existing query methods, this application not only greatly reduces the actual amount of data processing, but also simplifies the data operations required after obtaining the query command, resulting in extremely fast query response. This advantage is even more pronounced when query operations are frequent or when there are many queryers. Furthermore, since the multi-market data query location set is constructed from multi-market data, the number of markets has little impact on the query response time. That is, the query response time remains almost unchanged as the number of markets increases in the later stages.
[0283] In summary, this application can guarantee a low response time, a small amount of data to be processed, a short processing time, and a fast return of query results even when query operations are frequent, the number of queryers is large, and the number of markets being queried is large.
[0284] Furthermore, the step of extracting and sorting relevant data from the matched multi-market data query location set according to the second query condition to form the returned data output query result includes:
[0285] Based on the query scope in the second query condition, relevant data from the first or second list of the matched multi-market data query location set is extracted, as follows:
[0286] (1) When the query range is a single market, first obtain the second list of the corresponding markets in the matched multi-market data query location set, perform synchronization operation on it, then select the output data, form the return data, and output the query results;
[0287] The synchronization operation is to determine whether the sorting rule in the second list is the same as the sorting rule in the second query condition. If they are the same, no operation is performed and the output data is returned directly. If they are opposite, the second list is reversed and the processed output data is returned.
[0288] The returned data is the final data after the selected second list is synchronized and then the output data is selected, that is, the product codes and their corresponding data arranged according to the sorting rules required by the second query condition, as well as other associated data that needs to be output;
[0289] (2) When the query range is multiple markets, it is divided into cases:
[0290] a. If the query range is all markets, first obtain the first list in the concentrated query positions of the matched multiple-market data, perform a synchronization operation on it, then select the output data, form the returned data, and output the query result;
[0291] b. If the query range is partial markets, first determine the market codes of the query range, and obtain the second list corresponding to the multiple markets in the concentrated query positions of the matched multiple-market data. Perform a synchronization operation on it, then select the output data, generate the required returned data, and output the query result;
[0292] Further, the selection of the output data includes:
[0293] Suppose there are a total of S markets, the query range is X markets, and the query result needs to output the first Y product codes and their corresponding data. That is, the query result to be output is: under a certain screening parameter, among the X markets, the first Y product codes and their corresponding data according to a certain sorting rule. Then the method for selecting the output data is as follows:
[0294] (1) If X = 1, indicating that the query range is a single market, when selecting the output data, directly select the first Y product codes and their corresponding data in the required second list;
[0295] (2) If X = S, indicating that the query range is all markets, when selecting the output data, directly select the first Y product codes and their corresponding data in the required first list;
[0296] (3) If 1 < X < S, indicating that the query range is partial markets, the method is as follows:
[0297] Label the second lists of the X markets in the query range as the second lists numbered 1 - X in sequence;
[0298] Extract the product codes and their corresponding data at the forefront of the sorting in the second lists numbered 1 - X, that is, extract a total of X groups of data;
[0299] Compare the X groups of data extracted according to the required sorting rules, and select a group of data that most conforms to the sorting rules;
[0300] Use this group of data as the output data ranked 1 in the returned data, and skip this output data ranked 1 when extracting data later;
[0301] Repeat the above process of extracting output data until the output data sorted by Y in the returned data is selected;
[0302] The selected Y output data are used to assemble the required return data;
[0303] The process of repeatedly selecting output data is repeated so that the number of times the output data is extracted is equal to the number of output data required. That is, if Y output data are needed, the process of extracting output data only needs to be repeated Y times to complete the task.
[0304] Specifically, existing query methods require traversing the target data source, resulting in a large data load. Furthermore, since data from X markets must be compared and sorted before determining the required top Y product codes and their corresponding data, the computational load for each query is substantial. This inevitably leads to a significant decrease in response speed with each query, and the data processing load increases dramatically with the number of queries, negatively impacting query stability and user experience. In contrast, this application, by pre-constructing a multi-market data query location set, only requires... In the data extraction for each market, Y iterations are sufficient to obtain the required Y output data (i.e., the first Y product codes and their corresponding data). In other words, with existing query methods, under the ideal scenario of no sorting required, at least X*Y iterations are needed to extract the required Y output data. If sorting is required, the number of iterations will increase exponentially, and the number of iterations will also increase exponentially if the number of markets being queried increases. However, with the query method of this application, the number of markets being queried is not limited by the number of markets being queried, and only Y iterations of the output data extraction process are needed to obtain the output data. Therefore, this application not only reduces the amount of data processing, lowers the data processing load, increases the efficiency of query processing, and improves the speed of query response, but also significantly optimizes the stability of query operations and the user experience.
[0305] Furthermore, the step of selecting the Y output data to form the required return data also includes:
[0306] When selecting Y output data, the degree of change of each output data is also marked as a reference indicator on the corresponding output data and then added to the return data to form the required return data.
[0307] The degree of change in the output data refers to the rate of change of the specific data corresponding to the output data within a preset time period in the data processing layer, which is the multi-market data query location set constructed within the data processing layer.
[0308] Specifically, since the returned query results are selected from a multi-market data query location set consistent with the required filtering parameters and sorted according to the required sorting rules, the output results are the corresponding data and their sorting of the output products under the same filtering parameters. However, the information contained in the sorting is only the position of a product in the list. Although the change in sorting can only indicate whether the corresponding data of the product has increased or decreased, it cannot know the degree of increase or decrease, especially the specific degree of change compared with other data changing in the same direction within the filtering range. This application will, when selecting Y output data, simultaneously include the degree of change of each output data. After the query results are output, not only can the sorting result of each output data be obtained, but the degree of change of the corresponding output data can also be used as a reference indicator. This makes the information presented in the query results not only have qualitative sorting results in terms of data change, but also quantitative degree indicators. The query results are intuitive, accurate, and highly referential.
[0309] Furthermore, the degree of variation in the output data is represented by a data volatility index, and the specific data volatility index model is as follows:
[0310]
[0311] Among them, Z k This is the data fluctuation index for the product sorted by k in the output data;
[0312] n1 represents the number of products within the query range whose data changes in the direction of increase within a preset time period;
[0313] n2 represents the number of products within the query range whose data changes in a decreasing direction within a preset time period;
[0314] n is the sum of the number of products whose data changes in the direction of increase and decrease within a preset time period within the query range, i.e., n = n1 + n2;
[0315] c k2 This is the second data point for the product ranked k in the output data within a preset time period;
[0316] c k1 This is the first data item of the product sorted by k within a preset time period in the output data;
[0317] c i2 Within the query range, for products whose data changes in the direction of increase within a preset time period, the second data of the i-th product is defined.
[0318] c i1 Within the query range, among products whose data changes in the direction of increase within a preset time period, the first data of the i-th product is defined.
[0319] c j2 Within the query range, the second data of the i-th product among products whose data changes in a decreasing direction within a preset time period;
[0320] c j1 Within the query range, the first data of the i-th product among products whose data changes in a decreasing direction within a preset time period;
[0321] The second data is the data at the current moment within a preset time period; the second data is the data at the previous moment within a preset time period; the preset time period is between the current moment and the previous moment.
[0322] The above parameters are all data corresponding to products with the same filter parameter within the query range;
[0323] Specifically, in the output data, the meaning of the data volatility index of the product ranked k is represented as follows:
[0324] (1) If c k2 >c k1 If the data fluctuation direction is increasing, then Z k >0, and Z k The larger the value, the greater the fluctuation in the data.
[0325] (2) If c k2 =c k1 If the data fluctuation direction is increasing, then Z k =0 indicates that the data has no fluctuation;
[0326] (3) If c k2 <c k1 If the data fluctuation direction is decreasing, then Z k <0, and Z k The smaller the value, the greater the fluctuation in the data.
[0327] Because the data fluctuation index model of this application uses the direction of change within a preset time period as the basis for division, it divides all data within the query range into datasets with increasing and decreasing directions of change. Then, it calculates the degree of change of each output data in the data with the same direction of change. Finally, after weighting the data within the entire query range, it obtains the data fluctuation index of the product ranked k in the output data. This accurately quantifies the degree of data change, especially obtaining a specific indicator that can accurately measure the data in its direction of change. This not only further enriches the output parameters of the query results, but also quantifies the data change based on the ranking, improving the accuracy and comprehensiveness of the output results.
[0328] Example 3
[0329] like Figure 8 As shown, the present invention provides a computer-readable storage medium having a computer program stored thereon, characterized in that the program, when executed by a processor, implements the method described in Embodiment 1 above.
[0330] Example 4
[0331] like Figure 9 As shown, the present invention provides a computer device, characterized in that it includes a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program to implement the method described in Embodiment 1 above.
[0332] In summary, this application constructs a multi-market data query location set corresponding to the filtering parameters, which reduces the impact of data volume on query operations, decreases data processing volume, and improves query processing efficiency. This not only shortens query response time but also improves the accuracy of query results.
[0333] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, media, devices, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0334] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.
[0335] The modules or units described as separate components may or may not be physically separate. The components shown as modules or units may or may not be physical modules or units; that is, they may be located in one place or distributed across multiple network modules or units. Some or all of the modules or units can be selected to achieve the purpose of this embodiment according to actual needs.
[0336] Furthermore, the functional modules or units in the various embodiments of this application can be integrated into one processing module or unit, or each module or unit can exist physically separately, or two or more modules or units can be integrated into one module or unit. The integrated modules or units described above can be implemented in hardware or as software functional units.
[0337] The integrated systems, modules, and units, if implemented as software functional units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0338] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them; although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for querying multi-market data, characterized in that, The method includes: Obtain the first dataset from the target data source; Based on the first dataset, a multi-market data query location set matching the query conditions is pre-constructed; including: Get the first query condition; From the first dataset, extract all market codes related to the first query condition, the associated data of the market codes, and the storage location of the specific data to form the second dataset; From the second dataset, based on the different filtering parameters in the first query condition, the first list data corresponding to the filtering parameters are extracted respectively, and the extracted first list data are sorted according to the sorting rules corresponding to the filtering parameters. The sorting position information of the first list data is marked according to the sorting result, and then the sorting position information is used to form the first list. The first list is divided into two markets. Data is extracted from each market to form a second list for each market. Each second list is then sorted separately according to the same sorting rules as the first list. The sorting position information is then combined with the corresponding sorting position information in the first list to form a second list. The number of the second lists is the number of markets. The first list that meets the same filtering parameters and its corresponding second lists within multiple markets are combined to form a multi-market data query location set. The first query condition is a preset query-related filtering parameter and sorting rule; The first list data consists of specific data related to a certain filtering parameter in the second dataset and all product codes in all corresponding markets. The second list data is obtained by dividing the first list data according to individual markets, into second list data for each market. All markets correspond to one first list data, and each market corresponds to one second list data. The second list has the same filtering parameters and sorting rules as the first list. That is, under the same filtering parameters, a first list containing all market codes and multiple second lists containing single market codes together form a multi-market data query location set; one filtering parameter corresponds to one multi-market data query location set. Obtain the query instruction, select output data from the matched multi-market data query location set according to the query instruction, and output the query results; The target data source is the initial data source, i.e., the data source for multi-market data queries. The data includes, but is not limited to: market codes and their associated data, product codes in the market and their associated data, and the storage location of the associated data. The market refers to a product trading market, including but not limited to: securities or futures exchanges; the market code is an identification code for the market at the data processing level; the associated data of the market code is all data related to the market at the data processing level. The product refers to specific products included in the market, including but not limited to: securities or futures; the product code is the identification code of the product at the data processing level; the associated data of the product code is all data related to the product at the data processing level. The first dataset is a snapshot of the target data source, i.e., a copy of the data from the target data source at a certain moment; it also includes market codes and their associated data, product codes in the market and their associated data, as well as the storage location of the above specific data. The query conditions are preset query-related filtering parameters and sorting rules; The multi-market data query location set is the data sorting result of all markets and each individual market constructed based on the first dataset; The query command refers to the filtering parameters and sorting rules specified during the query. The query results are the returned data obtained according to the specific requirements of the query instruction.
2. The multi-market data query method according to claim 1, characterized in that, The process of obtaining the query instruction, selecting output data from the matched multi-market data query location set according to the query instruction, and outputting the query results includes: Retrieve the second query condition from the query command; Based on the second query condition, match the multiple market data query location sets with the same filter parameters; In the set of matched multi-market data query locations, relevant data is extracted and sorted according to the second query condition to form the returned data output query results; The second query condition is a parameter related to a set of multi-market data query locations that match the same filter parameters.
3. The multi-market data query method according to claim 2, characterized in that, The step of obtaining the second query condition from the query instruction includes: From the query instruction, the query scope is determined, namely the market code and market quantity to be queried, and keywords related to the first query condition are extracted, and specific filtering parameters and sorting rules are parsed out.
4. The multi-market data query method according to claim 2, characterized in that, The step of extracting and sorting relevant data from the matched multi-market data query location set according to the second query condition to form the returned data output query results includes: Based on the query scope in the second query condition, relevant data from the first or second list of the matched multi-market data query location set is extracted, as follows: (1) When the query range is a single market, first obtain the second list of the corresponding markets in the matched multi-market data query location set, perform synchronization operation on it, then select the output data, form the return data, and output the query results; The synchronization operation is to determine whether the sorting rule in the second list is the same as the sorting rule in the second query condition. If they are the same, no operation is performed and the output data is returned directly. If they are opposite, the second list is reversed and the processed output data is returned. The returned data is the final data after the selected second list has been synchronized and the output data has been selected, namely the product codes and their corresponding data arranged according to the sorting rules required by the second query conditions, as well as other related data that need to be output. (2) When the query scope involves multiple markets, the following situations apply: a. If the query scope is all markets, first obtain the first list of the matched multi-market data query location set, synchronize it, then select the output data, form the returned data, and output the query results; b. If the query range is for some markets, first determine the market codes of the query range, and obtain the corresponding second list of multiple markets in the concentrated query positions of the matched multi-market data. After synchronizing it, then select the output data, generate the required return data, and output the query result.
5. The multi-market data query method according to claim 4, characterized in that, The selection of the output data includes: Suppose there are a total of S markets, the query range is X markets, and the query result needs to output the first Y product codes and their corresponding data. That is, the query result to be output is: under a certain screening parameter, among the X markets, the first Y product codes and their corresponding data according to a certain sorting rule. Then the method for selecting the output data is as follows: (1) If X = 1, indicating that the query range is for a single market, when selecting the output data, directly select the first Y product codes and their corresponding data in the required second list; (2) If X = S, indicating that the query range is for all markets, when selecting the output data, directly select the first Y product codes and their corresponding data in the required first list; (3) If 1 < X < S, indicating that the query range is for some markets, the method is as follows: Label the second list of the X markets in the query range as the second list numbered 1 - X in sequence; Extract the product codes and their corresponding data that are ranked at the forefront in the second list numbered 1 - X, that is, a total of X groups of data are extracted; Compare the X groups of data extracted according to the required sorting rule, and select the group of data that best conforms to the sorting rule; Take this group of data as the output data ranked 1 in the return data, and when extracting data later, skip this output data ranked 1; Repeat the above process of extracting output data until the output data ranked Y in the return data is selected; Form the required return data from the selected Y output data; For the above process of repeating the selection of output data, the number of operations for extracting output data is equal to the number of required output data. That is, when Y output data are required, only need to loop the process of extracting output data Y times to complete.
6. The multi-market data query method according to claim 5, characterized in that, The forming of the required return data from the selected Y output data further includes: When selecting the Y output data, at the same time, take the degree of data change of each output data as a reference index and mark it on the corresponding output data, and then add it to the return data to form the required return data; The degree of data change of the output data is the change rate of the specific data corresponding to the output data in the concentrated query positions of the multi-market data constructed within a preset time period at the data processing level.
7. The multi-market data query method according to claim 6, characterized in that, The degree of data change of the output data is characterized by a data fluctuation index. The specific data fluctuation index model is as follows: Among them, Z k This is the data fluctuation index for the product sorted by k in the output data; n1 is the number of products whose data increases in the query range within the preset time period; n2 is the number of products whose data decreases in the query range within the preset time period; n is the sum of the number of products whose data increases and decreases in the query range within the preset time period, that is, n = n1 + n2; c k2 This is the second data point for the product ranked k in the output data within a preset time period; c k1 This is the first data item of the product sorted by k within a preset time period in the output data; c i2 Within the query range, for products whose data changes in the direction of increase within a preset time period, the second data of the i-th product is defined. c i1 Within the query range, among products whose data changes in the direction of increase within a preset time period, the first data of the i-th product is defined. c j2 Within the query range, the second data of the i-th product among products whose data changes in a decreasing direction within a preset time period; c j1 Within the query range, the first data of the i-th product among products whose data changes in a decreasing direction within a preset time period; The second data is the data at the current moment within the preset time period; the first data is the data at the previous moment within the preset time period; the time period between the current moment and the previous moment is the preset time period. The parameters above are all data corresponding to products with the same filter parameter within the query range.
8. A multi-market data query system, characterized in that, The system includes: The data acquisition module is used to obtain the first dataset from the target data source; The data construction module is used to pre-build a set of multi-market data query locations that match the query conditions based on the first dataset; The data output module is used to obtain query instructions, select output data from the matched multi-market data query locations according to the query instructions, and output the query results. The system is used to perform the method as described in any one of claims 1-7.
9. A computer device comprising a memory and a processor; the memory being configured to store a computer program; the processor being configured to, when executing the computer program, implement the method as described in any one of claims 1-7.
Citation Information
Patent Citations
Data query method and device, readable medium and electronic equipment
CN113127722A