A method and system for calculating consistent transaction factors based on DPU
By combining DPU and CPU, and using accelerated cores to calculate consistent trading factors, the problem of insufficient CPU computing power is solved, enabling efficient financial business data processing and real-time market analysis.
Patent Information
- Application Number
- CN202411619775.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-11-13
AI Technical Summary
Existing CPU solutions cannot provide sufficient computing power and lower processing latency to support the calculation of consistent transaction factors in financial services, resulting in high CPU usage and inability to perform other tasks.
A DPU-based computing method is adopted, which connects to the CPU via the PCIe bus and uses the DPU's acceleration core to perform consistent trading factor calculation. This includes acquiring stock trading information, constructing parallel computing formulas for trading factor calculation, and transmitting the data to the PCIe register for calculation.
It improves computing speed, reduces processing latency, reduces the CPU's computational burden, enhances data processing efficiency and resource utilization, and supports real-time market analysis and trading strategy formulation.
Smart Images

Figure CN119831737B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of consistent transaction factor calculation, and in particular to a method and system for calculating a consistent transaction factor based on DPU. Background Art
[0002] With the development of technology in modern society, disk read and write and network bandwidth performance are constantly improving. The performance difficulties in the fields of finance and quantitative trading have shifted to computing power and processing latency. However, the existing CPU (central processing unit) solutions cannot provide sufficient computing power and lower processing latency to support existing financial businesses. In addition, the process of the CPU calculating large amounts of data will generate a high CPU utilization rate, making it impossible to perform other tasks. Therefore, how to obtain a calculation solution and technical architecture for consistent trading factors with stronger computing power and lower latency is an urgent problem that needs to be solved. Summary of the Invention
[0003] In view of this, an embodiment of the present invention provides a method and system for calculating a consistent transaction factor based on DPU to eliminate or improve one or more defects in the prior art and solve the problem of low efficiency in calculating the consistent transaction factor in the prior art.
[0004] One aspect of the present invention provides a consistent transaction factor calculation method based on a DPU. The method is executed based on a DPU. The DPU is connected to a CPU via a PCIe bus. The CPU has CPU memory, and the DPU has DPU memory and an acceleration core. The method includes:
[0005] Obtaining stock transaction information, stock length, and stock quantity scheduled by the CPU from the CPU memory; the stock transaction information includes a closing price sequence, an opening price sequence, a highest price sequence, a lowest price sequence, and a transaction price sequence;
[0006] receiving the stock transaction information, the stock length, and the stock quantity transmitted via the PCIe bus and storing them in the DPU memory, reading the stock length and the stock quantity through the acceleration core to obtain length information of a single stock, and reading the stock transaction information according to the length information of the single stock to obtain corresponding stock transaction information to be processed;
[0007] Constructing a consistent transaction factor calculation formula that complies with DPU calculations, converting the to-be-processed stock transaction information into column data that can be processed by the acceleration core in the DPU, and calculating first accumulated data and second accumulated data using the column data; the column data includes closing price data, opening price data, highest price data, lowest price data, and transaction price data; the first accumulated data represents the sum of transaction volumes in the column data whose closing price is higher than the opening price after the consistent transaction factor calculation formula has been programmed and run, and the second accumulated data represents the sum of transaction volumes contained in the column data that has not been programmed and run using the consistent transaction factor calculation formula;
[0008] The first accumulated data and the second accumulated data are respectively transferred into a first PCIe register and a second PCIe register, and a consistent transaction factor calculation result is obtained by dividing the second accumulated data by the first accumulated data.
[0009] In some embodiments, constructing a consistent transaction factor calculation formula that complies with DPU calculation, converting the to-be-processed stock transaction information into column data that can be processed by the acceleration core in the DPU, and calculating the first accumulated data and the second accumulated data using the column data includes:
[0010] Converting the to-be-processed stock transaction information into closing price data, opening price data, highest price data, lowest price data, and transaction price data that can be processed by the acceleration core in the DPU;
[0011] Dividing the closing price data into two paths for filtering and comparison respectively, and dividing the opening price data into two paths for filtering and comparison respectively; filtering the column data according to the comparison result of the closing price data and the opening price data for comparison to obtain closing price filtered data with a closing price higher than the opening price, opening price filtered data, highest price filtered data, lowest price filtered data, and transaction price filtered data;
[0012] Half of the result of subtracting the highest price filtered data from the lowest price filtered data and the result of subtracting the closing price filtered data from the opening price filtered data are filtered to obtain change data, the change data and the transaction price filtered data are filtered to obtain the trading volume with the closing price higher than the opening price, and the two volumes are added together to obtain first accumulated data, and the second accumulated data is obtained by adding the trading volumes contained in the transaction price data.
[0013] In some embodiments, the method further includes: the consistent transaction factor calculation formula uses parallel computing to obtain the first accumulated data and the second accumulated data.
[0014] In some embodiments, the method further includes: feeding back the consistent transaction factor to the transaction processing end for market transaction trend analysis, market transaction risk analysis, and market transaction abnormality analysis, and formulating corresponding market transaction strategies based on the analysis results.
[0015] On the other hand, the present invention further provides a DPU-based consistent transaction factor calculation system, wherein the system is used to execute the above-mentioned DPU-based consistent transaction factor calculation method, and the system comprises:
[0016] CPU memory module, used to store stock transaction information, stock length and stock quantity;
[0017] A PCIe bus transmission module, configured to transmit the stock transaction information, the stock length, and the stock quantity from the CPU memory module to the DPU;
[0018] A DPU memory module, configured to receive and store the stock transaction information, the stock length, and the stock quantity via a DPU memory;
[0019] A calculation module is configured to obtain the length information of a single stock by reading the stock length and the number of stocks through an acceleration core, read the stock trading information according to the length information of the single stock to obtain the corresponding stock trading information to be processed, convert the stock trading information to be processed into column data that can be processed by the acceleration core in the DPU and calculate the first accumulated data and the second accumulated data, and obtain the consistent trading factor calculation result by dividing the second accumulated data by the first accumulated data.
[0020] In some embodiments, the system further comprises:
[0021] A cloud storage system is used to store the stock transaction information, the stock length, the number of stocks, the first accumulated data, the second accumulated data and the consistent transaction factor calculation result.
[0022] In some embodiments, the system further comprises:
[0023] The analysis module is used to analyze market transaction change trends, market transaction risks and market transaction anomalies based on the consistent transaction factors and formulate corresponding market transaction strategies.
[0024] In some embodiments, the calculation module includes:
[0025] a data acquisition component, configured to acquire the stock transaction information, the stock length, and the number of stocks in the DPU memory module; acquire the length information of a single stock based on the stock length and the number of stocks; and read the stock transaction information based on the length information of the single stock to acquire the corresponding stock transaction information to be processed;
[0026] a data extraction component for converting the to-be-processed stock transaction information into closing price data, opening price data, highest price data, lowest price data, and transaction price data that can be processed by the acceleration core in the DPU; dividing the closing price data into two paths for filtering and comparison, and dividing the opening price data into two paths for filtering and comparison, respectively;
[0027] A data comparison component is used to compare the closing price data and the opening price data one by one according to the order correspondence; when the closing price of the data point is greater than the opening price, a 1 is output, otherwise a 0 is output; the output data composed of all the outputs is divided into five paths;
[0028] a data filtering component, configured to receive the five output data and the corresponding closing price data, opening price data, highest price data, lowest price data, and transaction price data using five filtering subcomponents, and output the corresponding closing price filtered data, opening price filtered data, highest price filtered data, lowest price filtered data, and transaction price filtered data when the output data in the five filtering subcomponents is 1, and not output otherwise;
[0029] a subtraction component, configured to subtract the opening price filtered data from the closing price filtered data to obtain first result data, and to subtract the lowest price filtered data from the highest price filtered data to obtain second result data;
[0030] An accumulation component is used to compare the first result data and the second result data and filter them with the transaction price filtering data, add the transaction volumes whose closing prices are higher than the opening prices to obtain first accumulated data, and add the transaction volumes contained in the transaction price data to obtain second accumulated data.
[0031] A division calculation component is used to obtain a consistent transaction factor calculation result after dividing the second accumulated data by the first accumulated data.
[0032] On the other hand, the present invention further provides a computer-readable storage medium having a computer program / instruction stored thereon, wherein the computer program / instruction implements the steps of any of the above methods when executed by a processor.
[0033] On the other hand, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the program implements the steps of any of the above methods when executed by a processor.
[0034] The beneficial effects of the present invention are at least:
[0035] The present invention discloses a method and system for calculating a consistent transaction factor based on a DPU. The method is executed based on the DPU. The DPU is connected to the CPU via a PCIe bus. The CPU deploys CPU memory, and the DPU deploys DPU memory and an acceleration core. The calculation process of the consistent transaction factor is offloaded to the DPU for execution, thereby improving the calculation rate and reducing the processing delay. The CPU does not need to perform heavy computing tasks while providing space for other processing work. The acceleration core reads the stock length and the number of stocks received by the DPU memory to obtain the length information of a single stock, and reads the stock transaction information according to the length information of the single stock to obtain the corresponding stock transaction information to be processed. The acceleration core can directly access the DPU memory, reducing data transmission delay. At the same time, the acceleration core can quickly read and write data, thereby increasing data processing efficiency. The consistent transaction factor calculation formula that complies with the DPU calculation adopts a parallel computing method, and the computing core can improve the processing capability of parallel computing.
[0036] Furthermore, the PCIe bus between the CPU and the DPU of the present invention provides a high-bandwidth data transmission channel. Transferring the first accumulated data and the second accumulated data into the first PCIe register and the second PCIe register respectively can utilize the high-bandwidth data transmission channel to reduce data transmission delay and improve data processing efficiency.
[0037] Additional advantages, objects, and features of the present invention will be set forth in part in the following description and will become apparent to those skilled in the art upon examination of the following or may be learned from practice of the present invention. The objects and other advantages of the present invention may be realized and obtained by the structures particularly pointed out in the description and drawings.
[0038] Those skilled in the art will understand that the purposes and advantages that can be achieved by the present invention are not limited to the above specific descriptions, and the above and other purposes that can be achieved by the present invention will be more clearly understood based on the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute a limitation of the present invention. In the drawings:
[0040] Figure 1 The figure is a flowchart of a method for calculating a consistent transaction factor based on DPU according to an embodiment of the present invention.
[0041] Figure 2 This is a schematic diagram of the structure of a DPU-based consistent transaction factor calculation system according to an embodiment of the present invention.
[0042] Figure 3This is a schematic diagram of the structure of the computing module in the DPU-based consistent transaction factor computing system according to one embodiment of the present invention. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the exemplary embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0044] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, the accompanying drawings only show structures and / or processing steps closely related to the solutions according to the present invention, while other details that are not closely related to the present invention are omitted.
[0045] It should be emphasized that the term "include / comprises" when used herein refers to the existence of features, elements, steps or components, but does not exclude the existence or addition of one or more other features, elements, steps or components.
[0046] It should also be noted that, unless otherwise specified, the term "connection" herein may refer not only to a direct connection but also to an indirect connection involving an intermediate.
[0047] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.
[0048] In existing technologies, the calculation of consistent transaction factors is performed only on the CPU. Existing CPU solutions cannot provide sufficient computing power and lower processing latency to support existing financial services. The CPU instruction set architecture cannot efficiently and quickly calculate consistent transaction factors for large amounts of data. In addition, the CPU calculation process for large amounts of data will generate a very high CPU usage rate, making it impossible to perform other tasks. The present invention proposes a method and system for calculating a consistent transaction factor based on a DPU. The method is executed based on a DPU, wherein the DPU is connected to a CPU via a PCIe bus, obtains stock transaction information, stock length, and stock quantity from the CPU memory transmitted via the PCIe bus, reads the stock length and stock quantity via an acceleration core to obtain length information of a single stock, and reads stock transaction information based on the length information of the single stock to obtain corresponding stock transaction information to be processed; constructs a consistent transaction factor calculation formula that conforms to DPU calculation, converts the pending stock transaction information into column data that can be processed by the acceleration core in the DPU, and calculates first accumulated data and second accumulated data; the first accumulated data represents the sum of transaction volumes in the column data with closing prices higher than opening prices after the consistent transaction factor calculation formula is programmed and executed, and the second accumulated data represents the sum of transaction volumes contained in the column data that has not been programmed and executed by the consistent transaction factor calculation formula; the first accumulated data and the second accumulated data are respectively transferred to a first PCIe register and a second PCIe register, and the consistent transaction factor calculation result is obtained by dividing the second accumulated data by the first accumulated data.
[0049] Figure 1 The figure is a flow chart of a method for calculating a consistent transaction factor based on a DPU according to an embodiment of the present invention. Specifically, the present application provides a method for calculating a consistent transaction factor based on a DPU. The method is executed by a DPU, which is connected to a CPU via a PCIe bus. The CPU deploys CPU memory, and the DPU deploys DPU memory and an acceleration core. The method includes the following steps S101 to S104:
[0050] Step S101: obtaining stock transaction information, stock length and stock quantity dispatched by the CPU from the CPU memory; the stock transaction information includes a closing price sequence, an opening price sequence, a highest price sequence, a lowest price sequence and a transaction price sequence.
[0051] Step S102: Receive the stock transaction information, stock length and stock quantity transmitted through the PCIe bus and store them in the DPU memory, read the stock length and stock quantity through the acceleration core to obtain the length information of a single stock, and read the stock transaction information based on the length information of the single stock to obtain the corresponding stock transaction information to be processed.
[0052] Step S103: Construct a consistent transaction factor calculation formula that complies with DPU calculation, convert the stock transaction information to be processed into column data that can be processed by the acceleration core in the DPU, and calculate the first cumulative data and the second cumulative data through the column data; the column data includes closing price data, opening price data, highest price data, lowest price data and transaction price data; the first cumulative data represents the sum of the transaction volumes with closing prices higher than opening prices in the column data after the programming and operation of the consistent transaction factor calculation formula, and the second cumulative data represents the sum of the transaction volumes contained in the column data that have not been programmed and operated by the consistent transaction factor calculation formula.
[0053] Step S104: the first accumulated data and the second accumulated data are respectively transferred into the first PCIe register and the second PCIe register, and a consistent transaction factor calculation result is obtained by dividing the second accumulated data by the first accumulated data.
[0054] In steps S101 and S102, the accelerator core reads the number of stocks from the DPU memory to obtain the total number of stocks currently to be processed, processing one stock at a time and looping through the calculations for all stocks multiple times. The accelerator core also reads the stock length from the DPU memory to obtain the length information for each stock. The accelerator core then reads stock trading information from the DPU memory to obtain the stock information to be processed based on the number of stocks and the length of the stock. The stock trading information to be processed is the stock trading information corresponding to the length information for each stock, and the stock trading information reflects the market performance of the stock. The accelerator core reads the data to be processed to improve data processing efficiency and loops through the process multiple times until all stocks have been processed. This facilitates efficient processing in real-time market analysis and high-frequency analysis scenarios. The DPU memory of the present invention utilizes DDR (Double Data Rate Synchronous Dynamic Random Access Memory) to achieve a higher data transfer rate, helping the DPU read and write data faster and improving overall processing performance. Furthermore, after obtaining the length information for each stock, the accelerator core queries multiple historical trading data contained in the length information and obtains the stock trading information to be processed corresponding to the multiple historical trading data from the read stock trading information.
[0055] In steps S103 and S104, the acceleration core in the DPU processes data using a column data structure. Therefore, the data format is modified based on the original consistent transaction factor calculation formula to obtain a consistent transaction factor calculation formula that complies with the DPU calculation. The transaction volume in the transaction price data stream is the original transaction volume in the stock transaction information to be processed. After the consistent transaction factor calculation formula is programmed and executed, the column data is compared, filtered, and selected to obtain the consistent increase transaction volume where the closing price is higher than the opening price. The sum of the consistent increase transaction volume is calculated to obtain the first cumulative data. The consistent transaction factor is used to quantify market trading indicators and analyze ongoing trading activity in the market.
[0056] In some embodiments, the method further includes: using a parallel computing method to calculate the consistent transaction factor calculation formula to obtain the first accumulated data and the second accumulated data. In some embodiments, constructing a consistent transaction factor calculation formula that complies with DPU calculations, converting the to-be-processed stock transaction information into column data that can be processed by the acceleration core in the DPU, and calculating the first accumulated data and the second accumulated data using the column data includes steps S301 to S303:
[0057] Step S301: Convert the stock transaction information to be processed into closing price data, opening price data, highest price data, lowest price data and transaction price data that can be processed by the acceleration core in the DPU.
[0058] Step S302: Divide the closing price data into two paths for filtering and comparison respectively, and divide the opening price data into two paths for filtering and comparison respectively; filter the column data according to the comparison results of the closing price data and the opening price data for comparison to obtain closing price filtered data with a closing price higher than the opening price, opening price filtered data, highest price filtered data, lowest price filtered data, and transaction price filtered data.
[0059] Step S303: Filter half of the result of subtracting the highest price filtered data from the lowest price filtered data and the result of subtracting the closing price filtered data from the opening price filtered data to obtain change data, filter the change data with the transaction price filtered data to obtain the trading volume with the closing price higher than the opening price, and add them together to obtain the first cumulative data. The second cumulative data is obtained by adding the trading volume contained in the transaction price data.
[0060] Specifically, comparison is to filter out stock trading information whose closing price is higher than the opening price, and filtering is to remove stock trading information that does not meet the set conditions and output stock trading information that meets the set conditions; the acceleration core has parallel processing capabilities and can execute multiple operations at the same time. Under parallel computing mode, a filtering component filters multiple input data, and a comparison component compares multiple input data. The use of parallel computing can improve computing efficiency and resource utilization, support complex algorithms and provide real-time processing capabilities.
[0061] Furthermore, when the closing price data is compared with the opening price data, if the single closing price is higher than the corresponding single opening price, the comparison result 1 is output, otherwise the comparison result 0 is output; when the comparison result of the closing price data and the opening price data is used to filter the column data, when the input comparison result is 1, the corresponding column data is output to obtain the closing price filtered data, opening price filtered data, highest price filtered data, lowest price filtered data and transaction price filtered data in which the closing price is higher than the opening price; when filtering to obtain change data, the filtering condition is met when half of the subtraction result of the highest price filtered data and the lowest price filtered data is greater than or equal to the subtraction result of the filtered data and the opening price filtered data, otherwise the filtering condition is not met.
[0062] In some embodiments, the method further includes: feeding back the consistent transaction factor to the transaction processing end for market transaction trend analysis, market transaction risk analysis, and market transaction abnormality analysis, and formulating corresponding market transaction strategies based on the analysis results.
[0063] Specifically, according to the market trend, it can timely identify the upward or downward trend, providing a basis for formulating trading strategies; analyze the market situation and identify potential risks based on market trading risks, formulate and take corresponding risk management measures; analyze the abnormal market seats of market transactions based on abnormal market trading conditions, and take protective measures to ensure transaction security and interests; the feedback mechanism established by feeding back consistent trading factors to the transaction processing segment can not only improve the transparency and efficiency of market transactions, but also formulate scientific trading strategies and enhance risk management capabilities.
[0064] Figure 2 This is a schematic diagram of the structure of a DPU-based consistent transaction factor calculation system according to one embodiment of the present invention. In another aspect, the present invention further provides a DPU-based consistent transaction factor calculation system, which is configured to execute the DPU-based consistent transaction factor calculation method described above. The DPU-based consistent transaction factor calculation system includes:
[0065] CPU memory module, used to store stock transaction information, stock length and stock quantity.
[0066] The PCIe bus transmission module is used to transmit stock transaction information, stock length, and stock quantity from the CPU memory module to the DPU.
[0067] The DPU memory module is used to receive and store stock transaction information, stock length, and stock quantity through the DPU memory.
[0068] The calculation module is used to read the stock length and stock quantity through the acceleration core to obtain the length information of a single stock, read the stock trading information based on the length information of the single stock to obtain the corresponding stock trading information to be processed, convert the stock trading information to be processed into column data that can be processed by the acceleration core in the DPU and calculate the first accumulated data and the second accumulated data, and obtain the consistent transaction factor calculation result by dividing the second accumulated data by the first accumulated data.
[0069] Specifically, the PCIe bus transmission module connects the CPU and the DPU, and transmits the stock trading information, stock length and stock quantity in the CPU memory to the DPU memory module; further, the CPU configures the parameters of the transmission process through the direct memory access controller, including the CPU memory address, DPU memory address and transmission size. After the parameter configuration is completed, the CPU sends a command to the direct memory access controller to start the transmission, and the PCIe bus starts to execute the transmission task to the DPU memory module. During the transmission process, the direct memory access controller will monitor the transmission progress and feedback the completion signal after the transmission is completed. The CPU performs other tasks when no transmission is required, releasing the CPU occupancy rate; the data in the DPU memory module can be accessed and processed at any time, and parallel computing can be performed immediately to improve data processing performance.
[0070] Furthermore, the first accumulated data and the second accumulated data are calculated and stored in the first PCIe register and the second PCIe register, respectively. A consistent transaction factor is obtained by dividing the second accumulated data by the first accumulated data, and the consistent transaction factor is transmitted back to the CPU memory module via the PCIe bus. When the CPU accesses the PCIe register, the CPU virtual address is converted into a physical address and then mapped to a PCIe address. The CPU then sends an access request to the PCIe register via the PCIe bus and reads the PCIe register by sending a specific transaction layer packet.
[0071] In some embodiments, the system further comprises:
[0072] A cloud storage system is used to store stock transaction information, stock length, stock quantity, first accumulated data, second accumulated data, and consistent transaction factor calculation results. In some embodiments, the system also includes:
[0073] The analysis module is used to analyze market trading trends, market trading risks and market trading anomalies based on consistent trading factors and formulate corresponding market trading strategies.
[0074] Specifically, the cloud storage system can securely store data and calculation results during the calculation process to prevent information loss; when the analysis module analyzes market transactions, the data in the cloud storage system is conducive to the efficient use of computing resources and the formulation of corresponding market transaction strategies.
[0075] Figure 3 This is a schematic diagram of the structure of the computing module in the DPU-based consistent transaction factor computing system according to an embodiment of the present invention. In some embodiments, the computing module includes:
[0076] The data acquisition component is used to obtain stock transaction information, stock length and stock quantity from the DPU memory module; obtain the length information of a single stock based on the stock length and stock quantity, and read the stock transaction information based on the length information of a single stock to obtain the corresponding stock transaction information to be processed.
[0077] The data extraction component is used to convert the stock trading information to be processed into closing price data, opening price data, highest price data, lowest price data and transaction price data that can be processed by the acceleration core in the DPU; the closing price data is divided into two paths for filtering and comparison, and the opening price data is divided into two paths for filtering and comparison.
[0078] The data comparison component compares closing and opening price data point by point in sequential order. If the closing price of a data point is greater than the opening price, a 1 is output; otherwise, a 0 is output. The output data is divided into five paths. Specifically, the data comparison component includes data comparison subcomponent 1 and data comparison subcomponent 2. The output data is divided into five paths: output data 1, output data 2, output data 3, output data 4, and output data 5.
[0079] The data filtering component uses five filtering subcomponents to receive five output data paths and the corresponding closing price data, opening price data, high price data, low price data, and transaction price data. When the output data in any of the five filtering subcomponents is 1, the corresponding closing price filtered data, opening price filtered data, high price filtered data, low price filtered data, and transaction price filtered data are output; otherwise, no output is given. Specifically, the closing price data and output data 1 are input into filtering subcomponent 1, the opening price data and output data 2 are input into filtering subcomponent 2, the transaction price data and output data 3 are input into filtering subcomponent 3, the high price data and output data 4 are input into filtering subcomponent 4, and the low price data and output data 5 are input into filtering subcomponent 5.
[0080] The subtraction component is used to subtract the opening price filtered data from the closing price filtered data to obtain the first result data, and to subtract the lowest price filtered data from the highest price filtered data to obtain the second result data. Specifically, the subtraction of the opening price filtered data from the closing price filtered data is performed in subtraction subcomponent 1, and the subtraction of the lowest price filtered data from the highest price filtered data is performed in subtraction subcomponent 2.
[0081] The accumulation component is configured to compare the first and second result data, filter the data with the transaction price filter data, sum the trading volumes where the closing price is higher than the opening price to obtain the first accumulated data, and sum the trading volumes contained in the transaction price data to obtain the second accumulated data. After the first and second result data are compared in data comparison subcomponent 2 and filtered with the transaction price filter data in filtering subcomponent 6, accumulation component 1 calculates the sum of the trading volumes where the closing price is higher than the opening price in the column data that has been programmed and executed using the consistent transaction factor calculation formula to obtain the first accumulated data. Accumulation component 2 calculates the sum of the trading volumes contained in the column data that has not been programmed and executed using the consistent transaction factor calculation formula to obtain the second accumulated data.
[0082] The division calculation component is used to obtain a consistent transaction factor calculation result after dividing the second accumulated data by the first accumulated data.
[0083] Specifically, the data acquisition component obtains the stock transaction information to be processed and converts it into closing price data, opening price data, highest price data, lowest price data and transaction price data that can be processed by the acceleration core in the DPU, and then transmits it through the data stream. The transmission through the concept of stream can reflect and analyze data in real time and in stages, providing a flexible and efficient solution for processing continuous data.
[0084] On the other hand, the present invention further provides a computer-readable storage medium having a computer program / instruction stored thereon, wherein the computer program / instruction implements the steps of any of the above methods when executed by a processor.
[0085] On the other hand, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the program implements the steps of any of the above methods when executed by a processor.
[0086] The present invention will be described below in conjunction with a specific embodiment:
[0087] The present invention provides a method and system for calculating a consistent transaction factor based on a DPU. The calculation function receives stock transaction information, stock length, and stock quantity, and calculates the consistent transaction factor. This consistent transaction factor calculation function is executed on the DPU, where the module performing this function is the acceleration core. The DPU (data processing unit) and the CPU (central processing unit) transmit data via the PCIe bus. The DPU includes DPU memory and an acceleration core. Data is transferred from the CPU memory to the DPU memory via the PCIe bus. The acceleration core reads the stock transaction information, stock length, and stock quantity from the DPU memory. After calculation by the acceleration core, first and second accumulated data are generated and written to a PCIe register. The consistent transaction factor calculation result is obtained by dividing the second accumulated data by the first accumulated data. The CPU reads the calculation result via the PCIe bus. Stock transaction information includes a closing price sequence, an opening price sequence, a high price sequence, a low price sequence, and a transaction price sequence. The stock length refers to the number of stock transaction information for the currently processed stock, and the stock quantity refers to the number of stocks.
[0088] The acceleration core reads the number of stocks from the DDR (double data rate synchronous dynamic random access memory) to obtain the number of stocks that need to be processed at present, processes one stock at a time, and loops multiple times to complete the calculation of all stocks; the acceleration core reads the stock length from the double data rate synchronous dynamic random access memory to obtain the length information of the currently calculated stock; the acceleration core reads the stock transaction information based on the stock length information to obtain the corresponding stock transaction information to be processed.
[0089] 1. The calculation method of the first accumulated data and the second accumulated data includes steps S100 to S300:
[0090] Step S100: The acceleration core reads the stock length and the number of stocks to obtain the length information of a single stock, reads the stock transaction information based on the length information of the single stock to obtain the corresponding stock transaction information to be processed, and converts the stock transaction information to be processed into closing price data, opening price data, highest price data, lowest price data and transaction price data that can be processed by the acceleration core.
[0091] Step S200: Divide the closing price data into two paths for filtering and comparison respectively, and divide the opening price data into two paths for filtering and comparison respectively; filter the column data according to the comparison results of the closing price data and the opening price data for comparison to obtain closing price filtered data whose closing price is higher than the opening price, opening price filtered data, highest price filtered data, lowest price filtered data, and transaction price filtered data.
[0092] Step S300: Filter half of the result of subtracting the highest price filtered data from the lowest price filtered data and the result of subtracting the closing price filtered data from the opening price filtered data to obtain change data, filter the change data and the transaction price filtered data to obtain the trading volume with the closing price higher than the opening price, and add them together to obtain the first cumulative data, and the second cumulative data is obtained by adding the trading volume contained in the transaction price data.
[0093] 2. The calculation module includes:
[0094] (1) Data acquisition component (axi2Stream component): obtains the stock transaction information, the stock length, and the number of stocks in the DPU memory module; obtains the length information of a single stock based on the stock length and the number of stocks; reads the stock transaction information based on the length information of the single stock to obtain the corresponding stock transaction information to be processed.
[0095] (2) Data extraction component (dataSplit component): converts the stock transaction information to be processed into closing price data, opening price data, highest price data, lowest price data and transaction price data that can be processed by the acceleration core in the DPU; the data streams of the closing price data and the opening price data are divided into two interface outputs, one data stream interface is sent to the data comparison module, and the other data stream is sent to the data filtering module.
[0096] (3) Data comparison component (strmCompare component): It takes two data streams as input and compares each data entry in the two data streams. If the closing price is greater than the opening price, a 1 is output on the output data stream; otherwise, a 0 is output. The output data stream is split into five outputs, each of which is sent to five filter subcomponents.
[0097] (4) Data filter component: The input is two data streams: one is the original data stream and the other is the conditional data stream. The conditional data stream comes from the data comparison module. Each original data corresponds to a conditional data. When the conditional data is 1, the current original data is output; otherwise, it is not output.
[0098] (5) Subtraction component (Strm_sub component): The input is two data streams, and the data in the two data streams are subtracted and output.
[0099] (6) Accumulation component (ACC component): accumulates the input data. After all inputs are accumulated, the first accumulated data and the second accumulated data are output.
[0100] (7) A division calculation component, used to obtain a consistent transaction factor calculation result by dividing the second accumulated data by the first accumulated data.
[0101] The first accumulated data and the second accumulated data are placed on the PCIe register, the second accumulated data is divided by the first accumulated data to obtain a consistent transaction factor calculation result, and the CPU reads the consistent transaction factor calculation result.
[0102] In summary, the present invention provides a method and system for calculating a consistent transaction factor based on a DPU. The method is executed based on a DPU, and the DPU is connected to a CPU via a PCIe bus. The DPU obtains stock transaction information, stock length, and stock quantity scheduled by the CPU from the CPU memory and transmits them to the DPU via the PCIe bus. The stock length and stock quantity are read by an acceleration core to obtain the length information of a single stock. The stock transaction information is read according to the length information of the single stock to obtain the corresponding stock transaction information to be processed; a consistent transaction factor calculation formula that conforms to the DPU calculation is constructed, the stock transaction information to be processed is converted into column data that can be processed by the acceleration core in the DPU, and first accumulated data and second accumulated data are calculated; the first accumulated data represents the sum of the transaction volumes with closing prices higher than opening prices in the column data after the programming and operation of the consistent transaction factor calculation formula, and the second accumulated data represents the sum of the transaction volumes contained in the transaction price data; the first accumulated data and the second accumulated data are respectively transmitted to a first PCIe register and a second PCIe register, and the consistent transaction factor calculation result is obtained by dividing the second accumulated data by the first accumulated data.
[0103] Furthermore, the PCIe bus between the CPU and the DPU of the present invention provides a high-bandwidth data transmission channel. Transferring the first accumulated data and the second accumulated data into the first PCIe register and the second PCIe register respectively can utilize the high-bandwidth data transmission channel to reduce data transmission delay and improve data processing efficiency.
[0104] An embodiment of the present invention further provides a computer device, which may include a processor and a memory, wherein the processor and the memory may be connected via a bus or other means.
[0105] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0106] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as the program instructions / modules corresponding to the method for shielding buttons on an in-vehicle display device in the embodiments of the present invention. The processor executes the non-transitory software programs, instructions, and modules stored in the memory to perform various processor functions and data processing.
[0107] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely located relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0108] The one or more modules are stored in the memory, and when executed by the processor, perform the method described in this embodiment.
[0109] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. When executed by a processor, the computer program implements the steps of the aforementioned edge computing server deployment method. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, floppy disk, hard disk, removable storage disk, CD-ROM, or any other form of storage medium known in the art.
[0110] It should be understood by those skilled in the art that the various exemplary components, systems, and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software, or a combination of both. Whether to implement the system in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention. When implemented in hardware, it may be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The programs or code segments can be stored in a machine-readable medium or transmitted over a transmission medium or communication link via a data signal carried in a carrier wave.
[0111] It should be understood that the present invention is not limited to the specific configurations and processes described above and illustrated in the figures. For the sake of brevity, a detailed description of known methods is omitted. In the above embodiments, several specific steps are described and illustrated as examples. However, the method of the present invention is not limited to the specific steps described and illustrated. Those skilled in the art may make various changes, modifications, and additions, or change the order of the steps after understanding the spirit of the present invention.
[0112] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with or replace features of other embodiments.
[0113] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations to the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.
Claims
1. A method for calculating a consistent transaction factor based on DPU, characterized in that: The method is executed based on a DPU, wherein the DPU is connected to a CPU via a PCIe bus, the CPU deploys a CPU memory, and the DPU deploys a DPU memory and an acceleration core. The method includes: Obtaining stock transaction information, stock length, and stock quantity scheduled by the CPU from the CPU memory; the stock transaction information includes a closing price sequence, an opening price sequence, a highest price sequence, a lowest price sequence, and a transaction price sequence; receiving the stock transaction information, the stock length, and the stock quantity transmitted via the PCIe bus and storing them in the DPU memory, reading the stock length and the stock quantity through the acceleration core to obtain length information of a single stock, and reading the stock transaction information according to the length information of the single stock to obtain corresponding stock transaction information to be processed; Constructing a consistent transaction factor calculation formula that complies with DPU calculations, converting the to-be-processed stock transaction information into column data that can be processed by the acceleration core in the DPU, and calculating first accumulated data and second accumulated data using the column data; the column data includes closing price data, opening price data, highest price data, lowest price data, and transaction price data; the first accumulated data represents the sum of transaction volumes in the column data whose closing price is higher than the opening price after the consistent transaction factor calculation formula has been programmed and run, and the second accumulated data represents the sum of transaction volumes contained in the column data that has not been programmed and run using the consistent transaction factor calculation formula; The first accumulated data and the second accumulated data are respectively transferred into a first PCIe register and a second PCIe register, and a consistent transaction factor calculation result is obtained by dividing the second accumulated data by the first accumulated data.
2. The method for calculating the consistent transaction factor based on DPU according to claim 1, characterized in that: Constructing a consistent transaction factor calculation formula that complies with DPU calculation, converting the to-be-processed stock transaction information into column data that can be processed by the acceleration core in the DPU, and calculating the first accumulated data and the second accumulated data using the column data includes: Converting the to-be-processed stock transaction information into closing price data, opening price data, highest price data, lowest price data, and transaction price data that can be processed by the acceleration core in the DPU; Dividing the closing price data into two paths for filtering and comparison respectively, and dividing the opening price data into two paths for filtering and comparison respectively; filtering the column data according to the comparison result of the closing price data and the opening price data for comparison to obtain closing price filtered data with a closing price higher than the opening price, opening price filtered data, highest price filtered data, lowest price filtered data, and transaction price filtered data; Half of the result of subtracting the highest price filtered data from the lowest price filtered data and the result of subtracting the closing price filtered data from the opening price filtered data are filtered to obtain change data, the change data and the transaction price filtered data are filtered to obtain the trading volume with the closing price higher than the opening price, and the two volumes are added together to obtain first accumulated data, and the second accumulated data is obtained by adding the trading volumes contained in the transaction price data.
3. The method for calculating the consistent transaction factor based on DPU according to claim 1, characterized in that: The method further includes: the consistent transaction factor calculation formula uses parallel calculation to calculate the first accumulated data and the second accumulated data.
4. The method for calculating the consistent transaction factor based on DPU according to claim 1, characterized in that: The method further includes: feeding back the consistent transaction factor to a transaction processing end for market transaction trend analysis, market transaction risk analysis, and market transaction abnormality analysis, and formulating corresponding market transaction strategies based on the analysis results.
5. A consistent transaction factor calculation system based on DPU, characterized in that: The system is used to execute the consistent transaction factor calculation method based on DPU according to claims 1 to 4, and the system includes: CPU memory module, used to store stock transaction information, stock length and stock quantity; A PCIe bus transmission module, configured to transmit the stock transaction information, the stock length, and the stock quantity from the CPU memory module to the DPU; A DPU memory module, configured to receive and store the stock transaction information, the stock length, and the stock quantity via a DPU memory; A calculation module is configured to obtain the length information of a single stock by reading the stock length and the number of stocks through an acceleration core, read the stock trading information according to the length information of the single stock to obtain the corresponding stock trading information to be processed, convert the stock trading information to be processed into column data that can be processed by the acceleration core in the DPU and calculate the first accumulated data and the second accumulated data, and obtain the consistent trading factor calculation result by dividing the second accumulated data by the first accumulated data.
6. The consistent transaction factor calculation system based on DPU according to claim 5, characterized in that: The system further comprises: A cloud storage system is used to store the stock transaction information, the stock length, the number of stocks, the first accumulated data, the second accumulated data and the consistent transaction factor calculation result.
7. The consistent transaction factor calculation system based on DPU according to claim 5, characterized in that: The system further comprises: The analysis module is used to analyze market transaction change trends, market transaction risks and market transaction anomalies based on the consistent transaction factors and formulate corresponding market transaction strategies.
8. The consistent transaction factor calculation system based on DPU according to claim 5, characterized in that: The calculation module includes: a data acquisition component, configured to acquire the stock transaction information, the stock length, and the number of stocks in the DPU memory module; acquire the length information of a single stock based on the stock length and the number of stocks; and read the stock transaction information based on the length information of the single stock to acquire the corresponding stock transaction information to be processed; a data extraction component for converting the to-be-processed stock transaction information into closing price data, opening price data, highest price data, lowest price data, and transaction price data that can be processed by the acceleration core in the DPU; dividing the closing price data into two paths for filtering and comparison, and dividing the opening price data into two paths for filtering and comparison, respectively; A data comparison component is used to compare the closing price data and the opening price data one by one according to the order correspondence; when the closing price of the data point is greater than the opening price, a 1 is output, otherwise a 0 is output; the output data composed of all the outputs is divided into five paths; a data filtering component, configured to receive the five output data and the corresponding closing price data, opening price data, highest price data, lowest price data, and transaction price data using five filtering subcomponents, and output the corresponding closing price filtered data, opening price filtered data, highest price filtered data, lowest price filtered data, and transaction price filtered data when the output data in the five filtering subcomponents is 1, and not output otherwise; a subtraction component, configured to subtract the opening price filtered data from the closing price filtered data to obtain first result data, and to subtract the lowest price filtered data from the highest price filtered data to obtain second result data; an accumulation component, configured to compare the first result data with the second result data, filter the results with the transaction price filtering data, add the transaction volumes for which the closing price is higher than the opening price to obtain first accumulated data, and add the transaction volumes contained in the transaction price data to obtain second accumulated data; A division calculation component is used to obtain a consistent transaction factor calculation result after dividing the second accumulated data by the first accumulated data.
9. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Stock transaction risk monitoring method and device
CN117874066A
Apparatus for trading stock using w-chart technique and method thereof
KR1020150040014A