Resource exchange data processing method and device, computer equipment and storage medium

By dividing the time interval into multiple exchange data statistics windows and processing large-scale resource exchange data, the problem of inefficiency in traditional technologies is solved and efficient backtesting of resource balance strategies is achieved.

CN120179400APending Publication Date: 2025-06-20TENPAY PAYMENT TECHNOLOGY CO LTD SHENZHEN BRANCH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510301052.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-13
Publication Date
2025-06-20

AI Technical Summary

Technical Problem

Traditional technologies are inefficient in processing large-scale resource exchange data, resulting in local overload of computing resources and delayed task queuing.

Method used

By dividing the time interval requested backtest into multiple exchange data statistics windows, the resource exchange data is counted separately, and the data scale is significantly reduced, and the resource balance strategy is backtested based on the data of each statistical window.

Benefits of technology

It effectively reduces the amount of data processed during the backtesting process, releases computing resources, avoids overloading of computing resources and task delays, and improves work efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120179400A_ABST
    Figure CN120179400A_ABST
Patent Text Reader

Abstract

The invention relates to a resource exchange data processing method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: in response to a back test request for a target resource pair, obtaining a resource balance strategy expected to reduce the resource income and expenditure difference of the target resource pair; determining a time interval of the request backtest, and dividing the time interval into a plurality of exchange data statistical windows; for each exchange data statistical window, counting multiple groups of resource exchange data between the first resource and the second resource in the exchange data statistical window, and determining resource exchange statistical data of a target resource pair in the exchange data statistical window; and based on the respective resource exchange statistical data of each exchange data statistical window and the exchange ratio fluctuation data between the first resource and the second resource in the time interval, back testing the resource balance strategy, and determining the validity of the resource balance strategy in the time interval. By adopting the method, the working efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technologies, and in particular, to a method, apparatus, computer device, computer-readable storage medium, and computer program product for processing resource exchange data. Background Art

[0002] With the rapid development of computer technologies, a resource exchange method based on computers has emerged. During the process of providing resource exchange services by service institutions, due to the fluctuations in the resource exchange ratios between different resources, there will be a situation of unbalanced revenue and expenditure. Therefore, service institutions need to execute a resource balancing strategy to reduce the resource revenue and expenditure gap. In this process, the effectiveness of the resource balancing strategy is crucial.

[0003] In traditional technologies, service institutions verify the effectiveness of the resource balancing strategy by obtaining all resource exchange data and resource exchange ratio data within a time interval and performing backtesting on the resource balancing strategy. However, with the continuous growth of the data volume and the accelerating update frequency of resource exchange services, traditional methods mainly rely on a single-machine processing architecture, resulting in local overload of computing resources and task queuing delays. Therefore, traditional technologies face the problem of low efficiency in processing large-scale data. Summary of the Invention

[0004] Based on this, it is necessary to provide a method, apparatus, computer device, computer-readable storage medium, and computer program product for processing resource exchange data that can improve work efficiency in response to the above technical problems.

[0005] In a first aspect, the present application provides a method for processing resource exchange data. The method includes:

[0006] In response to a backtesting request for a target resource pair, obtain a resource balancing strategy for desiring to reduce the resource revenue and expenditure gap of the target resource pair; the target resource pair includes a first resource and a second resource; the resource revenue and expenditure gap changes following the fluctuations in the resource exchange ratio between the first resource and the second resource;

[0007] Determine the time interval for which the backtesting is requested, and divide the time interval into multiple exchange data statistical windows;

[0008] For each of the exchange data statistical windows, count multiple groups of resource exchange data between the first resource and the second resource within the exchange data statistical window, and determine the resource exchange statistical data of the target resource pair in the exchange data statistical window;

[0009] Backtest the resource balance strategy based on the resource exchange statistical data of each of the exchange data statistical windows and the exchange ratio fluctuation data between the first resource and the second resource within the time interval to determine the effectiveness of the resource balance strategy within the time interval.

[0010] In a second aspect, the present application also provides a processing device for resource exchange data. The device includes:

[0011] An acquisition module, configured to acquire a resource balance strategy for reducing the resource balance difference of the target resource pair in response to a backtest request for the target resource pair; the target resource pair includes a first resource and a second resource; the resource balance difference changes following the fluctuation of the resource exchange ratio between the first resource and the second resource;

[0012] A time interval segmentation module, configured to determine the time interval for which the backtest is requested and divide the time interval into multiple exchange data statistical windows;

[0013] A data statistics module, configured to, for each of the exchange data statistical windows, statistically analyze multiple groups of resource exchange data between the first resource and the second resource within the exchange data statistical window, and determine the resource exchange statistical data of the target resource pair in the exchange data statistical window;

[0014] A backtest module, configured to backtest the resource balance strategy based on the resource exchange statistical data of each of the exchange data statistical windows and the exchange ratio fluctuation data between the first resource and the second resource within the time interval to determine the effectiveness of the resource balance strategy within the time interval.

[0015] In a third aspect, the present application also provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, it implements the above-mentioned method for processing resource exchange data.

[0016] In a fourth aspect, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the above-mentioned method for processing resource exchange data.

[0017] In a fifth aspect, the present application also provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, it implements the above-mentioned method for processing resource exchange data.

[0018] The above-mentioned method, apparatus, computer device, computer-readable storage medium, and computer program product for processing resource exchange data, in response to a backtest request for a target resource pair, obtain a resource balancing strategy that expects to reduce the resource balance difference of the target resource pair. Before performing a backtest on the resource balancing strategy, by dividing the time interval requested for backtesting into multiple exchange data statistical windows, and respectively for each exchange data statistical window, statistically analyzing the resource exchange data between the first resource and the second resource, obtaining the resource exchange statistical data corresponding to the target resource pair within each exchange data statistical window, can significantly reduce the data scale of the resource exchange data within the time interval through data statistics. During the process of performing a backtest on the resource balancing strategy, based on the resource exchange statistical data of each exchange data statistical window and the exchange ratio fluctuation data between the first resource and the second resource within the time interval, perform a backtest on the resource balancing strategy to determine the effectiveness of the resource balancing strategy within the time interval. Since the data scale of the resource exchange statistical data is much smaller than the data scale of the original resource exchange data, it is equivalent to effectively reducing the amount of data to be processed during the backtest process, being able to release a certain amount of computing resources, and thus avoiding the situation of local overload of computing resources and task queuing delays, which is beneficial to improving work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 FIG. is an application environment diagram of the method for processing resource exchange data in an embodiment;

[0020] Figure 2 FIG. is a schematic diagram of the process of processing resource exchange data in an embodiment;

[0021] Figure 3 FIG. is a flowchart of the method for processing resource exchange data in an embodiment;

[0022] Figure 4 FIG. is a schematic diagram of multiple exchange data statistical windows included in a time interval in an embodiment;

[0023] Figure 5 FIG. is a flowchart of the method for processing resource exchange data in another embodiment;

[0024] Figure 6 FIG. is a schematic diagram of the process of classifying and storing data in an embodiment;

[0025] Figure 7 FIG. is a schematic diagram of the data collection process in an embodiment;

[0026] Figure 8 FIG. is a schematic diagram of the statistical process of resource exchange data in an embodiment;

[0027] Figure 9Schematic diagram of the statistical process of resource exchange ratio data in an embodiment;

[0028] Figure 10 Schematic diagram of the backtest process for the resource balance strategy in an embodiment;

[0029] Figure 11 Structural block diagram of a processing device for resource exchange data in an embodiment;

[0030] Figure 12 Internal structure diagram of a computer device in an embodiment;

[0031] Figure 13 Internal structure diagram of a computer device in another embodiment. Detailed implementation manners

[0032] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0033] The resource exchange data processing method provided by the embodiments of the present application can be applied to an application environment as Figure 1 shown. Among them, the application terminal 110 communicates with the server 120 through a network. The communication network can be a wired network or a wireless network. Therefore, the application terminal 110 and the server 120 can be directly or indirectly connected through wired or wireless communication methods. For example, the application terminal 110 can be indirectly connected to the server 120 through a wireless access point, or the application terminal 110 can be directly connected to the server 120 through the Internet. The present application does not make any restrictions here.

[0034] Further, the application end 110 may be a terminal, and the server end 120 may be a terminal or a server. Among them, the terminal may be, but is not limited to, various desktop computers, laptop computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things devices may be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. The portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The data storage system can store the data that the server needs to process. The data storage system can be set separately, integrated on the server, or placed on the cloud or other servers.

[0035] The embodiments of the present application can be applied to a resource exchange processing scenario. The resources to be exchanged can be, for example, digital resources, game props, etc. A client related to the resource exchange service can be installed on the application end 110. The client can include an application program that needs to be installed separately, or can include a small program or a web page that can be used without downloading. The server end 120 is the background server corresponding to the client, or a server specifically used for processing resource exchange data.

[0036] In one embodiment, the server end 120 may be the background server of a service institution that provides resource exchange services. The application end 110 may include a first terminal 111 and a second terminal 112. Among them, the first terminal 111 may be the terminal held by a trader of the service institution, and the second terminal 112 may be the terminal held by a service object of the service institution. Specifically, the service object can initiate a resource exchange request to the server end 120 through the second terminal 112 to exchange one type of resource held by itself for another type of resource held by the server end 120. In the process of providing resource exchange services, the server end 120 involves the transfer in and transfer out of various types of resources. A type of resource with a resource income and expenditure difference between the transfer-in amount and the transfer-out amount is called an unbalanced resource. In practical applications, since the resource exchange ratio between different types of resources is not fixed, then, in the case of unbalanced income and expenditure, it is possible to cause a loss of the total amount of resources due to the fluctuation of the resource exchange ratio. Based on this, the server end 120 can execute a pre-determined resource balance strategy to minimize the resource income and expenditure difference of the unbalanced resources. To ensure the balance effect of the resource income and expenditure difference, it is necessary to backtest the resource balance strategy to determine its effectiveness.

[0037] In one embodiment, as Figure 1 shown, a trader of a service institution can initiate a backtest request for a target resource pair to a server 120 through a first terminal 111. Thus, the server 120 can, in response to the backtest request, backtest a resource balance strategy based on the resource exchange data and the interactive ratio fluctuation data of the target resource pair within the time interval requested for backtesting to determine its effectiveness. Furthermore, the server 120 can reduce the resource income and expenditure balance of the target resource pair by executing an effective resource balance strategy. It should be noted that, in some embodiments, the service object of the service institution can also process the resource income and expenditure balance of the resources held by itself through a second terminal 112. Therefore, the backtest request can also be initiated by the service object through the second terminal 112. For ease of understanding, the service institution, the trader, and the service object will be collectively referred to as users hereinafter.

