Dynamic management method and device for digital resources and electronic equipment
By establishing a transaction contract in a decentralized transaction and adjusting the amount of digital resources according to the real-time quantity of the liquidity pool, the risks caused by large changes in the proportion of liquidity pool transactions are resolved and the value stability of digital resources is achieved.
Patent Information
- Application Number
- CN202511211781.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-28
- Publication Date
- 2025-09-26
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In existing decentralized transactions, the trading ratio of liquidity pools fluctuates greatly, resulting in higher risks and value instability for users' digital assets.
By determining liquidity data, establishing a trading contract, and adjusting the amount of digital resources in the trading contract based on the real-time quantity of the liquidity pool, the target digital resources to be paid or received can be determined when prices fluctuate, reducing losses caused by price drops or increases.
It reduces the impermanent loss caused by the liquidity pool and the value loss caused by trading contracts, and improves the value stability of digital resources, especially when prices fluctuate greatly.
Smart Images

Figure CN120706849A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application belong to the field of blockchain technology, and in particular relate to a method, device, and electronic device for dynamic management of digital resources. Background Art
[0002] Liquidity pools are pools of digital resources managed by smart contracts and used to support decentralized trading. Each liquidity pool corresponds to a trading pair, each consisting of two different digital resources. Trading pairs can swap resources within their corresponding liquidity pool, and the swap process is completed through smart contracts.
[0003] Common decentralized trading nodes now often provide channels for users to provide liquidity. Users can invest corresponding digital resources by providing liquidity and obtain corresponding transaction fees through trading digital resources in the liquidity pool.
[0004] For some short-term popular liquidity pools, the fees are often higher due to frequent transactions. However, the trading ratio of such liquidity pools will also fluctuate greatly. When the ratio fluctuates greatly, it will cause certain risks to users' digital assets. Summary of the Invention
[0005] In view of this, embodiments of the present application provide a method, apparatus, and electronic device for dynamically managing digital resources, so as to reduce the possibility of a reduction in the number of digital resources.
[0006] A first aspect of an embodiment of the present application provides a method for dynamic management of digital resources, including: Determining liquidity data; the liquidity data includes a transaction pair consisting of a first digital resource and a second digital resource, a first initial quantity of the first digital resource, and a second initial quantity of the second digital resource; Sending the first initial quantity of the first digital resource and the second initial quantity of the second digital resource to a liquidity pool matching the trading pair; establishing a transaction contract corresponding to the first digital resource according to the first initial quantity; Adjusting the quantity of the first digital resource corresponding to the transaction contract based on the real-time quantity of the first digital resource corresponding to the liquidity pool; The transaction contract is used to determine a number of target digital resources to be paid when the price of the first digital resource increases, and to determine a number of target digital resources to be received when the price of the first digital resource decreases; the target digital resources include at least one of the first digital resource and the second digital resource.
[0007] In some implementations of the first aspect, adjusting the quantity of the first digital resource corresponding to the transaction contract based on the real-time quantity of the first digital resource corresponding to the liquidity pool includes: determining a plurality of preset price ranges corresponding to the first digital resource; Determining a real-time price based on the real-time quantity of the first digital resource corresponding to the liquidity pool; When the price range of the real-time price changes, the quantity of the first digital resource corresponding to the transaction contract is adjusted according to the real-time quantity.
[0008] In some implementations of the first aspect, when the price range of the real-time price changes, adjusting the quantity of the first digital resource corresponding to the transaction contract according to the real-time quantity includes: When it is determined that the current price range has changed, determining the duration of time that the real-time price is within the current price range; When the duration is greater than a preset delay threshold, adjusting the quantity of the first digital resource corresponding to the transaction contract according to the real-time quantity; When the duration is no greater than a preset delay threshold, if the price range of the real-time price is different from the N most recent price ranges in history, the quantity of the first digital resource corresponding to the transaction contract is adjusted according to the real-time quantity.
[0009] In some implementations of the first aspect, adjusting the quantity of the first digital resource corresponding to the transaction contract according to the real-time quantity includes: calculating a first quantity difference between the real-time quantity and the first initial quantity; The transaction contract is adjusted according to the first quantity difference, so that a second quantity difference between the quantity of the first digital resource corresponding to the adjusted transaction contract and the real-time quantity is within a preset quantity range.
[0010] In some implementations of the first aspect, the method further includes: Determine the sliding time window; Calculating a price variation range of the first digital resource within the sliding time window; When the price difference between the initial price of the first digital resource and the price change range is greater than a preset price threshold, the first digital resource is resent and the transaction contract is re-established based on the real-time quantity and the real-time price; the initial price is the price of the first digital resource sent to the liquidity pool.
[0011] In some implementations of the first aspect, the preset price range is determined by the following method: Determining an initial price of the first digital resource; the initial price is the price of the first digital resource sent to the liquidity pool; A plurality of preset price ranges are divided based on the initial price.
[0012] In some implementations of the first aspect, in adjacent preset price intervals, a price range of a price interval closer to the initial price is not smaller than a price range of a price interval farther from the initial price.
[0013] A second aspect of an embodiment of the present application provides a dynamic management device for digital resources, including: a determination module, configured to determine liquidity data; the liquidity data comprising a transaction pair consisting of a first digital resource and a second digital resource, a first initial quantity of the first digital resource, and a second initial quantity of the second digital resource; a sending module, configured to send the first initial quantity of the first digital resource and the second initial quantity of the second digital resource to a liquidity pool matching the trading pair; a transaction contract establishing module, configured to establish a transaction contract corresponding to the first digital resource according to the first initial quantity; A transaction contract adjustment module, configured to adjust the quantity of the first digital resource corresponding to the transaction contract based on the real-time quantity of the first digital resource corresponding to the liquidity pool; The transaction contract is used to determine a number of target digital resources to be paid when the price of the first digital resource increases, and to determine a number of target digital resources to be received when the price of the first digital resource decreases; the target digital resources include at least one of the first digital resource and the second digital resource.
[0014] A third aspect of an embodiment of the present application provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, the electronic device implements the dynamic management method of digital resources as described in the first aspect above.
[0015] A fourth aspect of the embodiments of the present application provides a computer program product, including a computer program. When the computer program is run, the dynamic management method of digital resources as described in the first aspect above is executed.
[0016] A fifth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the dynamic management method of digital resources as described in the first aspect above is implemented.
[0017] Compared with the prior art, the embodiments of the present application have the following beneficial effects: In an embodiment of the present application, liquidity data is determined; the liquidity data includes a trading pair consisting of a first digital resource and a second digital resource, a first initial quantity of the first digital resource, and a second initial quantity of the second digital resource; the first initial quantity of the first digital resource and the second initial quantity of the second digital resource are sent to a liquidity pool matching the trading pair; a trading contract corresponding to the first digital resource is established according to the first initial quantity; the quantity of the first digital resource corresponding to the trading contract is adjusted according to the real-time quantity of the first digital resource corresponding to the liquidity pool; the trading contract is used to determine a number of target digital resources to be paid when the price of the first digital resource rises, and to determine a number of target digital resources to be received when the price of the first digital resource falls; the target digital resource includes at least one of the first digital resource and the second digital resource, thereby reducing the impermanent loss caused by the liquidity pool when the price of the first digital resource falls, and also reducing the value loss caused by the trading contract when the price of the first digital resource rises, thereby improving the stability of the value of the target user's digital resources when there are large price fluctuations in the first digital resource. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] To more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present application, and those skilled in the art can derive other drawings based on these drawings without inventive effort.
[0019] Figure 1 This is a schematic diagram of a dynamic management method for digital resources provided by an embodiment of the present application; Figure 2 This is a schematic diagram of a dynamic management device for digital resources provided by an embodiment of the present application; Figure 3 This is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0020] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.
[0021] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0022] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0023] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0024] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0025] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0026] The technical solution of this application is described below through specific embodiments.
[0027] Reference Figure 1 , which shows a schematic diagram of a dynamic management method for digital resources provided by an embodiment of the present application, which may specifically include the following steps: Step 101, determining liquidity data; The target user (liquidity provider) can determine liquidity data on demand. The liquidity data is used to determine the relevant data for injecting liquidity into the liquidity pool. The liquidity data includes a trading pair consisting of a first digital resource and a second digital resource, a first initial quantity of the first digital resource, and a second initial quantity of the second digital resource. The prices of the first digital resource and the second digital resource can be measured using a unified price reference. This price reference can be a virtual currency using blockchain technology or a real-world currency. That is, the price of the first digital resource and the price of the second digital resource can be calibrated using either virtual currency or real-world currency. Similarly, the price reference can be used to determine the value of a certain number of the first digital resource and the value of a certain number of the second digital resource. In the embodiments of this application, for ease of understanding and illustration, the same price reference is used to calibrate the prices of the digital resources.
[0028] Both the first digital resource and the second digital resource are virtual currencies using blockchain technology. The second digital resource is a virtual currency anchored to real assets or real-world currencies to keep its price relatively stable.
[0029] As an example, a trading pair includes digital resource A (digital resource A as the first digital resource) and digital resource B (digital resource B as the second digital resource). The target user can determine the amount of digital resource A (i.e., the first initial amount) and the amount of digital resource B (i.e., the second initial amount) that need to be invested in liquidity.
[0030] Step 102: Send the first initial quantity of the first digital resource and the second initial quantity of the second digital resource to a liquidity pool that matches the transaction pair; A liquidity pool is a pool of resources that can exchange digital resources. Each liquidity pool corresponds to at least one trading pair. The embodiments of this application do not limit the type of digital resources; they only require that the two be interchangeable. The type of digital resources does not affect the implementation process and the beneficial effects of the embodiments of this application. For example, if a liquidity pool corresponds to the trading pair of digital resource A and digital resource B, then, under certain conditions (for example, the reserve amount of the digital resource to be exchanged is not zero), digital resource A can be exchanged for digital resource B, or vice versa, in a certain ratio within the liquidity pool.
[0031] After determining the liquidity data, the target user can select an existing liquidity pool on the blockchain that matches the transaction pair as the target liquidity pool, or establish a liquidity pool on the blockchain that matches the transaction pair as the target liquidity pool and contribute liquidity to the target liquidity pool, that is, sending the first digital resource to the target liquidity pool according to the first initial quantity and sending the second digital resource to the target liquidity pool according to the second initial quantity, so that other users can exchange the first digital resource for the second digital resource in the target liquidity pool. When digital resource exchange occurs in the liquidity pool, the target user who provides liquidity can obtain a certain proportion of the transaction fees generated by the exchange.
[0032] Step 103: establishing a transaction contract corresponding to the first digital resource according to the first initial quantity; When sending a first digital resource and a second digital resource, a trading contract for the first digital resource is established based on a first initial quantity. The price of the first digital resource corresponding to the trading contract is approximately consistent with the corresponding price in the liquidity pool. The trading contract is used to determine a number of target digital resources to be paid when the price of the first digital resource increases, and to determine a number of target digital resources to be received when the price of the first digital resource decreases. The target digital resources include at least one of the first and second digital resources. The trading contract can be an on-chain trading contract (i.e., an on-chain smart contract) or an off-chain trading contract. Compared to off-chain trading contracts, on-chain trading contracts have higher order book transparency and higher trading volume. In specific applications, either an on-chain or off-chain trading contract can be established based on actual needs.
[0033] It should be noted that the price of the first digital resource in the transaction contract may not be completely consistent with the price of the first digital resource in the liquidity pool. However, in practice, the price difference between the two is relatively small. For the convenience of describing this embodiment of the application, the price of the first digital resource in the transaction contract is approximately consistent with the price of the first digital resource in the liquidity pool. The transaction contract can first determine the quantity (or value) of the target digital resource to be paid or received, and then pay or receive the target digital resource at a preset time. This embodiment of the application does not limit the method or time of paying or receiving the target digital resource.
[0034] Since the transaction contract can obtain more digital resources when the price of the first digital resource drops, the losses caused by the drop in the price of the first digital resource can be balanced.
[0035] When the aforementioned liquidity pool is swapped, two scenarios arise: 1. The price of the first digital resource decreases, increasing the target user's first digital resource in the liquidity pool while decreasing the second digital resource, i.e., reducing the value of the first digital resource. The target digital resource to be received is determined through the transaction contract to mitigate the impermanent loss incurred by the liquidity pool when the value of the first digital resource decreases. 2. The price of the first digital resource increases, and the target digital resource to be paid is determined through the transaction contract, resulting in losses from the transaction contract.
[0036] Step 104: Adjust the quantity of the first digital resource corresponding to the transaction contract based on the real-time quantity of the first digital resource corresponding to the liquidity pool; By adjusting the quantity of the first digital resource corresponding to the trading contract based on the real-time quantity of the first digital resource in the liquidity pool, the trading contract can obtain more of the target digital resource when the price of the first digital resource drops, so that the value of the obtained target digital resource offsets the impermanent loss incurred by the liquidity pool due to the price drop of the first digital resource. Furthermore, when the price of the first digital resource rises, the trading contract can be adjusted to pay less of the target digital resource, thereby reducing the risk associated with the trading contract. In other words, by adjusting the quantity of the first digital resource in the trading contract, the impermanent loss incurred by the liquidity pool when the price of the first digital resource drops is reduced, and the value loss incurred by the trading contract when the price of the first digital resource rises is also reduced. This improves the stability of the target user's digital resource value even when the price of the first digital resource fluctuates significantly.
[0037] It should be noted that if the target user holds a larger amount of the first digital resource than the initial amount when the price of the first digital resource decreases, and if the amount of the first digital resource corresponding to the transaction contract is not adjusted in real time, resulting in the amount of the first digital resource corresponding to the transaction contract being less than the amount of the first digital resource in the liquidity pool, there will be a greater risk of value loss when the price of the first digital resource decreases. Conversely, if the price of the first digital resource increases, the value of the target digital resource to be paid will be greater because the amount of the first digital resource corresponding to the transaction contract is greater than the amount of the first digital resource in the liquidity pool.
[0038] In an embodiment of the present application, by determining liquidity data; the liquidity data includes a trading pair consisting of a first digital resource and a second digital resource, a first initial quantity of the first digital resource, and a second initial quantity of the second digital resource; sending the first initial quantity of the first digital resource and the second initial quantity of the second digital resource to a liquidity pool matching the trading pair; establishing a trading contract corresponding to the first digital resource according to the first initial quantity; adjusting the quantity of the first digital resource corresponding to the trading contract based on the real-time quantity of the first digital resource corresponding to the liquidity pool; the trading contract is used to determine a number of target digital resources to be paid when the price of the first digital resource rises, and to determine a number of target digital resources to be received when the price of the first digital resource falls; the target digital resource includes at least one of the first digital resource and the second digital resource, thereby reducing the impermanent loss caused by the liquidity pool when the price of the first digital resource falls, and also reducing the value loss caused by the trading contract when the price of the first digital resource rises, thereby improving the stability of the value of the target user's digital resources when there are large price fluctuations in the first digital resource.
[0039] In some implementations of the embodiments of the present application, adjusting the quantity of the first digital resource corresponding to the transaction contract based on the real-time quantity of the first digital resource corresponding to the liquidity pool includes: Determine multiple preset price ranges corresponding to the first digital resource; determine a real-time price based on the real-time quantity of the first digital resource corresponding to the liquidity pool; and adjust the quantity of the first digital resource corresponding to the trading contract according to the real-time quantity when the price range within which the real-time price falls changes.
[0040] The first digital resource may be divided into a plurality of preset price ranges. The real-time quantity of the first digital resource in the liquidity pool and the real-time price of the first digital resource may be determined at a certain frequency.
[0041] When a change in the price range of the real-time price is detected (for example, the real-time price changes from price range 1 to price range 2), the quantity of the first digital resource corresponding to the transaction contract is adjusted according to the real-time quantity.
[0042] Since adjusting the quantity of the first digital resource corresponding to the transaction contract requires the loss of a certain amount of digital resources as adjustment fees, by dividing the price of the first digital resource into multiple price ranges, and adjusting the quantity of the first digital resource corresponding to the transaction contract according to the real-time quantity when a change in the price range of the real-time price is detected, it is avoided that the quantity of the first digital resource corresponding to the transaction contract is adjusted every time the real-time price changes, resulting in a high frequency adjustment of the transaction contract and the loss of a large amount of digital resources.
[0043] In some implementations of the embodiments of the present application, when the price range within which the real-time price is located changes, adjusting the quantity of the first digital resource corresponding to the trading contract according to the real-time quantity includes: determining the duration of the change in the price range within which the real-time price is located; when the duration is greater than a preset delay threshold, adjusting the quantity of the first digital resource corresponding to the trading contract according to the real-time quantity; when the duration is not greater than the preset delay threshold, if the price range within which the real-time price is located is different from the N most recent price ranges in history, adjusting the quantity of the first digital resource corresponding to the trading contract according to the real-time quantity; N is a positive integer not less than 2.
[0044] In actual application scenarios, the price of the first digital resource tends to stabilize in a certain price range over a certain period of time, and the real-time price will randomly fluctuate in both directions within this price range. There may be a situation where the price range partially overlaps with the two price intervals. For example: over a certain period of time, the real-time price fluctuates randomly in both directions within the price range of Price A to Price B, while Price A is in Price Interval 1 and Price B is in Price Interval 2. At this time, if the quantity of the first digital resource corresponding to the transaction contract is adjusted immediately whenever the price interval in which the real-time price is located changes, it will result in too frequent adjustments to the quantity of the first digital resource corresponding to the transaction contract, resulting in the need to lose a large amount of digital resources. Therefore, the embodiment of the present application adopts a strategy of dynamic adjustment of delay. When the price interval in which the real-time price is located changes, the duration of the change in the price interval is determined, and the delay threshold is determined.
[0045] When the duration is greater than the delay threshold, that is, after the price range in which the real-time price is located changes and the time in the changed price range is greater than the delay threshold, the quantity of the first digital resource corresponding to the transaction contract needs to be adjusted according to the real-time quantity.
[0046] If the duration is less than the preset delay threshold, and the price range of the real-time time is the same as the most recent historical price range, the quantity of the first digital resource corresponding to the trading contract will not be adjusted based on the real-time quantity. That is, if the real-time price returns to the price range before the duration of the real-time price change reaches the delay threshold, the trading contract will not be adjusted, thereby avoiding the loss of a large amount of digital resources due to frequent adjustments of trading contracts and resetting the duration.
[0047] In the case of rapid price fluctuations, if the price range of the real-time price differs from the N most recent price ranges before the duration reaches the time threshold, where N is a positive integer not less than 2, the quantity of the first digital resource corresponding to the trading contract will be immediately adjusted according to the real-time quantity to prevent the expansion of impermanent loss. Taking N=2 as an example, the real-time price changes from range 1 to range 2, and the duration calculation begins. Before the calculated duration reaches the delay threshold, the real-time price changes to range 3. Range 3 differs from the two most recent price ranges (range 1 and range 2), indicating that the current price of the first digital resource has deviated from the price range before the change (range 1). To prevent the expansion of impermanent loss, the quantity of the first digital resource corresponding to the trading contract needs to be immediately adjusted according to the real-time quantity.
[0048] In some implementations of the embodiments of the present application, adjusting the quantity of the first digital resource corresponding to the transaction contract according to the real-time quantity includes: calculating a first quantity difference between the real-time quantity and the first initial quantity; adjusting the transaction contract based on the first quantity difference so that a second quantity difference between the quantity of the first digital resource corresponding to the adjusted transaction contract and the real-time quantity is within a preset quantity range.
[0049] The adjustment amount of the first digital resource quantity of the transaction contract is determined based on the conditions within the liquidity pool. For example, it can be determined based on the price of the first digital resource, the price range of the liquidity invested by the target user, and the liquidity of the entire liquidity pool within that price range.
[0050] As an example, the adjustment amount for the first digital resource quantity of a trading contract can be determined by combining the real-time quantity and the first initial quantity of the first digital resource. A first quantity difference between the real-time quantity and the first initial quantity is calculated; and the trading contract is adjusted based on the first quantity difference so that a second quantity difference between the adjusted quantity of the first digital resource corresponding to the trading contract and the real-time quantity falls within a preset quantity range. In other words, the quantity of the first digital resource in the liquidity pool roughly matches the quantity of the first digital resource corresponding to the trading contract.
[0051] For example, when investing liquidity, 1,000 units of a first digital resource are sent to the liquidity pool. If the price of the first digital resource rises, assuming that 400 units of the first digital resource can be obtained from the liquidity pool when the liquidity is withdrawn, the adjustment amount of the first digital resource in the trading contract will be 400 units.
[0052] In some implementations of the embodiments of the present application, the method further includes: determining a sliding time window; calculating the price change range of the first digital resource within the sliding time window; when the price difference between the initial price of the first digital resource and the price change range is greater than a preset price threshold, resending the first digital resource and re-establishing the transaction contract based on the real-time quantity and the real-time price; the initial price is the price of the first digital resource sent to the liquidity pool.
[0053] In actual application scenarios, the price of the first digital resource tends to stabilize within a certain price range and fluctuate randomly in both directions over a certain period of time. Therefore, a sliding time window can be set to continuously calculate the high-frequency price change range of the first digital resource price. If the price change range of the first digital resource has significantly deviated from the initial price of the first digital resource sent to the liquidity pool, the liquidity pool and transaction contract need to be reset to ensure the liquidity of the liquidity pool to which the target user sent the first digital resource (to ensure the possibility of the first digital resource being replaced in the liquidity pool). The reset method includes: revoking (or redeeming) the first digital resource sent to the liquidity pool and the established transaction contract, and re-performing steps 102-104 according to the current price of the first digital resource to complete the reset of the liquidity pool and transaction contract for the target user.
[0054] In some implementations of the embodiments of the present application, the preset price range is determined by the following method: determining an initial price of the first digital resource; and dividing the price range into a plurality of preset price ranges based on the initial price.
[0055] The initial price of the first digital resource at the time of liquidity injection can be used as a basis to divide price ranges in ascending and descending order. For example, if the price of the first digital resource fluctuates around 100 at the time of liquidity injection, multiple price ranges can be divided using 100 as the initial price. Interval points can be divided according to a certain interval length, and price ranges can be constructed based on adjacent interval thresholds. The interval length can be dynamically set based on actual conditions. For example, if the initial price is 100 and the interval length is 10 (the initial price is in the interval of [number]), for price ranges less than the initial price, the interval thresholds can be divided according to a certain interval length, including 95, 85, 75, and 65, resulting in price ranges less than the initial price including (65, 75), (75, 85), and (85, 95). The thresholds between intervals can be divided into corresponding intervals according to preset rules. For example, for price ranges less than the initial price, the thresholds of adjacent intervals can be divided into price ranges close to the initial price. That is, the interval thresholds 85, 75, and 65 can be set in the above three price ranges, resulting in the final price ranges [65, 75), [75, 85), and [85, 95]. Based on similar situations, we can get that the initial price range is [95-105], and the price ranges greater than the initial price include (105,115], (115,125], and (125,135].
[0056] In one implementation of the embodiment of the present application, in adjacent preset price intervals, the price range of a price interval closer to the initial price is not smaller than the price range of a price interval farther from the initial price.
[0057] Since the relationship between the change of the first digital resource price and the first digital resource quantity is nonlinear, when dividing the price range, it is divided in a sparse middle and dense at both ends. That is, in adjacent preset price ranges, the price range of the price range closer to the initial price is not less than the price range of the price range farther from the initial price.
[0058] For example: the initial price is within interval 0, and the three adjacent price intervals are intervals 0, 1, 2, 3, and 4. The price range of price interval 4 is less than or equal to the price range of price interval 3, and the price range of price interval 3 is less than or equal to the price range of price interval 2, so that the price intervals are distributed in a manner that is centered on the initial price and sparse in the middle and dense at both ends. Based on the price intervals that are centered on the initial price and sparse in the middle and dense at both ends, by setting the sliding time window as described above, and when the price difference between the initial price of the first digital resource and the price change range within the sliding time window is greater than the preset price threshold, the first digital resource is resent and the transaction contract is re-established, and then the price intervals centered on the new initial price and sparse in the middle and dense at both ends are divided according to the new initial price. This can effectively avoid the overlap of high-frequency price change ranges with densely distributed price intervals, resulting in the need to frequently adjust the transaction contract and cause the loss of a large amount of digital resources.
[0059] It should be noted that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0060] Reference Figure 2 , shows a schematic diagram of a dynamic management device for digital resources provided by an embodiment of the present application, which may specifically include a determination module 201, a sending module 202, a transaction contract establishment module 203, and a transaction contract adjustment module 204, wherein: Determination module 201, configured to determine liquidity data; the liquidity data including a transaction pair consisting of a first digital resource and a second digital resource, a first initial quantity of the first digital resource, and a second initial quantity of the second digital resource; A sending module 202, configured to send the first initial quantity of the first digital resource and the second initial quantity of the second digital resource to a liquidity pool matching the trading pair; A transaction contract establishing module 203, configured to establish a transaction contract corresponding to the first digital resource according to the first initial quantity; The transaction contract adjustment module 204 is configured to adjust the quantity of the first digital resource corresponding to the transaction contract according to the real-time quantity of the first digital resource corresponding to the liquidity pool; The transaction contract is used to determine a number of target digital resources to be paid when the price of the first digital resource increases, and to determine a number of target digital resources to be received when the price of the first digital resource decreases; the target digital resources include at least one of the first digital resource and the second digital resource.
[0061] In some implementations of the embodiments of the present application, the transaction contract adjustment module 204 includes: a preset price range determination submodule, configured to determine a plurality of preset price ranges corresponding to the first digital resource; a real-time data determination submodule, configured to determine a real-time price based on the real-time quantity of the first digital resource corresponding to the liquidity pool; The adjustment submodule is configured to adjust the quantity of the first digital resource corresponding to the transaction contract according to the real-time quantity when the price range of the real-time price changes.
[0062] In some implementations of the embodiments of the present application, the adjustment submodule includes: a duration determination unit, configured to determine the duration of a change in the price range within which the real-time price falls; a delay threshold determination unit, configured to adjust the quantity of the first digital resource corresponding to the transaction contract according to the real-time quantity when the duration is greater than a preset delay threshold; An immediate adjustment unit is configured to adjust the quantity of the first digital resource corresponding to the transaction contract according to the real-time quantity if the price range of the real-time price is different from the N most recent price ranges in history, provided that the duration is no greater than a preset delay threshold; N is a positive integer no less than 2.
[0063] In some implementations of the embodiments of the present application, the adjustment submodule includes: a first quantity difference calculation unit, configured to calculate a first quantity difference between the real-time quantity and the first initial quantity; The adjusting unit is configured to adjust the transaction contract according to the first quantity difference, so that a second quantity difference between the quantity of the first digital resource corresponding to the adjusted transaction contract and the real-time quantity is within a preset quantity range.
[0064] In some implementations of the embodiments of the present application, the apparatus further includes: A sliding time window determination module, used to determine the sliding time window; a price variation range calculation module, configured to calculate the price variation range of the first digital resource within the sliding time window; A reset module is configured to resend the first digital resource to the liquidity pool and re-establish the transaction contract based on the real-time quantity and the real-time price when the price difference between the initial price of the first digital resource and the price variation range is greater than a preset price threshold; the initial price is the price of the first digital resource sent to the liquidity pool.
[0065] In some implementations of the embodiments of the present application, the preset price range is determined by the following modules: an initial price determination module, configured to determine an initial price of the first digital resource; the initial price being the price of the first digital resource sent to the liquidity pool; The price range division module is used to divide the initial price into multiple preset price ranges.
[0066] In one implementation of the embodiment of the present application, in adjacent preset price intervals, the price range of a price interval closer to the initial price is not smaller than the price range of a price interval farther from the initial price.
[0067] An embodiment of the present application provides a dynamic management device for digital resources. By using this device, each step in the aforementioned method embodiments can be implemented.
[0068] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment part.
[0069] Reference Figure 3 , shows a schematic diagram of an electronic device provided by an embodiment of the present application. Figure 3 As shown, the electronic device 300 in the embodiment of the present application includes: a processor 310, a memory 320, and a computer program 321 stored in the memory 320 and executable on the processor 310. When the processor 310 executes the computer program 321, the steps of each embodiment of the dynamic management method of digital resources described above are implemented, such as Figure 1 Alternatively, when the processor 310 executes the computer program 321, the functions of the modules / units in the above-mentioned device embodiments are realized, for example, Figure 2 Functions of modules 201 to 204 are shown.
[0070] Exemplarily, the computer program 321 may be divided into one or more modules / units, which are stored in the memory 320 and executed by the processor 310 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of performing specific functions, which may be used to describe the execution process of the computer program 321 in the electronic device 300. For example, the computer program 321 may be divided into a determination module, a sending module, a transaction contract establishment module, and a transaction contract adjustment module. The specific functions of each module are as follows: a determination module, configured to determine liquidity data; the liquidity data comprising a transaction pair consisting of a first digital resource and a second digital resource, a first initial quantity of the first digital resource, and a second initial quantity of the second digital resource; a sending module, configured to send the first initial quantity of the first digital resource and the second initial quantity of the second digital resource to a liquidity pool matching the trading pair; a transaction contract establishing module, configured to establish a transaction contract corresponding to the first digital resource according to the first initial quantity; A transaction contract adjustment module, configured to adjust the quantity of the first digital resource corresponding to the transaction contract based on the real-time quantity of the first digital resource corresponding to the liquidity pool; The transaction contract is used to determine a number of target digital resources to be paid when the price of the first digital resource increases, and to determine a number of target digital resources to be received when the price of the first digital resource decreases; the target digital resources include at least one of the first digital resource and the second digital resource.
[0071] The electronic device 300 may be a computing device such as a desktop computer or a cloud server. The electronic device 300 may include, but is not limited to, a processor 310 and a memory 320. It will be understood by those skilled in the art that Figure 3 It is only an example of the electronic device 300 and does not constitute a limitation of the electronic device 300. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 300 may also include input and output devices, network access devices, buses, etc.
[0072] The processor 310 may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0073] The memory 320 can be an internal storage unit of the electronic device 300, such as a hard drive or memory of the electronic device 300. The memory 320 can also be an external storage device of the electronic device 300, such as a plug-in hard drive, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash memory card, etc. equipped on the electronic device 300. Furthermore, the memory 320 can include both an internal storage unit of the electronic device 300 and an external storage device. The memory 320 is used to store the computer program 321 and other programs and data required by the electronic device 300. The memory 320 can also be used to temporarily store data that has been output or is about to be output.
[0074] The embodiments of the present application further disclose a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the dynamic management method of digital resources as described in the aforementioned embodiments is implemented.
[0075] An embodiment of the present application further discloses a computer program product, including a computer program. When the computer program is run, the dynamic management method of digital resources as described in the above embodiments is executed.
[0076] The above embodiments are intended only to illustrate the technical solutions of the present application and are not intended to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they may still modify the technical solutions described in the above embodiments or replace some of the technical features therein with equivalents; and such modifications or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present application and should be included within the scope of protection of the present application.
Claims
1. A dynamic management method for digital resources, characterized in that: include: Determining liquidity data; the liquidity data includes a transaction pair consisting of a first digital resource and a second digital resource, a first initial quantity of the first digital resource, and a second initial quantity of the second digital resource; Sending the first initial quantity of the first digital resource and the second initial quantity of the second digital resource to a liquidity pool matching the trading pair; establishing a transaction contract corresponding to the first digital resource according to the first initial quantity; Adjusting the quantity of the first digital resource corresponding to the transaction contract based on the real-time quantity of the first digital resource corresponding to the liquidity pool; The transaction contract is used to determine a number of target digital resources to be paid when the price of the first digital resource increases, and to determine a number of target digital resources to be received when the price of the first digital resource decreases; the target digital resources include at least one of the first digital resource and the second digital resource.
2. The method according to claim 1, characterized in that The adjusting the quantity of the first digital resource corresponding to the transaction contract according to the real-time quantity of the first digital resource corresponding to the liquidity pool includes: determining a plurality of preset price ranges corresponding to the first digital resource; Determining a real-time price based on the real-time quantity of the first digital resource corresponding to the liquidity pool; When the price range of the real-time price changes, the quantity of the first digital resource corresponding to the transaction contract is adjusted according to the real-time quantity.
3. The method according to claim 2, characterized in that When the price range of the real-time price changes, adjusting the quantity of the first digital resource corresponding to the transaction contract according to the real-time quantity includes: Determine the duration of the change in the price range within which the real-time price falls; When the duration is greater than a preset delay threshold, adjusting the quantity of the first digital resource corresponding to the transaction contract according to the real-time quantity; When the duration is no greater than a preset delay threshold, if the price range of the real-time price is different from the N most recent price ranges in history, the quantity of the first digital resource corresponding to the transaction contract is adjusted according to the real-time quantity; N is a positive integer no less than 2.
4. The method according to any one of claims 1 to 3, characterized in that The adjusting the quantity of the first digital resource corresponding to the transaction contract according to the real-time quantity includes: calculating a first quantity difference between the real-time quantity and the first initial quantity; The transaction contract is adjusted according to the first quantity difference, so that a second quantity difference between the quantity of the first digital resource corresponding to the adjusted transaction contract and the real-time quantity is within a preset quantity range.
5. The method according to claim 2, characterized in that The method further comprises: Determine the sliding time window; Calculating a price variation range of the first digital resource within the sliding time window; When the price difference between the initial price of the first digital resource and the price change range is greater than a preset price threshold, the first digital resource is resent and the transaction contract is re-established based on the real-time quantity and the real-time price; the initial price is the price of the first digital resource sent to the liquidity pool.
6. The method according to claim 2, characterized in that The preset price range is determined by the following method: Determining an initial price of the first digital resource; the initial price is the price of the first digital resource sent to the liquidity pool; A plurality of preset price ranges are divided based on the initial price.
7. The method according to claim 6, characterized in that In adjacent preset price intervals, a price range of a price interval closer to the initial price is not smaller than a price range of a price interval farther from the initial price.
8. A dynamic management device for digital resources, characterized in that: include: a determination module, configured to determine liquidity data; the liquidity data comprising a transaction pair consisting of a first digital resource and a second digital resource, a first initial quantity of the first digital resource, and a second initial quantity of the second digital resource; a sending module, configured to send the first initial quantity of the first digital resource and the second initial quantity of the second digital resource to a liquidity pool matching the trading pair; a transaction contract establishing module, configured to establish a transaction contract corresponding to the first digital resource according to the first initial quantity; A transaction contract adjustment module, configured to adjust the quantity of the first digital resource corresponding to the transaction contract based on the real-time quantity of the first digital resource corresponding to the liquidity pool; The transaction contract is used to determine a number of target digital resources to be paid when the price of the first digital resource increases, and to determine a number of target digital resources to be received when the price of the first digital resource decreases; the target digital resources include at least one of the first digital resource and the second digital resource.
9. An electronic device, characterized in that: The electronic device comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the method according to any one of claims 1 to 7.
10. A computer program product, characterized in that The invention comprises a computer program, which, when being executed, enables the method according to any one of claims 1 to 7 to be performed.