[0038] In one embodiment, as Figure 2 shown, during the process of processing the resource exchange data, the server 120, in response to a backtest request for a target resource pair, obtains a resource balance strategy expected to reduce the resource income and expenditure balance of the target resource pair and determines the time interval requested for backtesting. Then, the server 120 divides this time interval into multiple exchange data statistical windows, such as Figure 2 window 1, window 2, etc. in . Next, the server 120 can, for each exchange data statistical window, count multiple groups of resource exchange data between a first resource and a second resource within this exchange data statistical window and determine the resource exchange statistical data of the target resource pair in this exchange data statistical window. For example, the resource exchange statistical data 1 of the target resource pair in window 1, the resource exchange statistical data 2 of the target resource pair in window 2, etc. Finally, the server 120 can backtest the resource balance strategy based on the respective resource exchange statistical data of each exchange data statistical window and the exchange ratio fluctuation data between the first resource and the second resource within the time interval to determine the effectiveness of this resource balance strategy within the time interval. Among them, the target resource pair includes a first resource and a second resource; the resource income and expenditure balance changes following the fluctuation of the resource exchange ratio between the first resource and the second resource.

[0039] In one embodiment, a method for processing resource exchange data is provided. This method can be applied to a computer device, which can be a terminal or a server. Taking the application of this method to Figure 1 the server 120 in as an example for illustration, in this embodiment, as Figure 3 shown, this method includes the following steps:

[0040] Step S302, in response to a backtest request for a target resource pair, obtain a resource balance strategy expected to reduce the resource income and expenditure balance of this target resource pair.

[0041] Among them, the target resource pair includes a first resource and a second resource. The first resource and the second resource refer to two different resources. The resources in this application may include game props, digital goods, commodity coupons, and so on. In a specific embodiment, the resources may refer to virtual resources circulating on the blockchain, including native digital resources generated by the on-chain processing node through block packaging, and on-chain data published through smart contracts.

[0042] The resource balance of the target resource pair changes with the fluctuation of the resource exchange ratio between the first resource and the second resource. The resource exchange ratio refers to the relative value ratio between different resources during the resource exchange process. The resource exchange ratio between two resources includes a forward exchange ratio and a reverse exchange ratio. Among them, the forward exchange ratio of one resource in a resource pair is equal to the reverse exchange ratio of the other resource, and the forward exchange ratio and the reverse exchange ratio of the same resource in a resource pair are reciprocal to each other. Specifically in this application, the resource exchange ratio between the first resource and the second resource includes a forward exchange ratio and a reverse exchange ratio. Moreover, the forward exchange ratio of the first resource is equal to the reverse exchange ratio of the second resource; the reverse exchange ratio of the first resource is equal to the forward exchange ratio of the second resource. For the first resource, forward exchange means exchanging other resources into the first resource, that is, transferring into the first resource to increase the resource quantity of the first resource; reverse exchange means exchanging the first resource into other resources, that is, transferring out the first resource to reduce the resource quantity of the first resource. The other resources may include the second resource and other types of resources other than the second resource. For the sake of understanding, this application only considers the conversion between the two resources in the target resource pair.

[0043] In the process of providing resource exchange services, the service institution involves the transfer in and transfer out of various types of resources, which will inevitably cause an imbalance between income and expenditure. A type of resource with a resource balance between the transfer-in amount and the transfer-out amount is called an unbalanced resource. Exemplarily, the transfer-in amount of resource A is A1, and the transfer-out amount is A2. If A1 is not equal to A2, then there is a resource balance for the resource A held by the service institution. And the resource balances of the two resources in a resource pair can be value-accounted based on the resource exchange ratio of these two resources to determine the resource balance of the resource pair. For example, when the resource balance of the target resource pair is to hold the first resource (that is, there is a surplus in the first resource and a deficit in the second resource), if the resource exchange ratio of the first resource to the second resource decreases, it will lead to a decrease in the value of the held first resource (that is, the resource balance).

[0044] The resource balance strategy for a target resource pair refers to a series of operations taken by a service institution to manage the resource income and expenditure balance. Its purpose is to reduce the resource income and expenditure balance of the target resource pair through timely adjustment, and then control the risks brought by the resource income and expenditure balance within an acceptable range. For example, this resource balance strategy can include triggering reverse exchange or hedging at fixed time nodes to eliminate the resource income and expenditure balance, and can also include, when the resource income and expenditure balance reaches the upper limit, conducting reverse exchange or hedging for the excess part, or triggering reverse exchange or hedging to eliminate the resource income and expenditure balance when the resource income and expenditure balance reaches the upper limit, and so on.

[0045] Backtesting is a way to evaluate the effectiveness of a resource balance strategy. It selects historical data, simulates trading according to the resource balance strategy, and records the trading results. Finally, it evaluates the effectiveness of the resource balance strategy based on the degree of reduction in the resource income and expenditure balance due to the execution of the resource balance strategy. Since the data used in the backtesting process is determined historical data, the backtesting results are also determined and will not be affected by other fluctuating factors. Therefore, the effectiveness of the resource balance strategy can be evaluated relatively objectively through backtesting.

[0046] In practical applications, service institutions usually execute corresponding resource balance strategies for different resource pairs respectively to reduce the resource income and expenditure balance of that resource pair, rather than uniformly handling the resource income and expenditure balances generated by all resource pairs, to ensure the accuracy and effectiveness of risk control. Specifically, users can initiate a backtesting request for a target resource pair to the server through the application end. The specific way for the application end to trigger the backtesting request can be, for example, opening the page of the backtesting service or clicking on the control of the backtesting service, etc. The server can respond to this trigger operation and obtain the resource balance strategy for the target resource pair. Thus, the server can respond to this backtesting request and obtain the resource balance strategy that is expected to reduce the resource income and expenditure balance of this target resource pair.

[0047] It can be understood that if the number of target resource pairs is multiple groups, that is, conducting backtesting of the resource balance strategy for multiple groups of resource pairs simultaneously, only the statistical data range needs to be expanded to include the respective resource exchange data of each target resource pair. For the sake of easy understanding, the following will take the case where the number of target resource pairs is one group as an example for illustration.

[0048] In an alternative embodiment, the server can match a corresponding resource balance strategy according to the resource types included in the target resource pair.

[0049] In an alternative embodiment, the backtesting request can carry the resource pair information of the target resource pair and the resource balance strategy for the target resource pair. Thus, the server can obtain the resource balance strategy that is expected to reduce the resource income and expenditure balance of this target resource pair by parsing this backtesting request.

[0050] Step S304: Determine the time interval for the requested backtest, and divide this time interval into multiple exchange data statistical windows.

[0051] Among them, the time interval for the backtest is usually determined by the start time and the end time. The start time can be a certain day in the past, and the end time can be a fixed or random interval, or the expected holding time can be referred to. This time interval is a time interval that has passed, that is, a historical time interval. The exchange data statistical window refers to the time window used to statistically analyze resource exchange data, usually defined by the start time and the end time. A time interval can include multiple exchange data statistical windows, that is, the duration of the time interval is greater than the window duration of any one exchange data statistical window.

[0052] Specifically, when the server obtains the resource balancing strategy for the requested backtest, it can further determine the time interval for the requested backtest. In an alternative embodiment, the user can select the time interval for the requested backtest when initiating the backtest request, and the server can determine the time interval for the requested backtest according to the selection result. In an alternative embodiment, the server can determine the time interval for the requested backtest according to the complexity of the resource balancing strategy. Among them, the more complex the resource balancing strategy, the longer the duration of the time interval.

[0053] Then, the server can divide the time interval into multiple exchange data statistical windows. Among them, the multiple exchange data statistical windows can have the same window duration or different window durations. Taking the case where each exchange data statistical window has the same window duration as an example. Optionally, the server can provide multiple candidate periods to the application side, and in response to the selection event of the target period among the candidate periods by the application side, determine the duration of the target period as the window duration of the exchange data statistical window, and then divide the time interval into multiple exchange data statistical windows according to this window duration. Optionally, the server can determine the window duration that is positively correlated with the duration of the time interval, and divide the time interval into multiple exchange data statistical windows according to this window duration. For example, when the duration of the time interval is 1 month, the window duration of the corresponding exchange data statistical window can be 10 minutes; when the duration of the time interval is 3 months, the window duration of the corresponding exchange data statistical window can be 1 hour.

[0054] Step S306: For each exchange data statistical window, statistically analyze multiple groups of resource exchange data between the first resource and the second resource within this exchange data statistical window, and determine the resource exchange statistical data of the target resource pair in this exchange data statistical window.

[0055] Among them, the resource exchange data between two resources may include the respective exchange directions and exchange volumes of these two resources. The exchange direction may include a forward exchange that increases the resource volume and a reverse exchange that decreases the resource volume. The exchange directions of the two resources in a set of resource exchange data are different. That is, the exchange directions of the first resource and the second resource in a set of resource exchange data are respectively a forward exchange and a reverse exchange. The exchange volume is used to characterize the resource increase amount or the resource decrease amount. It can be understood that the ratio of the exchange volumes of the two resources in a set of resource exchange data is the resource exchange ratio of these two resources when the resource exchange event occurs.

[0056] In practical applications, since backtesting is based on historical data and the time interval is a historical interval, the exchange data statistical window included in this time interval is also a historical window. Based on this, the server can obtain multiple sets of resource exchange data between the first resource and the second resource in each exchange data statistical window, and determine the respective resource exchange statistical data of the target resource pair in each exchange data statistical window by statistically analyzing these resource exchange data.

[0057] In an alternative embodiment, the server can obtain the resource exchange data of multiple resource exchange events between the first resource and the second resource in each exchange data statistical window, and then for each exchange data statistical window, statistically analyze the multiple sets of resource exchange data between the first resource and the second resource in this exchange data statistical window according to the number of groups of resource exchange data in this exchange data statistical window, and determine the resource exchange statistical data of the target resource pair in this exchange data statistical window. For example, the server can statistically analyze every N groups of resource exchange data into one group of resource exchange statistical data. N can be 5 or 10, etc. For another example, the server can determine the number of groups of statistical data Y that is positively correlated with this data volume according to the number of groups of resource exchange data X in an exchange data statistical window, and then evenly statistically analyze the groups of resource exchange data in this exchange data statistical window to obtain Y groups of resource exchange statistical data. Among them, performing even statistical analysis means that the difference in the number of groups of resource exchange data statistically analyzed by different resource exchange statistical data is less than or equal to the difference threshold.

[0058] In an alternative embodiment, the server can obtain the resource exchange data of multiple resource exchange events between the first resource and the second resource in each exchange data statistical window, and then for each exchange data statistical window, statistically analyze the respective exchange volumes of the first resource and the second resource in this exchange data statistical window, and determine the resource exchange statistical data of the target resource pair in this exchange data statistical window.

[0059] Step S308: Based on the resource exchange statistical data of each exchange data statistical window and the exchange ratio fluctuation data between the first resource and the second resource within the time interval, backtest the resource balance strategy to determine the effectiveness of the resource balance strategy within the time interval.

[0060] Among them, the exchange ratio fluctuation data refers to the data of the fluctuation of the resource exchange ratio over time. Specifically, the server can backtest the resource balance strategy based on the resource exchange statistical data of each exchange data statistical window and the data of the fluctuation of the resource exchange ratio between the first resource and the second resource over time within the time interval to determine the effectiveness of the resource balance strategy within the time interval.

[0061] In an optional embodiment, the server can use the resource exchange statistical data of each exchange data statistical window and the exchange ratio fluctuation data between the first resource and the second resource within the time interval as historical data and input them into the backtest system. These data will be converted into a series of events (events) and trigger three key actions: one is to update the resource balance, that is, to adjust the risk balance in real time according to the scenario changes and strategy requirements; the second is to execute a close position, that is, to eliminate part or all of the resource balance by implementing the resource balance strategy to control risks; the third is to update the profit and loss, that is, to calculate the gain or loss of the resource volume of the actually held resources according to the result after the close position. The above process can be dynamically adjusted in combination with risk management tools (such as VaR, CVaR, etc.), and the effectiveness and stability of the resource balance strategy can be verified through historical data.

[0062] The above method for processing resource exchange data, in response to a backtest request for a target resource pair, obtains a resource balance strategy that is expected to reduce the resource balance of the target resource pair. Before backtesting the resource balance strategy, by dividing the time interval requested for backtesting into multiple exchange data statistical windows and respectively statistically analyzing the resource exchange data between the first resource and the second resource for each exchange data statistical window, the resource exchange statistical data corresponding to the target resource pair within each exchange data statistical window can be obtained, and the data scale of the resource exchange data within the time interval can be significantly reduced through data statistics. During the process of backtesting the resource balance strategy, based on the resource exchange statistical data of each exchange data statistical window and the exchange ratio fluctuation data between the first resource and the second resource within the time interval, backtest the resource balance strategy to determine the effectiveness of the resource balance strategy within the time interval. Since the data scale of the resource exchange statistical data is much smaller than the data scale of the original resource exchange data, it is equivalent to effectively reducing the amount of data to be processed during the backtest process, which can release a certain amount of computing resources, and thus avoid the situation of local overload of computing resources and task queuing delay, which is beneficial to improving work efficiency.

[0063] In one embodiment, a time interval is divided into multiple exchange data statistical windows, including: determining a cycle duration matching a backtest request; and dividing the time interval into multiple periodically distributed exchange data statistical windows according to the cycle duration.

[0064] Wherein, the window duration of a single exchange data statistical window is positively correlated with the cycle duration. Two variables being positively correlated means that the directions of change of these two variables are the same, but it does not require that when one variable changes a little, the other variable must also change. For example, it can be set that when variable a is from 10 to 20, variable b is 100, and when variable a is from 20 to 30, variable b is 120. In this way, the change directions of a and b are both that when a becomes larger, b also becomes larger. However, within the range of a from 10 to 20, b can remain unchanged. Further, the window durations of each of the exchange data statistical windows can be the same or different. And each window duration can be equal to the cycle duration, or can be greater than or less than the cycle duration. That the multiple exchange data statistical windows conform to a periodic distribution can mean that the window durations of each of the exchange data statistical windows are the same, that is, the window durations themselves conform to a periodic distribution, or can mean that the change situation of the window durations of the exchange data statistical windows conforms to a periodic distribution. For example, increasing in sequence, increasing first and then decreasing, and so on. Exemplarily, as Figure 4 shown, the window durations of each of the multiple exchange data statistical windows 402 obtained by dividing the time interval 401 satisfy a periodic distribution of "increase - decrease - increase - decrease".

[0065] Specifically, the server can determine the cycle duration matching the backtest request, and then divide the time interval into multiple periodically distributed exchange data statistical windows according to the cycle duration. Optionally, the server can divide the time interval into multiple exchange data statistical windows with the same window duration according to the cycle duration. Wherein, the window duration of each exchange data statistical window is the cycle duration. Optionally, the server can determine the window scaling amplitude of the periodic distribution on the basis of the cycle duration, and then combine the cycle duration and each window scaling amplitude to divide the time interval into multiple exchange data statistical windows with the same window duration. Exemplarily, if the cycle duration is 10 minutes and the window scaling amplitude of the periodic distribution is "+10%, -10%, +10%, -10%...", then the window durations of the obtained exchange data statistical windows can be 11 minutes, 9 minutes, 11 minutes, 9 minutes... in sequence.

[0066] Further, the way for the server to determine the cycle duration is not unique.

[0067] In an alternative embodiment, the server may determine a cycle duration that matches the backtest request according to the duration of the time interval. The cycle duration is positively correlated with the interval duration.

[0068] In an alternative embodiment, the server may determine the user type targeted by the backtest request, and further determine the cycle duration that matches the user type as the cycle duration that matches the backtest request. Specifically, on the basis of executing corresponding resource balancing strategies for each resource pair, considering that the trading characteristics and requirements of different user types are different, in order to further improve the accuracy of risk control, the server may further execute resource balancing strategies according to user types for the same resource pair. The user types may include B-end users (Business Users) and C-end users (Consumer Users). During the process of resource exchange, C-end users have a high trading frequency but a small single transaction volume. When balancing the resource income and expenditure difference, they usually pursue efficiency more. Based on this, the server may match a relatively short cycle duration for C-end users to further ensure work efficiency; during the process of resource exchange, B-end users have a low trading frequency but a large single transaction volume. When balancing the resource income and expenditure difference, they usually pursue effect more. Based on this, the server may match a relatively long cycle duration for B-end users to ensure the accuracy of the backtest results.

[0069] In the above embodiment, determining the cycle duration that matches the backtest request and dividing the time interval into multiple exchange data statistical windows with periodic distribution according to the cycle duration can determine the exchange data statistical window whose window duration matches the backtest request, thereby ensuring that the obtained exchange data statistical window can adapt to the actual application requirements and ensuring the accuracy of the backtest results while improving work efficiency.

[0070] In an alternative embodiment, determining the cycle duration that matches the backtest request includes: determining a cycle interval that matches the time interval based on the duration of the time interval; in response to a selection event for a target cycle among multiple candidate cycles within the cycle interval, determining the duration of the target cycle as the cycle duration that matches the time interval.

[0071] Among them, the interval boundaries of the cycle interval refer to the starting point and the ending point of the time range of the cycle interval. The starting point corresponds to the interval lower limit, and the ending point corresponds to the interval upper limit. The cycle interval may specifically be a closed interval, an open interval, or a semi-closed and semi-open interval, which is not limited in this embodiment. Exemplarily, when the cycle interval is a closed interval [T1, T2], the corresponding interval boundaries include the interval lower limit "T1" and the interval upper limit "T2". Further, at least one of the interval boundaries of the cycle interval being positively correlated with the interval duration means that at least one of the above interval upper limit or interval lower limit is positively correlated with the interval duration.

[0072] Specifically, the server can determine a periodic interval that matches the time interval based on the duration of the time interval. Multiple candidate periods included in the periodic interval are provided as candidates for the application side to select. Furthermore, the server can, in response to a selection event of the application side for a target period among the multiple candidate periods within the periodic interval, determine the duration of the target period as the periodic duration that matches the time interval. Exemplarily, when the interval duration is one month, the server can determine that the periodic interval that matches the time interval is [5 minutes, 30 minutes]; when the interval duration is one week, the server can determine that the periodic interval that matches the time interval is [1 minute, 10 minutes].

[0073] In the above embodiments, by determining at least one periodic interval whose interval boundary is positively correlated with the interval duration, using the multiple candidate periods in the periodic interval as candidates for the application side to select, and using the duration of the target period selected by the application side as the periodic duration that matches the time interval, it is possible to ensure the adaptability of the periodic duration to the actual application requirements while taking flexibility into account, and thus ensure the accuracy of the backtest results.

[0074] In an alternative embodiment, the time interval is divided into a plurality of periodically distributed exchange data statistical windows according to the periodic duration, including: dividing the time interval into a plurality of initial windows with the same window duration according to the periodic duration; for each initial window, determining the event quantity of the resource exchange events that occur between the first resource and the second resource within the initial window; and when the initial window meets the window adjustment condition, adjusting the initial window according to the numerical relationship between the event quantity and the event quantity threshold to obtain the exchange data statistical window.

[0075] Among them, the window duration of the initial window is the periodic duration. Optionally, when the interval duration of the time interval cannot be evenly divided by the periodic duration, the last initial window can be partially overlapped with the penultimate initial window to ensure that the window duration of each initial window is the periodic duration.

[0076] The resource exchange event between the first resource and the second resource includes a forward exchange event of exchanging the first resource for the second resource and a reverse exchange event of exchanging the second resource for the first resource. The event quantity of the resource exchange event refers to the number of times of resource exchange. The window adjustment condition is characterized by the event quantity threshold. The window adjustment condition can include at least one of the two conditions that the event quantity is greater than or equal to the event quantity threshold or the event quantity is less than or equal to the event quantity threshold.

[0077] Specifically, the server can first equally divide a time interval into multiple initial windows with the same window duration according to the cycle duration. Then, it can respectively determine the event quantities of the resource exchange events that occur between the first resource and the second resource within each initial window. Next, the server can compare the event quantity corresponding to the initial window with an event quantity threshold representing the window adjustment condition to determine whether the initial window meets the window adjustment condition. When the initial window meets the window adjustment condition, the initial window can be adjusted according to the numerical relationship between the event quantity and the event quantity threshold to obtain an exchange data statistical window. Further, when the initial window does not meet the window adjustment condition, the initial window is determined as the exchange data statistical window.

[0078] Optionally, based on multiple events that occur within the initial window, the server can determine the event type of each event and the resource types involved in each event according to the event records of each event. Then, from these events, resource exchange events with the event type of resource exchange and the resource types involved including the first resource and the second resource are filtered out, so as to determine the event quantity of the resource exchange events that occur between the first resource and the second resource within the initial window.

[0079] Optionally, when the event quantity is greater than or equal to the event quantity threshold, the server can split the initial window into multiple exchange data statistical windows with event quantities less than the event quantity threshold to ensure that as much original data information as possible is retained while compressing the data, thereby improving the accuracy of the processing result. For example, the number of resource exchange events on weekdays is relatively large and the exchange frequency is high, and exchange data statistical windows with relatively small window durations can be split based on the initial window.

[0080] Optionally, when the event quantity is less than or equal to the event quantity threshold, the server can merge the initial window with an adjacent exchange data statistical window to obtain a merged exchange data statistical window, so as to further reduce the data scale and improve work efficiency. For example, the number of resource exchange events on non-working days is relatively small and the exchange frequency is low, and exchange data statistical windows with relatively large window durations can be merged based on the initial window.

[0081] In the above embodiments, the time interval is first divided into multiple initial windows with the same exchange data statistical window according to the cycle duration, and then the window is adjusted according to the number of resource exchanges in each initial window. The exchange data statistical window for data compression can be determined from two dimensions of duration and the number of resource exchanges, taking into account both work efficiency and the accuracy of the data processing result.

[0082] In an alternative embodiment, the server may determine a periodic interval matching the time interval based on the duration of the time interval, and in response to a selection event of a target period among multiple candidate periods within the periodic interval by the application side, determine the duration of the selected target period as the periodic duration matching the time interval. Then, according to the periodic duration, divide the time interval into multiple initial windows with the same window duration; for each initial window, determine the event volume of the resource exchange event that occurs between the first resource and the second resource within the initial window; when the initial window meets the window adjustment condition, adjust the initial window according to the numerical relationship between the event volume and the event volume threshold to obtain an exchange data statistical window; when the initial window does not meet the window adjustment condition, determine the initial window as the exchange data statistical window. Among them, at least one interval boundary of the periodic interval is positively correlated with the interval duration; the window duration of the initial window is the periodic duration; the window adjustment condition is characterized by the event volume threshold.

[0083] In a specific implementation, the event volume threshold includes an event volume upper limit and an event volume lower limit. In the case of this embodiment, adjusting the initial window according to the numerical relationship between the event volume and the event volume threshold to obtain an exchange data statistical window includes: when the event volume is greater than or equal to the event volume upper limit, splitting the initial window into multiple exchange data statistical windows; when the event volume is less than or equal to the event volume lower limit, determining the exchange data statistical window based on the merging result of the initial window and adjacent exchange data statistical windows.

[0084] Among them, the event volume corresponding to the exchange data statistical window is greater than the event volume lower limit and less than the event volume upper limit. That is to say, the server can obtain multiple exchange data statistical windows with event volumes greater than the event volume lower limit and less than the event volume upper limit by splitting or merging the initial windows.

[0085] Specifically, the server may determine the event volume corresponding to each initial window, and when the event volume is greater than or equal to the event volume upper limit, split the initial window into multiple exchange data statistical windows with event volumes less than the event volume upper limit. When the event volume is less than or equal to the event volume lower limit, the server may merge the initial window with at least one adjacent exchange data statistical window to obtain a merged window with an event volume greater than the event volume lower limit. If the event volume corresponding to the merged window is greater than the event volume lower limit and less than the event volume upper limit, the merged window may be determined as the exchange data statistical window; if the merged window still meets the window adjustment condition, perform the next round of window splitting or merging until multiple exchange data statistical windows that do not meet the window adjustment condition are obtained. Among them, the window meets the window adjustment condition means that the event volume corresponding to the window is greater than or equal to the event volume upper limit, or less than or equal to the event volume lower limit.

[0086] Optionally, during the window splitting process, based on the principle of event volume balance, the initial window can be split into multiple exchange data statistical windows with an event volume difference less than the difference threshold. For example, when the upper limit of the event volume is 100 and the event volume corresponding to the initial window is 120, the server can split the initial window into three exchange data statistical windows with an event volume of 40 each.

[0087] Optionally, during the window merging process, the server can merge the initial window with an adjacent exchange data statistical window having a relatively smaller event volume.

[0088] It should be noted that during the window splitting process, if the event volume corresponding to the initial window is greater than twice the lower limit of the event volume, the number of window splits can be determined based on the lower limit of the event volume to avoid the event volume corresponding to the exchange data statistical window after splitting being less than or equal to the lower limit of the event volume. Taking the case where the upper limit of the event volume is 100 and the event volume corresponding to the initial window is 120 as an example, if the lower limit of the event volume is less than 40, the exchange data statistical window can be split in the above manner. If the lower limit of the event volume is greater than or equal to 40, the initial window needs to be split into two exchange data statistical windows. If the event volume corresponding to the initial window is less than or equal to twice the lower limit of the event volume, an exchange data statistical window with an event volume greater than the lower limit of the event volume and less than the upper limit of the event volume, and an intermediate window with an event volume less than the lower limit of the event volume can be obtained by splitting the initial window first, and then the intermediate window can be merged to obtain an exchange data statistical window that meets the conditions.

[0089] In the above embodiments, when the initial window meets the window adjustment conditions characterized by the upper limit and the lower limit of the event volume, the exchange data statistical window is obtained by splitting or merging, which can ensure the balance of the event volume included in the exchange data statistical window, and further balance the work efficiency and work effect.

[0090] In one of the embodiments, multiple groups of resource exchange data between the first resource and the second resource within the exchange data statistical window are statistically analyzed to determine the resource exchange statistical data of the target resource pair in the exchange data statistical window, including: obtaining the resource exchange data of each of the multiple resource exchange events between the first resource and the second resource within the exchange data statistical window; respectively statistically analyzing the exchange volumes of the first resource and the second resource within the exchange data statistical window to determine the resource exchange statistical data of the target resource pair in the exchange data statistical window.

[0091] Among them, the resource exchange data includes the exchange amounts of the first resource and the second resource respectively, and the resource exchange statistical data includes the exchange statistical amounts of the first resource and the second resource respectively. Specifically, the server can obtain the resource exchange data of each of the multiple resource exchange events between the first resource and the second resource within the exchange data statistical window, and respectively perform exchange amount statistics on the first resource and the second resource according to the exchange amounts in each resource exchange data, so as to determine the resource exchange statistical data of the target resource pair in the exchange data statistical window.

[0092] Optionally, the server can respectively perform statistics on the exchange amounts of the first resource and the second resource within the exchange data statistical window to determine a set of resource exchange statistical data of the target resource pair in the exchange data statistical window. This resource exchange statistical data includes the exchange statistical amount of the first resource and the exchange statistical amount of the second resource. That is to say, the server can merge the groups of resource exchange data within the exchange data statistical window into a set of resource exchange statistical data through exchange amount statistics, thereby reducing the data scale. Exemplarily, when each group of resource exchange statistical data includes "first resource - A1, second resource + B1", "first resource - A2, second resource + B2", "first resource + A3, second resource - B3", and "first resource + A4, second resource - B4", the resource exchange statistical data obtained by statistics can be "first resource An, second resource Bn", where An = -A1 - A2 + A3 + A4, and Bn = B1 + B2 - B3 - B4. "First resource - A1, second resource + B1" means "exchanging A1 amount of the first resource for B1 amount of the second resource". It can be understood that A1 / B1 is the resource exchange ratio of the first resource relative to the second resource when the resource exchange event occurs.

[0093] In the above embodiment, by respectively performing statistics on the exchange amounts of the first resource and the second resource within the exchange data statistical window to determine the resource exchange statistical data of the target resource pair in the exchange data statistical window, it is possible to merge multiple groups of resource exchange data into a set of resource exchange statistical data, reduce the data scale, and is beneficial to improving work efficiency.

[0094] In an optional embodiment, respectively performing statistics on the exchange amounts of the first resource and the second resource within the exchange data statistical window to determine the resource exchange statistical data of the target resource pair in the exchange data statistical window includes: for each group of resource exchange data within the exchange data statistical window, determining the exchange directions of the first resource and the second resource respectively; according to the exchange directions of the first resource or the second resource, respectively performing statistics on the exchange amounts of the first resource and the second resource to determine the resource exchange statistical data of the target resource pair corresponding to different exchange directions respectively.

[0095] Among them, the exchange direction may include a forward exchange that increases the resource quantity and a reverse exchange that decreases the resource quantity. Since a resource exchange event exchanges one resource for another, in a set of resource exchange data, the exchange directions of the first resource and the second resource are opposite to each other: the first resource is for forward exchange and the second resource is for reverse exchange, or the first resource is for reverse exchange and the second resource is for forward exchange.

[0096] Specifically, the server can, for each set of resource exchange data within the exchange data statistics window, determine the exchange directions of the first resource and the second resource respectively according to the change direction of the resource quantity in the resource exchange data: if the change direction of the resource quantity is an increase, the exchange direction is a forward exchange; if the change direction of the resource quantity is a decrease, the exchange direction is a reverse exchange. Then, the server further statistically calculates the exchange quantities of the first resource and the second resource respectively according to the exchange direction of the first resource or the second resource, and determines the resource exchange statistical data corresponding to different exchange directions for the target resource pair in the exchange data statistics window. That is to say, the server can perform exchange quantity statistics according to the exchange direction, and merge the groups of resource exchange data within the exchange data statistics window into two groups of resource exchange statistical data, so as to reduce the data scale.

[0097] Exemplarily, when the groups of resource exchange statistical data include "first resource - A1, second resource + B1", "first resource - A2, second resource + B2", "first resource + A3, second resource - B3", and "first resource + A4, second resource - B4", where "+" corresponds to forward exchange and "-" corresponds to reverse exchange, then according to the exchange direction of the first resource or the second resource, the resource exchange statistical data in the case of forward exchange of the first resource (or reverse exchange of the second resource) can be statistically obtained as "first resource + Ai, second resource - Bi", and the resource exchange statistical data in the case of reverse exchange of the first resource (or forward exchange of the second resource) can be statistically obtained as "first resource - Aj, second resource + Bj". Among them, Ai = A3 + A4, Bi = B3 + B4, Aj = A1 + A2, Bj = B1 + B2.

[0098] In the above embodiments, by distinguishing the exchange directions of different resources and performing exchange quantity statistics according to the exchange directions, the groups of resource exchange data within the exchange data statistics window are merged into two groups of resource exchange statistical data, which can reduce the data scale while retaining as much original information as possible, and can achieve a balance between work efficiency and the accuracy of data processing results.

[0099] In one embodiment, multiple groups of resource exchange data between a first resource and a second resource within a statistical exchange data statistical window are counted, and resource exchange statistical data for a target resource pair in the exchange data statistical window is determined, including: determining multiple preprocessing windows included in the exchange data statistical window; for each preprocessing window, determining the resource exchange statistical data between the first resource and the second resource in the preprocessing window; counting the resource exchange statistical data of each preprocessing window respectively, and determining the resource exchange statistical data for the target resource pair in the exchange data statistical window.

[0100] In practical applications, for an exchange data statistical window, based on the preprocessing windows, the resource exchange statistical data corresponding to the exchange data statistical window can be obtained through multiple data statistics to improve work efficiency. A preprocessing window is a data statistical window applied before the last data statistic. Exemplarily, for a 10-minute exchange data statistical window, the preprocessing window can include at least one of a 1-minute window, a 2-minute window, or a 5-minute window, etc. That is, the server can first determine the resource exchange statistical data corresponding to the preprocessing window, and then perform further statistics to obtain the resource exchange statistical data of the exchange data statistical window to which the preprocessing window belongs.

[0101] Specifically, the server can determine multiple preprocessing windows included in the exchange data statistical window. Then, for each preprocessing window, determine the resource exchange statistical data between the first resource and the second resource in the preprocessing window, and by counting the resource exchange statistical data of each preprocessing window respectively, determine the resource exchange statistical data for the target resource pair in the exchange data statistical window.

[0102] It should be noted that the resource exchange statistical data of each preprocessing window can be pre-statistically obtained or can be obtained through real-time statistics after the exchange data statistical window is divided into multiple preprocessing windows. For the data statistical method for the preprocessing window, refer to the data statistical method for the exchange data statistical window in the above text, which will not be elaborated here.

[0103] In an alternative embodiment, the server can pre-determine multiple preprocessing windows according to a relatively small window duration, and by pre-statistically counting multiple groups of resource exchange data between the first resource and the second resource in each preprocessing candidate window respectively, obtain the resource exchange statistical data of each preprocessing window. Thus, in subsequent application processes, in the face of an exchange data statistical window with a relatively long window duration, further statistics can be performed based on the resource exchange statistical data of each preprocessing window to obtain the resource exchange statistical data corresponding to the exchange data statistical window. Exemplarily, the resource exchange statistical data for a 10-minute exchange data statistical window can be further statistically obtained based on the statistical data of a 1-minute preprocessing window.

[0104] In an optional embodiment, the server may determine the resource exchange statistical data of the exchange data statistical window through multiple rounds of statistics according to multiple-duration preprocessing windows. For example, for a 30-minute exchange data statistical window, the server may first obtain the resource exchange statistical data of a 5-minute preprocessing window based on the resource exchange statistical data of a 1-minute preprocessing window, and then further obtain the resource exchange statistical data of the 30-minute exchange data statistical window.

[0105] In the above embodiment, based on the resource exchange statistical data corresponding to the multiple preprocessing windows included in the exchange data statistical window, further statistics are performed to obtain the resource exchange statistical data of the target resource pair in the exchange data statistical window. The data can be processed in stages, reducing the amount of data processed at one time, reducing the pressure of processing a large amount of data at once, optimizing storage and computing resources, and thus improving the overall efficiency.

[0106] The specific manner in which the server determines the multiple preprocessing windows included in the exchange data statistical window is not unique.

[0107] In an optional embodiment, the server may divide the exchange data statistical window into multiple periodically distributed preprocessing windows according to the window duration of the exchange data statistical window. For the specific manner of dividing the exchange data statistical window into preprocessing windows, refer to the manner of dividing the time interval into exchange data statistical windows above, which will not be elaborated here. Optionally, the server may divide the exchange data statistical window into multiple preprocessing windows with the same window duration according to the window duration of the exchange data statistical window. For example, a 10-minute exchange data statistical window may be divided into 10 1-minute preprocessing windows.

[0108] In an optional embodiment, the server may obtain multiple preprocessing candidate windows including resource exchange statistical data, and then determine the multiple preprocessing windows included in the exchange data statistical window from each preprocessing candidate window. In practical applications, to improve work efficiency, resource exchange data statistics may be performed in advance for multiple preprocessing candidate windows to obtain the corresponding resource exchange statistical data. Thus, the server may determine the preprocessing windows included in the exchange data statistical window from the preprocessing candidate windows for which the resource exchange statistical data has been pre-statistically obtained. For example, if the server has pre-statistically performed resource exchange data statistics for the first 10 minutes of each hour with a 1-minute preprocessing candidate window, then in the case where the exchange data statistical window is the time window represented by "8:00 - 9:00", the preprocessing candidate window between 8:00 and 8:10 may be determined as the multiple preprocessing windows of this exchange data statistical window, thus eliminating the need to repeat data statistics for the original resource exchange data and facilitating the improvement of work efficiency.

[0109] It can be understood that in multiple preprocessing candidate windows including resource exchange statistical data, if there is an exchange data statistical window, the server can directly use the pre-determined resource exchange statistical data without performing real-time data statistics.

[0110] In an optional embodiment, the server can first determine multiple preprocessing windows included in the exchange data statistical window from multiple preprocessing candidate windows including resource exchange statistical data; in the case where each preprocessing window cannot fully cover the exchange data statistical window, then according to the window duration of the remaining part not covered by each preprocessing window, divide the remaining window into multiple periodically distributed preprocessing windows. For example, for the exchange data statistical window "8:00 - 9:00", the preprocessing window selected from the preprocessing candidate windows can cover 8:00 - 8:10, and for the remaining part not covered (i.e., 8:10 - 9:00), the server can divide it into multiple preprocessing windows with a duration of 1 minute.

[0111] In the above embodiments, multiple methods for determining the preprocessing window are provided, which can be flexibly selected according to the actual situation, facilitating the improvement of the scientific nature of the data processing process.

[0112] In one of the embodiments, based on the resource exchange statistical data of each exchange data statistical window and the exchange ratio fluctuation data between the first resource and the second resource within the time interval, backtest the resource balance strategy to determine the effectiveness of the resource balance strategy within the time interval, including: obtaining the exchange ratio fluctuation data between the first resource and the second resource within the time interval; for each exchange data statistical window, according to the ratio data statistical window matching the exchange data statistical window, respectively count the resource exchange ratio between the first resource and the second resource within each ratio data statistical window, and determine the exchange ratio statistical data of each ratio data statistical window; based on the resource exchange statistical data of each exchange data statistical window and the exchange ratio statistical data corresponding to each exchange data statistical window respectively, backtest the resource balance strategy to determine the effectiveness of the resource balance strategy within the time interval.

[0113] Among them, the exchange ratio fluctuation data refers to the fluctuation data of the resource exchange ratio over time. The ratio data statistical window is the window for statistically analyzing the resource exchange ratio. It can be understood that the window duration of the ratio data statistical window is less than or equal to the window duration of the exchange data statistical window for statistically analyzing the resource exchange data, and the window durations of each ratio data statistical window can be the same or different.

[0114] In an alternative embodiment, the window duration of the ratio data statistical window is less than that of the exchange data statistical window, so as to better simulate the actual resource exchange scenario and improve the accuracy of the backtest results. For example, the ratio data statistical window can be a time window of 1 minute or less than 1 minute, and the exchange data statistical window can be a 10-minute window.

[0115] In an alternative embodiment, the server can divide the exchange data statistical window into multiple ratio data statistical windows with the same window duration.

[0116] The exchange ratio statistical data can include the maximum value, minimum value, average value, closing value, etc. Among them, the closing value refers to the last resource exchange ratio in the ratio data statistical window.

[0117] Specifically, the server can obtain the exchange ratio fluctuation data between the first resource and the second resource within the time interval. Then, for each exchange data statistical window, according to the ratio data statistical window matching the exchange data statistical window, the resource exchange ratio between the first resource and the second resource within each ratio data statistical window is statistically calculated to determine the exchange ratio statistical data of each ratio data statistical window. Finally, the resource exchange statistical data of each exchange data statistical window and the exchange ratio statistical data corresponding to each exchange data statistical window are used as historical data to backtest the resource balance strategy to determine the effectiveness of the resource balance strategy within the time interval.

[0118] In the above embodiment, the resource exchange ratio is statistically calculated according to the ratio data statistical window to obtain the exchange ratio statistical data, which can further reduce the data scale of the data used in the backtest process of the resource balance strategy, and further reduce the amount of data to be processed, which is beneficial to further improving work efficiency.

[0119] The specific method for the server to determine the ratio data statistical window is not unique.

[0120] In an alternative embodiment, the server can divide the exchange data statistical window into multiple ratio data statistical windows with the same window duration according to the window duration of the exchange data statistical window. Among them, the window duration of the ratio data statistical window is positively correlated with the window duration of the exchange data statistical window. For example, for a 10-minute exchange data statistical window, a 1-minute ratio data statistical window can be applied; for a 1-hour exchange data statistical window, a 10-minute ratio data statistical window can be applied.

[0121] In an optional embodiment, the method for processing resource exchange data further includes: determining the fluctuation data of the resource exchange ratio between the first resource and the second resource over time within an exchange data statistical window; and dividing the exchange data statistical window into multiple ratio data statistical windows according to the fluctuation data.

[0122] Wherein, within each ratio data statistical window, the volatility of the resource exchange ratio is less than or equal to a volatility threshold. The volatility can be characterized by at least one of standard deviation, range (Bollinger Band width), mean absolute deviation (MAD), etc. The volatility threshold can be determined according to the backtesting accuracy requirement. The higher the backtesting accuracy requirement, the lower the volatility threshold.

[0123] Specifically, the server can, according to the time span, screen out the fluctuation data of the resource exchange ratio between the first resource and the second resource over time within the exchange data statistical window from the exchange ratio fluctuation data between the first resource and the second resource within the time interval. Then, according to the fluctuation situation characterized by the fluctuation data, perform the statistics of the volatility, and further divide the exchange data statistical window into multiple ratio data statistical windows with a volatility less than or equal to the volatility threshold.

[0124] In the above embodiment, by dividing the ratio data statistical window according to the volatility of the resource exchange ratio, multiple ratio data statistical windows with a volatility less than or equal to the volatility threshold are obtained, which can reduce the data scale while retaining the fluctuation information of the resource exchange ratio, and is beneficial to improving the accuracy of the data processing result.

[0125] In one embodiment, as Figure 5 shown, a method for processing resource exchange data is provided. This method can be executed by a computer device. Taking the server in Figure 1 as an example, in this embodiment, the method includes the following steps:

[0126] Step S501, in response to a backtesting request for a target resource pair, obtain a resource balance strategy for reducing the resource balance difference of the target resource pair, and determine the time interval for which the backtesting is requested.

[0127] Wherein, the target resource pair includes a first resource and a second resource. The resource balance difference of the target resource pair changes with the fluctuation of the resource exchange ratio between the first resource and the second resource. The resource exchange ratio refers to the relative value ratio between different resources during the resource exchange process.

[0128] Step S502, based on the interval duration of the time interval, determine a cycle interval matching the time interval.

[0129] Among them, at least one interval boundary of the periodic interval is positively correlated with the interval duration. The interval boundary of the periodic interval refers to the starting point and the ending point of the time range of the periodic interval. The starting point corresponds to the interval lower limit, and the ending point corresponds to the interval upper limit. The periodic interval can specifically be a closed interval, an open interval, or a semi-closed and semi-open interval. That at least one interval boundary of the periodic interval is positively correlated with the interval duration means that at least one of the above interval upper limit or interval lower limit is positively correlated with the interval duration.

[0130] Step S503, in response to a selection event for a target period among multiple candidate periods within the periodic interval, determine the duration of the target period as the periodic duration matching the time interval.

[0131] Specifically, the server can, in response to a selection event for a target period among multiple candidate periods within the periodic interval by the application side, determine the duration of the target period as the periodic duration matching the time interval.

[0132] Step S504, divide the time interval into multiple initial windows with the same window duration according to the periodic duration.

[0133] Among them, the window duration of the initial window is the periodic duration. Optionally, in the case where the interval duration of the time interval cannot be divided evenly by the periodic duration, the last initial window can be partially overlapped with the penultimate initial window to ensure that the window duration of each initial window is the periodic duration.

[0134] Step S505, for each initial window, determine the event volume of the resource exchange events that occur between the first resource and the second resource within the initial window.

[0135] Among them, the resource exchange event between the first resource and the second resource includes a forward exchange event of exchanging the first resource for the second resource and a reverse exchange event of exchanging the second resource for the first resource. The event quantity of the resource exchange event refers to the number of times of resource exchange that occurs.

[0136] Optionally, based on multiple events that occur within the initial window, the server can, according to the event records of each event, determine the event type of each event and the resource type involved in each event. Then, from each event, filter out the resource exchange events whose event type is resource exchange and the resource types involved include the first resource and the second resource, so as to determine the event volume of the resource exchange events that occur between the first resource and the second resource within the initial window.

[0137] Step S506, in the case where the event volume of the initial window is greater than the event volume lower limit and less than the event volume upper limit, determine the initial window as the exchange data statistics window.

[0138] Step S507, when the event volume in the initial window is greater than or equal to the upper limit of the event volume, split the initial window into multiple statistical windows for exchange data.

[0139] Among them, the event volume corresponding to the statistical window for exchange data is greater than the lower limit of the event volume and less than the upper limit of the event volume. Splitting the initial window with a relatively large event volume can ensure that as much original data information as possible is retained while compressing the data, improving the accuracy of the processing result. For example, the number of resource exchange events on weekdays is relatively large and the exchange frequency is high. Based on the initial window, statistical windows for exchange data with relatively short window durations can be split.

[0140] Step S508, when the event volume in the initial window is less than or equal to the lower limit of the event volume, determine the statistical window for exchange data based on the merger result of the initial window and adjacent statistical windows for exchange data.

[0141] Among them, merging the initial window with a relatively small event volume can further reduce the data scale and improve work efficiency. For example, the number of resource exchange events on non - working days is relatively small and the exchange frequency is low. Based on the initial window, statistical windows for exchange data with relatively long window durations can be merged.

[0142] Optionally, the server can obtain multiple statistical windows for exchange data whose event volume is greater than the lower limit of the event volume and less than the upper limit of the event volume through multiple merges and splits.

[0143] Exemplarily, when the event volume is less than or equal to the lower limit of the event volume, the server can merge the initial window with at least one adjacent statistical window for exchange data to obtain a merged window whose event volume is greater than the lower limit of the event volume. If the merged window does not meet the window adjustment condition, the merged window can be determined as the statistical window for exchange data; if the merged window still meets the window adjustment condition, the next round of window splitting or merging can be performed until multiple statistical windows for exchange data that do not meet the window adjustment condition are obtained. Among them, the window meets the window adjustment condition means that the event volume corresponding to the window is greater than or equal to the upper limit of the event volume, or less than or equal to the lower limit of the event volume.

[0144] Step S509, obtain the resource exchange data of each of the multiple resource exchange events between the first resource and the second resource within the statistical window for exchange data.

[0145] Among them, the resource exchange data includes the exchange volume of the first resource and the second resource respectively.

[0146] Step S510, for each group of resource exchange data within the statistical window for exchange data, determine the exchange direction of the first resource and the second resource respectively.

[0147] Among them, the exchange direction may include a forward exchange that increases the resource quantity and a reverse exchange that decreases the resource quantity. Since a resource exchange event exchanges one resource for another, in a set of resource exchange data, the exchange directions of the first resource and the second resource are opposite to each other: the first resource is for forward exchange and the second resource is for reverse exchange, or the first resource is for reverse exchange and the second resource is for forward exchange.

[0148] Specifically, the server can, for each set of resource exchange data within the exchange data statistics window, determine the exchange directions of the first resource and the second resource respectively according to the change direction of the resource quantity in the resource exchange data: if the change direction of the resource quantity is an increase, the exchange direction is a forward exchange; if the change direction of the resource quantity is a decrease, the exchange direction is a reverse exchange.

[0149] Step S511: According to the exchange direction of the first resource or the second resource, respectively count the exchange quantities of the first resource and the second resource, and determine the resource exchange statistical data corresponding to different exchange directions for the target resource pair in the exchange data statistics window.

[0150] Specifically, the server can perform exchange quantity statistics according to the exchange direction, and merge the groups of resource exchange data within the exchange data statistics window into two groups of resource exchange statistical data, thereby reducing the data scale.

[0151] Exemplarily, when each group of resource exchange statistical data includes "first resource - A1, second resource + B1", "first resource - A2, second resource + B2", "first resource + A3, second resource - B3", and "first resource + A4, second resource - B4", where "+" corresponds to forward exchange and "-" corresponds to reverse exchange, then according to the exchange direction of the first resource or the second resource, the resource exchange statistical data in the case of forward exchange of the first resource (or reverse exchange of the second resource) can be statistically obtained as "first resource + Ai, second resource - Bi", and the resource exchange statistical data in the case of reverse exchange of the first resource (or forward exchange of the second resource) can be statistically obtained as "first resource - Aj, second resource + Bj". Among them, Ai = A3 + A4, Bi = B3 + B4, Aj = A1 + A2, Bj = B1 + B2.

[0152] Step S512: For each exchange data statistics window, determine the fluctuation data of the resource exchange ratio between the first resource and the second resource over time within the exchange data statistics window.

[0153] Specifically, the server can, according to the time span, filter out the fluctuation data of the resource exchange ratio between the first resource and the second resource over time within the exchange data statistics window from the exchange ratio fluctuation data between the first resource and the second resource within the time interval.

[0154] Step S513: Divide the exchange data statistical window into multiple ratio data statistical windows according to the fluctuation data.

[0155] Among them, within each ratio data statistical window, the volatility of the resource exchange ratio is less than or equal to the volatility threshold. The volatility can be characterized by at least one of standard deviation, range, mean absolute deviation, etc. The volatility threshold can be determined according to the backtesting accuracy requirement. The higher the backtesting accuracy requirement, the lower the volatility threshold.

[0156] Specifically, the server can perform the statistics of the volatility according to the fluctuation situation characterized by the fluctuation data, and then divide the exchange data statistical window into multiple ratio data statistical windows with a volatility less than or equal to the volatility threshold according to the volatility.

[0157] Step S514: Statistically calculate the resource exchange ratio between the first resource and the second resource in each ratio data statistical window respectively, and determine the exchange ratio statistical data of each ratio data statistical window.

[0158] Among them, the exchange ratio statistical data can include the maximum value, minimum value, average value, closing value, etc. Among them, the closing value refers to the last resource exchange ratio in the ratio data statistical window.

[0159] Specifically, the server can, for each exchange data statistical window, according to the ratio data statistical window matching the exchange data statistical window, statistically calculate the resource exchange ratio between the first resource and the second resource in each ratio data statistical window, and determine the exchange ratio statistical data of each ratio data statistical window.

[0160] Step S515: Backtest the resource balance strategy based on the resource exchange statistical data of each exchange data statistical window and the exchange ratio statistical data corresponding to each exchange data statistical window respectively, and determine the effectiveness of the resource balance strategy within the time interval.

[0161] Optionally, the server can use the resource exchange statistical data of each exchange data statistical window and the exchange ratio statistical data corresponding to each exchange data statistical window respectively as historical data and input them into the backtesting system. These data will be converted into a series of events and trigger three key actions: one is to update the resource balance, that is, to adjust the risk balance in real time according to the scenario change and strategy requirements; the second is to execute a position close, that is, to eliminate part or all of the resource balance by executing the resource balance strategy to control the risk; the third is to update the profit and loss, that is, to calculate the gain or loss of the resource quantity of the actually held resources according to the result after the position close. The above process can be dynamically adjusted in combination with risk management tools, and the effectiveness and stability of the resource balance strategy can be verified through historical data.

[0162] In the process of processing the above resource exchange data, through data statistics, the data scales of the resource exchange data and the resource exchange ratio data within the time interval can be significantly reduced, thereby reducing the amount of data processed during the backtest process, releasing a certain amount of computing resources, and further avoiding local overload of computing resources and task queuing delays, which is beneficial to improving work efficiency.

[0163] In one embodiment, the present application further provides an application scenario, in which the above method for processing resource exchange data is applied. Taking the application scenario as an example of an on-chain resource exchange scenario based on blockchain. Multiple nodes on the blockchain can publish different types of digital resources, and various types of digital resources can be exchanged according to the resource exchange ratio. The service node (i.e., the server) where the service institution is located can accept the resource exchange request initiated by the user node, receive the first resource provided by the user node, and transfer the second resource to the user node. While providing services, the service node can execute a resource balance strategy for reducing the resource income and expenditure difference to reduce the risk brought by the resource income and expenditure difference.

[0164] In one embodiment, the present application further provides another application scenario, in which the above method for processing resource exchange data is applied. This application scenario can be, for example, a foreign exchange exposure processing scenario. Among them, foreign exchange trading is to simultaneously buy one currency in a currency pair and sell another currency. It is the exchange of one country's currency for another country's currency. Different from other financial markets, the foreign exchange market has no specific location and no central exchange, but conducts transactions through an electronic network among banks, enterprises, and individuals. In the intermediary service of foreign exchange trading for customers by banks or institutions, there are often "long positions" or "short positions" in foreign exchange positions (which is the professional term for foreign exchange assets in the financial circle). A long position means that the purchase amount is greater than the sale amount, and a short position means that the sale amount is greater than the purchase amount. Such "short positions" and "long positions" are called "foreign exchange exposures". Exposures carry factors of income and expenditure imbalance, and due to exchange rate fluctuations, risks may be brought. Therefore, banks or institutions often need to sell long positions and cover short positions, which is called closing positions or covering exposures. The basis for closing positions or covering exposures is the resource balance strategy in the present application, which can specifically include the selection methods of closing position timing, closing position channels, and closing position trading volumes, etc.

[0165] Before executing a resource balancing strategy, the server can backtest the resource balancing strategy to verify its effectiveness. Specifically, the server can, in response to a backtest request for a target resource pair, obtain a resource balancing strategy that is expected to reduce the resource balance difference of the target resource pair, and determine the time interval for which the requested backtest is to be performed. Then, the time interval is divided into multiple exchange data statistical windows, and for each exchange data statistical window, multiple sets of resource exchange data between a first resource and a second resource within the exchange data statistical window are counted to determine the resource exchange statistical data of the target resource pair in the exchange data statistical window. Finally, the server can backtest the resource balancing strategy based on the resource exchange statistical data of each exchange data statistical window and the exchange ratio fluctuation data between the first resource and the second resource within the time interval to determine the effectiveness of the resource balancing strategy within the time interval. Among them, the target resource pair includes a first resource and a second resource; the resource balance difference changes following the fluctuation of the resource exchange ratio between the first resource and the second resource.

[0166] The following will combine the attached Figures 6 - 10 to introduce in detail the method for processing resource exchange data provided in this application.

[0167] In one embodiment, as Figure 6 shown, in order to have historical data available for backtesting, after the management system receives resource exchange data and resource exchange ratio data, it stores them separately in their respective data memories and sorts them in chronological order. For example, Figure 6 data memory 1 for storing resource exchange data and data memory 2 for storing resource exchange ratio data. Among them, the resource exchange data may include resource pairs, exchange volumes, and exchange times; the resource exchange ratio data may include resource pairs, resource exchange ratios, ratio determination times, etc.

[0168] In an alternative embodiment, as Figure 7 shown, the data storage process includes the following steps:

[0169] Step S701, the management system receives external data;

[0170] Step S702, determine whether it is resource exchange data; if so, proceed to step S703, if not, proceed to step S704;

[0171] Step S703, store it in the original transaction database in chronological order and with the resource pair involved in the resource exchange data as the classification basis;

[0172] For example: resource exchange data 1 (exchange volume, exchange time) corresponding to resource pair AB;

[0173] Step S704: Determine whether it is resource exchange ratio data. If yes, proceed to Step S705; if not, proceed to Step S706.

[0174] Step S705: Store it in the original ratio database in chronological order and classified by the resource pair involved in the resource exchange ratio data.

[0175] For example: Resource exchange ratio data 1 (resource exchange ratio, ratio determination time) corresponding to resource pair AB.

[0176] Step S706: End.

[0177] By continuously executing the above steps, the collection of original data can be achieved.

[0178] In an optional embodiment, time windows such as 1 minute, 5 minutes, 10 minutes, 1 hour, etc. can be preset, and the collected original data can be statistically analyzed according to the selected time windows respectively to achieve data scale compression. Among them, the statistical work of resource exchange data and resource exchange ratio data can be carried out separately.

[0179] In an optional embodiment, as Figure 8 shown, the statistical process for resource exchange data can include the following steps:

[0180] Step S801: Determine the window size of the exchange data statistical window.

[0181] Step S802: Fetch resource exchange data from the original transaction database according to the window size.

[0182] Among them, the data fetching range is one window size, and the start time of the first data fetching is the earliest time of the original transaction database.

[0183] Step S803: Statistically analyze the fetched resource exchange data by resource pair to obtain resource exchange statistical data.

[0184] Among them, the original data of the same resource pair is accumulated. Finally, in one exchange data statistical window, one resource exchange statistical data can be obtained for the same resource pair.

[0185] Step S804: The resource exchange statistical data uses the end time of the current statistical window as the exchange time and is classified and stored in the backtest transaction database according to the window value size.

[0186] For example: Resource exchange statistical data 1 (accumulated exchange volume, exchange time) corresponding to resource pair AB.

[0187] Step S805: Determine whether there is still unaccessed data in the original data.

[0188] That is, whether there is still data after the current statistical window. If so, go to step S806; otherwise, go to step S807.

[0189] Step S806: Roll the data fetching time range backward according to the window value.

[0190] That is, the new data fetching start time is the end time of the previous data fetching. Return to step S802 to obtain the resource exchange data within the window size range at one time.

[0191] Step S807: End.

[0192] Repeat the above steps to collect the resource exchange statistical data for each exchange data statistical window under multiple window values.

[0193] In an optional embodiment, as Figure 9 shown, the statistical process for the resource exchange ratio data may include the following steps:

[0194] Step S901: Determine the window size of the ratio data statistical window.

[0195] Step S902: Fetch the resource exchange ratio data from the original wallpaper database according to the window size.

[0196] Among them, the data fetching range is one window size, and the start time of the first data fetching is the earliest time of the original ratio database.

[0197] Step S903: Statistically process the fetched resource exchange ratio data according to the resource pairs to obtain the exchange ratio statistical data.

[0198] Among them, the exchange ratio statistical data may include the maximum value, the minimum value, and the last value (closing value).

[0199] Step S904: The exchange ratio statistical data uses the end time of the current statistical window as the time label and is classified and stored in the backtest ratio database according to the window value size.

[0200] That is, within one statistical window, there will be three pieces of data corresponding to the same resource pair. For example: the exchange ratio statistical data 1 - max (resource exchange ratio, timestamp) corresponding to the resource pair AB, the exchange ratio statistical data 1 - min (exchange rate value, timestamp) corresponding to the resource pair AB, and the exchange ratio statistical data - close (exchange rate value, timestamp) corresponding to the resource pair AB.

[0201] Step S905: Determine whether there is still unaccessed data in the original data.

[0202] That is, whether there is still data after the current statistical window. If so, go to step S906; otherwise, go to step S907;

[0203] Step S906: Roll the data fetching time range backward according to the window value;

[0204] That is, the new data fetching start time is the end time of the previous data fetching. Return to step S902 to obtain the resource exchange ratio data within the window size range at one time;

[0205] Step S907: End.

[0206] The above statistics can be performed in advance. Thus, when backtesting the resource balance strategy, the backtest data can be retrieved by selecting the target resource pair, as well as the window sizes of the exchange data statistical window and the ratio data statistical window respectively, and determining the time interval for which the backtest is requested, and the backtest can be automatically performed based on the retrieved data.

[0207] In an alternative embodiment, as Figure 10 shown, the backtest process for the resource balance strategy may include the following steps:

[0208] Step S1001: Obtain the pre-processed window value for which data statistics have been completed in advance;

[0209] Among them, the pre-processed window value may be, for example, the window value of the statistical window of the above-mentioned resource exchange data or resource exchange ratio data;

[0210] Step S1002: Determine whether the application end has selected a target window value from the pre-processed window value; if so, go to step S1003; if not, go to step S1004;

[0211] Step S1003: Select the backtest data corresponding to the target window value to replace the original data;

[0212] Step S1004: Select the original data from the original transaction database and the original ratio database;

[0213] Step S1005: Perform backtesting based on the original data.

[0214] Specifically, the original data will all be converted into events, and three actions within the event will be triggered simultaneously. One is to update the resource balance, the second is to execute a closing position (i.e., run the resource balance strategy), and the third is to update the resource profit and loss.

[0215] Step S1006: End.

[0216] In an alternative embodiment, in the case where the application end does not select a target window value from the preprocessing window values, the server can divide the time interval requested for backtesting into multiple exchange data statistical windows, and perform data statistics for each exchange data statistical window respectively to obtain backtest data. Optionally, the server can divide the time interval requested for backtesting into multiple exchange data statistical windows according to the window value customized by the application end.

[0217] Through the above solution, the backtesting efficiency can be improved when statistical data is used. For example, if a backtest spanning 15 days is to be performed, and there is one resource exchange data and one resource exchange ratio data per second on average, when the time window is selected as one minute, the data scale of the resource exchange data will be compressed to 1 / 60, and the data scale of the resource exchange ratio data will be compressed to 3 / 60, which can reduce the number of runs.

[0218] If a backtest with a larger span is required, such as backtesting data for 2 - 3 years, selecting a one-hour time window will reduce the original backtesting time by thousands of times. And regardless of the window selection, the statistics of the window data can be prepared in advance or performed in real time.

[0219] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same moment, but can be executed at different moments. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.

[0220] Based on the same inventive concept, the embodiments of the present application also provide a resource exchange data processing device for implementing the above-mentioned resource exchange data processing method. The solution provided by this device for solving problems is similar to the solution described in the above method. Therefore, the specific limitations in one or more of the following embodiments of the resource exchange data processing device can refer to the limitations on the resource exchange data processing method in the above text, and will not be repeated here.

[0221] In one embodiment, as Figure 11 shown, a resource exchange data processing device is provided, including an acquisition module 1101, a time interval splitting module 1102, a data statistics module 1103, and a backtesting module 1104. Among them:

[0222] An acquisition module 1101, configured to obtain a resource balancing strategy for reducing the resource balance difference of a target resource pair in response to a backtest request for the target resource pair; the target resource pair includes a first resource and a second resource; the resource balance difference varies with the fluctuation of the resource exchange ratio between the first resource and the second resource;

[0223] A time interval segmentation module 1102, configured to determine the time interval of the requested backtest and divide the time interval into multiple exchange data statistical windows;

[0224] A data statistics module 1103, configured to, for each exchange data statistical window, count multiple groups of resource exchange data between the first resource and the second resource within the exchange data statistical window, and determine the resource exchange statistical data of the target resource pair in the exchange data statistical window;

[0225] A backtest module 1104, configured to backtest the resource balancing strategy based on the resource exchange statistical data of each exchange data statistical window and the exchange ratio fluctuation data between the first resource and the second resource within the time interval, and determine the effectiveness of the resource balancing strategy within the time interval.

[0226] In one embodiment, the time interval segmentation module 1102 includes: a cycle duration determination unit, configured to determine a cycle duration matching the backtest request; a time interval segmentation unit, configured to divide the time interval into multiple periodically distributed exchange data statistical windows according to the cycle duration; the window duration of a single exchange data statistical window is positively correlated with the cycle duration.

[0227] In one embodiment, the cycle duration determination unit is specifically configured to: based on the interval duration of the time interval, determine a cycle interval matching the time interval; at least one interval boundary of the cycle interval is positively correlated with the interval duration; in response to a selection event for a target cycle among multiple candidate cycles within the cycle interval, determine the duration of the target cycle as the cycle duration matching the time interval.

[0228] In one embodiment, the time interval segmentation unit includes: an initial window determination component, configured to divide the time interval into multiple initial windows with the same window duration according to the cycle duration; the window duration of the initial window is the cycle duration; an event quantity determination component, configured to, for each initial window, determine the event quantity of the resource exchange event that occurs between the first resource and the second resource within the initial window; a window adjustment component, configured to, when the initial window meets the window adjustment condition, adjust the initial window according to the numerical relationship between the event quantity and the event quantity threshold to obtain an exchange data statistical window; the window adjustment condition is characterized by the event quantity threshold.

[0229] In one embodiment, the event volume threshold includes an upper event volume limit and a lower event volume limit. In the context of this embodiment, the window adjustment component is specifically configured to: in the case where the event volume is greater than or equal to the upper event volume limit, split the initial window into multiple exchange data statistical windows; in the case where the event volume is less than or equal to the lower event volume limit, determine the exchange data statistical window based on the merging result of the initial window and the adjacent exchange data statistical windows; the event volume corresponding to the exchange data statistical window is greater than the lower event volume limit and less than the upper event volume limit.

[0230] In one embodiment, the data statistics module 1103 includes: an exchange data acquisition unit configured to acquire the respective resource exchange data of multiple resource exchange events between a first resource and a second resource within an exchange data statistical window; the resource exchange data includes the respective exchange volumes of the first resource and the second resource; a data statistics unit configured to respectively perform statistics on the respective exchange volumes of the first resource and the second resource within the exchange data statistical window, and determine the resource exchange statistical data of the target resource pair in the exchange data statistical window.

[0231] In a specific embodiment, the data statistics unit is specifically configured to: for each set of resource exchange data within the exchange data statistical window, determine the respective exchange directions of the first resource and the second resource; according to the exchange directions of the first resource or the second resource, respectively perform statistics on the respective exchange volumes of the first resource and the second resource, and determine the respective resource exchange statistical data of the target resource pair corresponding to different exchange directions in the exchange data statistical window.

[0232] In one embodiment, the data statistics module 1103 includes: a preprocessing window determination unit configured to determine multiple preprocessing windows included in the exchange data statistical window; the data statistics unit is specifically configured to: for each preprocessing window, determine the resource exchange statistical data between the first resource and the second resource in the preprocessing window; and statistically analyze the respective resource exchange statistical data of each preprocessing window to determine the resource exchange statistical data of the target resource pair in the exchange data statistical window.

[0233] In one embodiment, the preprocessing window determination unit is configured to perform at least one of the following:

[0234] The first item:

[0235] Acquire multiple preprocessing candidate windows including resource exchange statistical data;

[0236] Determine multiple preprocessing windows included in the exchange data statistical window from each preprocessing candidate window.

[0237] The second item:

[0238] Divide the exchange data statistical window into multiple preprocessing windows distributed periodically according to the window duration of the exchange data statistical window.

[0239] In one embodiment, the backtesting module 1104 includes: a ratio data acquisition unit configured to acquire the exchange ratio fluctuation data between a first resource and a second resource within a time interval; a ratio data statistics unit configured to, for each exchange data statistics window, respectively count the resource exchange ratio between the first resource and the second resource within each ratio data statistics window that matches the exchange data statistics window, and determine the exchange ratio statistics data for each ratio data statistics window; and a backtesting unit configured to backtest the resource balancing strategy based on the resource exchange statistics data for each exchange data statistics window and the exchange ratio statistics data respectively corresponding to each exchange data statistics window, and determine the effectiveness of the resource balancing strategy within the time interval.

[0240] In one embodiment, the backtesting module 1104 further includes a window partitioning unit configured to: determine the fluctuation data of the resource exchange ratio between the first resource and the second resource over time within the exchange data statistics window; partition the exchange data statistics window into a plurality of ratio data statistics windows according to the fluctuation data; and within each ratio data statistics window, the volatility of the resource exchange ratio is less than or equal to a volatility threshold.

[0241] Each module in the above-mentioned processing device for resource exchange data can be implemented in whole or in part by software, hardware, and their combination. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory of the computer device in the form of software, so as to facilitate the processor to call and execute the operations corresponding to the above-mentioned modules.

[0242] In one embodiment, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 12 shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the data involved in the processing of the above-mentioned resource exchange data. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements a method for processing resource exchange data.

[0243] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structural diagram may be as shown in Figure 13 the following figure. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface, the display unit, and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used for exchanging information between the processor and external devices. The communication interface of the computer device is used for communicating with external terminals in a wired or wireless manner. The wireless manner can be implemented through WIFI, a mobile cellular network, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a method for processing resource exchange data. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen may be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device may be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the computer device housing, or an external keyboard, touchpad, or mouse, etc.

[0244] Those skilled in the art can understand that Figure 12 the structure shown in or 13 is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have a different component layout.

[0245] In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, it implements the steps of the above method embodiment.

[0246] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, it implements the steps of the above method embodiment.

[0247] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by the processor, it implements the steps of the above method embodiment.

[0248] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data that have been authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of the relevant regions and areas. Moreover, the object can choose not to authorize the object information and relevant data, or can refuse or can conveniently refuse to push information, etc.

[0249] In this application, during the process of collecting and processing relevant data in actual application, the informed consent or separate consent of the personal information subject should be obtained strictly in accordance with the requirements of the relevant regional laws and regulations, and subsequent data use and processing behaviors should be carried out within the scope of authorization of the laws, regulations, and the personal information subject.

[0250] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., and are not limited thereto. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., and are not limited thereto.

[0251] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.

[0252] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A method for processing resource exchange data, characterized in that: The method comprises: In response to a backtest request for a target resource pair, a resource balancing strategy is obtained that is expected to reduce a resource revenue and expenditure difference of the target resource pair; the target resource pair includes a first resource and a second resource; the resource revenue and expenditure difference changes with fluctuations in a resource exchange ratio between the first resource and the second resource; Determine a time interval for the requested backtest, and divide the time interval into a plurality of exchange data statistical windows; For each of the exchange data statistics windows, counting multiple groups of resource exchange data between the first resource and the second resource in the exchange data statistics window, and determining resource exchange statistics of the target resource pair in the exchange data statistics window; Based on the resource exchange statistical data of each exchange data statistical window and the exchange ratio fluctuation data between the first resource and the second resource in the time interval, the resource balancing strategy is backtested to determine the effectiveness of the resource balancing strategy in the time interval.

2. The method according to claim 1, characterized in that The dividing the time interval into a plurality of exchange data statistical windows comprises: Determining a period duration that matches the backtest request; According to the cycle duration, the time interval is divided into a plurality of periodically distributed exchange data statistical windows; the window duration of a single exchange data statistical window is positively correlated with the cycle duration.

3. The method according to claim 2, characterized in that The determining of the cycle duration matching the backtest request includes: Based on the interval length of the time interval, determining a period interval matching the time interval; at least one interval boundary of the period interval is positively correlated with the interval length; In response to a selection event for a target cycle among a plurality of candidate cycles within the cycle interval, a duration of the target cycle is determined to be a cycle duration that matches the time interval.

4. The method according to claim 2, characterized in that: The step of dividing the time interval into a plurality of periodically distributed exchange data statistical windows according to the cycle duration includes: According to the cycle duration, the time interval is divided into a plurality of initial windows having the same window duration; the window duration of the initial window is the cycle duration; For each of the initial windows, determining an event quantity of resource exchange events occurring between the first resource and the second resource within the initial window; When the initial window satisfies a window adjustment condition, the initial window is adjusted according to a numerical relationship between the event volume and the event volume threshold to obtain an exchange data statistics window; the window adjustment condition is characterized by the event volume threshold.

5. The method according to claim 4, characterized in that The event volume threshold includes an event volume upper limit and an event volume lower limit; The step of adjusting the initial window according to the numerical relationship between the event amount and the event amount threshold to obtain the exchange data statistical window includes: When the event amount is greater than or equal to the event amount upper limit, splitting the initial window into a plurality of exchange data statistics windows; In a case where the event amount is less than or equal to the event amount lower limit, determining the exchange data statistics window based on a merging result of the initial window and an adjacent exchange data statistics window; The event volume corresponding to the exchange data statistics window is greater than the event volume lower limit and less than the event volume upper limit.

6. The method according to claim 1, characterized in that The counting of multiple groups of resource exchange data between the first resource and the second resource in the exchange data statistics window to determine resource exchange statistics of the target resource pair in the exchange data statistics window includes: Acquire resource exchange data of each of a plurality of resource exchange events between the first resource and the second resource within the exchange data statistics window; the resource exchange data includes the exchange volume of each of the first resource and the second resource; Statistics are respectively collected on the exchange volumes of the first resource and the second resource in the exchange data statistics window to determine resource exchange statistics of the target resource pair in the exchange data statistics window.

7. The method according to claim 6, characterized in that The counting of the exchange amounts of the first resource and the second resource in the exchange data statistics window respectively to determine the resource exchange statistics of the target resource pair in the exchange data statistics window includes: For each group of resource exchange data in the exchange data statistics window, determining the exchange direction of the first resource and the second resource respectively; According to the exchange direction of the first resource or the second resource, the exchange volume of each of the first resource and the second resource is counted respectively to determine the resource exchange statistics data corresponding to different exchange directions of the target resource pair in the exchange data statistics window.

8. The method according to claim 1, characterized in that The counting of multiple groups of resource exchange data between the first resource and the second resource in the exchange data statistics window to determine resource exchange statistics of the target resource pair in the exchange data statistics window includes: Determining a plurality of preprocessing windows included in the exchange data statistics window; For each of the preprocessing windows, determining resource exchange statistics between the first resource and the second resource in the preprocessing window; The resource exchange statistics of each of the pre-processing windows are counted to determine the resource exchange statistics of the target resource pair in the exchange data statistics window.

9. The method according to claim 8, characterized in that The determining of the plurality of preprocessing windows included in the exchange data statistics window comprises at least one of the following: Item 1: obtaining a plurality of pre-processed candidate windows including resource exchange statistics; Determining a plurality of preprocessing windows included in the exchange data statistics window from among the preprocessing candidate windows; Item 2: According to the window length of the exchange data statistics window, the exchange data statistics window is divided into a plurality of preprocessing windows which are periodically distributed.

10. The method according to any one of claims 1 to 9, characterized in that The backtesting of the resource balancing strategy based on the resource exchange statistical data of each exchange data statistical window and the exchange ratio fluctuation data between the first resource and the second resource in the time interval to determine the effectiveness of the resource balancing strategy in the time interval includes: Acquire fluctuation data of the exchange ratio between the first resource and the second resource within the time interval; For each of the exchange data statistics windows, according to the ratio data statistics window matching the exchange data statistics window, respectively counting the resource exchange ratio between the first resource and the second resource in each of the ratio data statistics windows, and determining the exchange ratio statistics of each of the ratio data statistics windows; Based on the resource exchange statistics of each exchange data statistical window and the exchange ratio statistics corresponding to each exchange data statistical window, the resource balancing strategy is backtested to determine the effectiveness of the resource balancing strategy within the time interval.

11. The method according to claim 10, characterized in that The method further comprises: Determine fluctuation data of a resource exchange ratio between the first resource and the second resource over time within the exchange data statistical window; According to the fluctuation data, the exchange data statistical window is divided into a plurality of ratio data statistical windows; within each of the ratio data statistical windows, the fluctuation rate of the resource exchange ratio is less than or equal to a fluctuation rate threshold.

12. A device for processing resource exchange data, characterized in that: The device comprises: An acquisition module, configured to, in response to a backtest request for a target resource pair, acquire a resource balancing strategy that is expected to reduce a resource revenue and expenditure difference of the target resource pair; the target resource pair includes a first resource and a second resource; the resource revenue and expenditure difference varies with fluctuations in a resource exchange ratio between the first resource and the second resource; A time interval segmentation module, used to determine the time interval of the requested backtest and divide the time interval into multiple exchange data statistical windows; A data statistics module, configured to count, for each of the exchange data statistics windows, multiple groups of resource exchange data between the first resource and the second resource in the exchange data statistics window, and determine resource exchange statistics of the target resource pair in the exchange data statistics window; A backtesting module is used to backtest the resource balancing strategy based on the resource exchange statistical data of each exchange data statistical window and the exchange ratio fluctuation data between the first resource and the second resource in the time interval to determine the effectiveness of the resource balancing strategy in the time interval.

13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 11 are implemented.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.

15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.