Resource conversion rate acquisition method and device, computer equipment and storage medium

By adjusting the query time period according to the update frequency of multiple resource institutions and obtaining multiple resource conversion rates, the problem that third-party payment institutions cannot accurately reflect the market exchange rate is solved, and more accurate resource conversion rate calculation is achieved, and service quality is improved.

CN119090636APending Publication Date: 2024-12-06TENPAY PAID TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411068250.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-05
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

When third-party payment institutions choose the main source bank, they cannot effectively adjust the exchange rate according to the real-time bank and market conditions, resulting in inaccurate exchange rates provided by users and inability to reflect the real market situation.

Method used

By determining the query time period based on the resource conversion rate update frequency of multiple resource institutions, obtaining the resource conversion rate in multiple resource institutions, calculating a more accurate resource conversion rate, considering the overall update of resource conversion rate in the market, and adjusting the query Time period to reflect market volatility and stability.

Benefits of technology

The accuracy of resource conversion rate is improved, so that third-party payment institutions can more accurately reflect market conditions, provide users with appropriate and accurate resource conversion rates, and improve resource exchange service quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119090636A_ABST
    Figure CN119090636A_ABST
Patent Text Reader

Abstract

The invention provides a resource conversion rate obtaining method and device, computer equipment and a storage medium, and belongs to the technical field of computers. The method comprises the steps that in response to a query request for the resource conversion rate between a first resource and a second resource, a query time period is determined based on the updating frequency of a plurality of resource mechanisms for the resource conversion rate, and the length of the query time period is inversely proportional to the updating frequency; obtaining a resource conversion rate between the first resource and the second resource in the plurality of resource mechanisms in the query time period to obtain a plurality of first resource conversion rates; and determining a second resource conversion rate between the first resource and the second resource based on the plurality of first resource conversion rates, and outputting the second resource conversion rate. According to the technical scheme, the finally determined second resource conversion rate is more accurate, and the current resource conversion rate condition of the market is better met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, computer equipment and storage medium for obtaining a resource conversion rate. Background Art

[0002] With the development of computer technology, some third-party payment institutions provide users with transaction capabilities in various cross-border scenarios. Users can conduct foreign exchange transactions in third-party payment institutions. Before conducting foreign exchange transactions, users usually request the exchange rate between the two currencies to be traded from the third-party payment institution so that they can conduct transactions based on the exchange rate later. How to provide users with exchange rates is the focus of research in this field.

[0003] At present, the commonly used method is: third-party payment institutions select several banks with high market share and good reputation as the main price source banks, query the exchange rates provided by the main price source banks, and provide users with the final exchange rate based on the exchange rate provided by the main price source banks.

[0004] However, when third-party payment institutions select the main price source banks, they often rely on their personal subjective experience and are unable to make effective and rapid adjustments based on real-time bank and market conditions, resulting in inaccurate exchange rates provided to users that fail to reflect the true market situation. Summary of the invention

[0005] The embodiment of the present application provides a method, device, computer equipment and storage medium for obtaining resource conversion rate, so that the second resource conversion rate finally determined is more accurate and more in line with the current resource conversion rate situation in the market. The technical solution is as follows:

[0006] In one aspect, a method for obtaining a resource conversion rate is provided, the method comprising:

[0007] In response to a query request for a resource conversion rate between a first resource and a second resource, determining a query time period based on a frequency of updating the resource conversion rate by a plurality of resource agencies, wherein the length of the query time period is inversely proportional to the update frequency;

[0008] Acquire a resource conversion rate between the first resource and the second resource in the plurality of resource agencies within the query time period to obtain a plurality of first resource conversion rates;

[0009] Based on the multiple first resource conversion rates, a second resource conversion rate between the first resource and the second resource is determined, and the second resource conversion rate is output.

[0010] On the other hand, a device for obtaining a resource conversion rate is provided, the device comprising:

[0011] A first determining module, configured to determine, in response to a query request for a resource conversion rate between a first resource and a second resource, a query time period based on an update frequency of the resource conversion rate by a plurality of resource agencies, wherein the length of the query time period is inversely proportional to the update frequency;

[0012] An acquisition module, used for acquiring a resource conversion rate between the first resource and the second resource in the plurality of resource agencies within the query time period, to obtain a plurality of first resource conversion rates;

[0013] The second determination module is used to determine a second resource conversion rate between the first resource and the second resource based on the multiple first resource conversion rates, and output the second resource conversion rate.

[0014] In some embodiments, the first determining module includes:

[0015] An acquisition unit, configured to, in response to a query request for a resource conversion rate between a first resource and a second resource, acquire a length of the query time period at a current moment based on an update frequency of the resource conversion rate by the plurality of resource agencies;

[0016] A determining unit is used to determine the query time period based on the current time and the length of the query time period, and the end time of the query time period is the current time.

[0017] In some embodiments, the acquisition unit is used to set the length of the query time period to an initial value; based on the query time period whose length is the initial value, determine an initial number, and the initial number is the number of resource conversion rates provided by the multiple resource agencies within the query time period whose length is the initial value; when the initial number is greater than a preset number, determine that the length of the query time period at the current moment is the initial value.

[0018] In some embodiments, the acquisition unit is also used to increase the length of the query time period at least once when the initial number is not greater than the preset number, until the number of resource conversion rates provided by the multiple resource agencies within the query time period is greater than the preset number.

[0019] In some embodiments, the acquisition unit is used to determine the length of the query time period at the current moment as the initial value if the difference between the initial number and the preset number is less than a preset value when the initial number is greater than the preset number.

[0020] In some embodiments, the acquisition unit is also used to, when the initial number is greater than the preset number, if the difference between the initial number and the preset number is not less than the preset value, reduce the length of the query time period at least once, until the difference between the number of resource conversion rates provided by the multiple resource agencies within the query time period and the preset number is less than the preset value.

[0021] In some embodiments, the length of the query time period is periodically updated; the initial value is any one of the following:

[0022] The initial value is the length of the query time period corresponding to a first update period, where the first update period is the update period in which the current moment is located; or

[0023] The initial value is the length of the query time period corresponding to a second update cycle, and the second update cycle is an update cycle before the first update cycle.

[0024] In some embodiments, the acquisition unit is further configured to determine the length of the query time period to be the limited length when the adjusted length is not less than the limited length.

[0025] In some embodiments, the apparatus further comprises:

[0026] A storage module, used for storing the resource conversion rates provided by the plurality of resource agencies when updating the resource conversion rates in a resource database;

[0027] The acquisition module is used to acquire, from the resource database, resource conversion rates whose update time is within the query time period, to obtain the multiple first resource conversion rates.

[0028] In some embodiments, the acquisition module is also used to determine, for any resource agency among the multiple resource agencies, that the latest resource conversion rate previously provided by the resource agency is the first resource conversion rate corresponding to the resource agency if the resource agency has not provided the resource conversion rate between the first resource and the second resource within the query time period.

[0029] In some embodiments, the second determining module is used to average the multiple first resource conversion rates to obtain a second resource conversion rate between the first resource and the second resource.

[0030] In some embodiments, the second determination module is used to perform weighted summation of the multiple first resource conversion rates based on the multiple resource agencies to obtain a second resource conversion rate between the first resource and the second resource, and the weight of each resource conversion rate is positively correlated with the qualification of the resource agency corresponding to the resource conversion rate.

[0031] In some embodiments, the second determination module is used to perform weighted summation of the multiple first resource conversion rates based on the update time of the multiple first resource conversion rates to obtain the second resource conversion rate between the first resource and the second resource, and the weight of each resource conversion rate is negatively correlated with the update time of the first resource conversion rate.

[0032] On the other hand, a computer device is provided, which includes a processor and a memory, wherein the memory is used to store at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the method for obtaining the resource conversion rate in the embodiment of the present application.

[0033] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to implement a method for obtaining a resource conversion rate as in an embodiment of the present application.

[0034] On the other hand, a computer program product is provided, including a computer program, which is stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the method for obtaining the resource conversion rate provided in the above-mentioned various aspects or various optional implementations of various aspects.

[0035] The embodiment of the present application provides a method for obtaining a resource conversion rate. In the process of querying the resource conversion rate between a first resource and a second resource, the time period to which the resource conversion rate to be queried belongs is determined according to the update frequency of the resource conversion rates in multiple resource agencies. Since the update status of the resource conversion rates in multiple resource agencies can reflect the overall status of the resource conversion rates in the resource conversion market, that is, the higher the update frequency of the resource conversion rate, the more volatile the resource conversion rate in the market, and the lower the update frequency of the resource conversion rate, the more stable the resource conversion rate in the market. When the resource conversion rate is more volatile, the length of the query time period is shortened so that the first resource conversion rate in a short period of time obtained subsequently can accurately reflect the current resource conversion rate in the market. When the resource conversion rate is more stable, the length of the query time period is extended so that the first resource conversion rate in a long period of time obtained subsequently can also accurately reflect the current resource conversion rate in the market. Therefore, the second resource conversion rate determined based on the above-mentioned first resource conversion rate is more accurate and in line with the current resource conversion rate in the market.

[0036] In other words, the above method makes it possible to determine the second resource conversion rate by taking into account the overall update situation of the resource conversion rate in the market. When any resource institution interrupts providing the resource conversion rate or increases the update frequency of the resource conversion rate, the third-party payment institution can obtain and perceive such sudden situations and calculate appropriate and accurate resource conversion rates for users based on the overall situation of the resource conversion rate in the market, thereby improving the quality of the resource exchange service of the third-party payment institution. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0038] Figure 1 It is a schematic diagram of an implementation environment of a method for obtaining a resource conversion rate provided in an embodiment of the present application;

[0039] Figure 2 is a flow chart of a method for obtaining a resource conversion rate provided in an embodiment of the present application;

[0040] Figure 3 is a flowchart of another method for obtaining resource conversion rate provided according to an embodiment of the present application;

[0041] Figure 4 is a flow chart for determining the length of a query time period provided according to an embodiment of the present application;

[0042] Figure 5 It is a framework diagram for obtaining the length of a query time period provided according to an embodiment of the present application;

[0043] Figure 6 A method for calculating resource conversion rate provided according to an embodiment of the present application;

[0044] Figure 7 It is a framework diagram for obtaining resource conversion rate provided according to an embodiment of the present application;

[0045] Figure 8 is a block diagram of a device for obtaining a resource conversion rate according to an embodiment of the present application;

[0046] Fig. 9 It is a structural diagram of a server provided according to an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0048] In this application, the terms "first", "second", etc. are used to distinguish identical or similar items with substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on quantity and execution order.

[0049] In the present application, the term "at least one" means one or more, and the term "plurality" means two or more.

[0050] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the resources and resource conversion rates involved in this application are obtained with full authorization.

[0051] The method for obtaining the resource conversion rate provided in the embodiment of the present application can be executed by a computer device. In some embodiments, the computer device is a terminal or a server. The following first takes the computer device as an example to introduce the implementation environment of the method for obtaining the resource conversion rate provided in the embodiment of the present application. Figure 1 Schematic diagram of an implementation environment of a method for obtaining resource conversion rate provided in an embodiment of the present application. Figure 1 The implementation environment includes a terminal 101 and a server 102. The terminal 101 and the server 102 can be directly or indirectly connected via wired or wireless communication, which is not limited in this application.

[0052] In some embodiments, terminal 101 is a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, intelligent voice interaction device, smart home appliance, vehicle-mounted terminal, etc., but is not limited thereto. Terminal 101 is installed and runs an application that supports resource conversion. Resources can be currency, virtual objects in games, or any items in reality, etc., and the embodiments of the present application do not limit this. Accordingly, resource conversion can be the exchange between different types of currencies, the exchange between different types of virtual objects, the exchange between different types of items, the exchange between currency and items, or the exchange between currency and virtual objects, etc., and the embodiments of the present application do not limit this. The application can be a financial application with foreign exchange trading function (for example, the currency of different countries is exchanged through this application), a shopping application (for example, different items are exchanged through this application) or a game application (for example, different types of virtual objects are exchanged through this application), etc., and the embodiments of the present application do not limit this. Schematically, terminal 101 is a terminal used by a user. The user can perform resource conversion through the application on terminal 101. Before performing resource conversion, the user may query the resource conversion rate between the two resources to be converted in the application on the terminal 101 so as to perform resource conversion based on the resource conversion rate later.

[0053] Those skilled in the art will appreciate that the number of any of the above terminals may be more or less. For example, the above terminal may be only one, or the above terminal may be dozens or hundreds, or more. The embodiment of the present application does not limit the number of terminals and device types.

[0054] In some embodiments, server 102 is an independent physical server, or a server cluster or 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), big data and artificial intelligence platforms. Server 102 is used to provide background services for applications that support resource exchange. In some embodiments, server 102 undertakes the main computing work and terminal 101 undertakes the secondary computing work; or, server 102 undertakes the secondary computing work and terminal 101 undertakes the main computing work; or, server 102 and terminal 101 use a distributed computing architecture for collaborative computing.

[0055] Figure 2 is a flow chart of a method for obtaining resource conversion rate according to an embodiment of the present application, see Figure 2In the present application embodiment, the server execution is used as an example for explanation. The method for obtaining the resource conversion rate comprises the following steps:

[0056] 201. In response to a query request for a resource conversion rate between a first resource and a second resource, the server determines a query time period based on an update frequency of the resource conversion rate by multiple resource agencies, wherein the length of the query time period is inversely proportional to the update frequency.

[0057] In the embodiment of the present application, the resource may be a real currency, a virtual object in a game, or any item, etc., and the embodiment of the present application does not limit this. The first resource and the second resource may be resources of the same type, such as the first resource and the second resource are both real currencies. Alternatively, the first resource and the second resource may also be resources of different types, such as the first resource is currency and the second resource is any item, etc. The embodiment of the present application does not limit the first resource and the second resource.

[0058] In the embodiment of the present application, the resource conversion rate between the first resource and the second resource refers to the exchange ratio between the first resource and the second resource when the resources are exchanged. When the first resource and the second resource are both real currencies, the resource conversion rate can be called the exchange rate between the first resource and the second resource.

[0059] In the embodiment of the present application, resources and resource exchange services are provided in the resource institution. The resource institution can be any bank in reality or a virtual bank or virtual store in the game that supports resource exchange, etc., and the embodiment of the present application does not limit this. The resource exchange services provided in different resource institutions can be different or the same; the resource conversion rates corresponding to the same resource exchange service can be different or the same, and the embodiment of the present application does not limit this.

[0060] In the embodiment of the present application, the server is a server of a third-party payment institution. Users can exchange resources through the third-party payment institution. Among them, the server of the third-party payment institution can obtain resource conversion rates from multiple resource institutions, so as to provide users with appropriate resource conversion rates based on the resource conversion rates in multiple resource institutions.

[0061] Before exchanging resources, the user can query the resource conversion rate between the resources to be exchanged. When receiving a query request for the resource conversion rate between the first resource and the second resource, the server obtains the update frequency of the resource conversion rate between the first resource and the second resource by multiple resource agencies. Then, the server determines the query time period according to the update frequency of the resource conversion rate by multiple resource agencies. The query time period is used to indicate the time period to which the resource conversion rate to be queried belongs. That is, the server needs to query the actual value of the resource conversion rate within the query time period. The query time period can also be called a time window.

[0062] The length of the query time period is inversely proportional to the update frequency of the resource conversion rate. That is, the higher the update frequency of the resource conversion rate, the shorter the query time period; the lower the update frequency of the resource conversion rate, the longer the query time period.

[0063] 202. The server obtains resource conversion rates between first resources and second resources in multiple resource organizations within a query period, and obtains multiple first resource conversion rates.

[0064] In the embodiment of the present application, the server obtains the resource conversion rate between the first resource and the second resource in multiple resource agencies based on the query time period to obtain multiple first resource conversion rates. The multiple first resource conversion rates are the resource conversion rates provided by the multiple resource agencies during the query time period.

[0065] Among them, the higher the update frequency of the resource conversion rate, the more volatile the resource conversion rate is. In this case, the shorter the query time period is, the more the first resource conversion rates obtained are resource conversion rates that fluctuate in a short period of time. The lower the update frequency of the resource conversion rate is, the more stable the resource conversion rate is. In this case, the longer the query time period is, the more the first resource conversion rates obtained are resource conversion rates that are relatively stable over a long period of time.

[0066] 203. The server determines a second resource conversion rate between the first resource and the second resource based on the multiple first resource conversion rates, and outputs the second resource conversion rate.

[0067] In an embodiment of the present application, the server may use a certain algorithm to calculate multiple first resource conversion rates to obtain a second resource conversion rate between the first resource and the second resource. The embodiment of the present application does not limit the calculation method of the second resource conversion rate. After obtaining the second resource conversion rate, the server may send the second resource conversion rate to the user's terminal to provide the second resource conversion rate to the user.

[0068] The embodiment of the present application provides a method for obtaining a resource conversion rate. In the process of querying the resource conversion rate between a first resource and a second resource, the time period to which the resource conversion rate to be queried belongs is determined according to the update frequency of the resource conversion rates in multiple resource agencies. Since the update status of the resource conversion rates in multiple resource agencies can reflect the overall status of the resource conversion rates in the resource conversion market, that is, the higher the update frequency of the resource conversion rate, the more volatile the resource conversion rate in the market, and the lower the update frequency of the resource conversion rate, the more stable the resource conversion rate in the market. When the resource conversion rate is more volatile, the length of the query time period is shortened so that the first resource conversion rate in a short period of time obtained subsequently can accurately reflect the current resource conversion rate in the market. When the resource conversion rate is more stable, the length of the query time period is extended so that the first resource conversion rate in a long period of time obtained subsequently can also accurately reflect the current resource conversion rate in the market. Therefore, the second resource conversion rate determined based on the above-mentioned first resource conversion rate is more accurate and in line with the current resource conversion rate in the market.

[0069] In other words, the above method makes it possible to determine the second resource conversion rate by taking into account the overall update situation of the resource conversion rate in the market. When any resource institution interrupts providing the resource conversion rate or increases the update frequency of the resource conversion rate, the third-party payment institution can obtain and perceive such sudden situations and calculate appropriate and accurate resource conversion rates for users based on the overall situation of the resource conversion rate in the market, thereby improving the quality of the resource exchange service of the third-party payment institution.

[0070] Above Figure 2 This is the basic process of obtaining resource conversion rate. Figure 3 The process of obtaining resource conversion rate is further introduced. Figure 3 , Figure 3 1 is a flow chart of another method for obtaining resource conversion rate according to an embodiment of the present application. In the embodiment of the present application, server execution is used as an example for explanation. The method for obtaining resource conversion rate includes the following steps:

[0071] 301. In response to a query request for a resource conversion rate between a first resource and a second resource, the server obtains the length of a query time period at the current moment based on the update frequency of the resource conversion rate by multiple resource agencies, where the length of the query time period is inversely proportional to the update frequency.

[0072] In an embodiment of the present application, a user can query the resource conversion rate between resources to be exchanged through a terminal. In the process of querying the resource conversion rate, the user terminal can send a query request to the server. The query request includes the identifier of the resource to be queried by the user. In the case of receiving a query request for the resource conversion rate sent by the user terminal, the server can determine, based on the query request, that the user query is the resource conversion rate between the first resource and the second resource. Then, the server obtains the update frequency of the resource conversion rate between the first resource and the second resource by multiple resource agencies. Then, the server determines the length of the query time period based on the update frequency of the resource conversion rate by multiple resource agencies, so as to subsequently obtain the resource conversion rate between the first resource and the second resource within the query time period.

[0073] In some embodiments, the server sets the length of the query time period to an initial value. Then, based on the query time period whose length is the initial value, the server determines an initial number. The initial number is the number of resource conversion rates provided by multiple resource agencies within the query time period whose length is the initial value. Then, when the initial number is greater than the preset number, the server determines the length of the query time period at the current moment as the initial value. That is, the server can obtain the resource conversion rate between the first resource and the second resource within the query time period based on a query time period of any length. When the number of resource conversion rates obtained is large enough, it can be regarded that the update frequency of the resource conversion rate meets the standard, and the length in this case is determined as the optimal length of the query time period at the current moment.

[0074] The embodiment of the present application does not limit the preset number. The preset number may be positively correlated with the number of resource agencies and the frequency with which the resource agencies update the resource conversion rate. For example, if there are 4 resource agencies that can provide resource conversion rates for the server, and each resource agency updates a resource conversion rate 5 times within 1 second, the preset number may be 4*5=20.

[0075] The solution provided in the embodiment of the present application starts with any length and counts the number of resource conversion rates that can be obtained within a query time period of this length. When there are enough resource conversion rates within the query time period, it means that the update frequency of the resource conversion rate within the query time period is high and the resource conversion rate is relatively volatile. In this case, the length is determined to be the final length of the query time period, so that the final resource conversion rate can be determined based on the resource conversion rates provided by multiple resource agencies within the query time period. This can more accurately reflect the current resource conversion rate situation in the market, and if the initial value is appropriate, there is no need to adjust the length, which can save operating consumption and speed up the determination efficiency of the query time period.

[0076] Among them, the initial value can be any numerical value, and the embodiments of the present application do not limit this. If the initial value is small, the number of resource conversion rates obtained based on the query time period with a length of the initial value may not be enough to reflect the current resource conversion rate in the market. If the initial value is large, the number of resource conversion rates obtained based on the query time period with a length of the initial value will be large, and the time span of the resource conversion rate is large, which also cannot accurately reflect the current resource conversion rate in the market. Therefore, no matter which of the above situations is, the server can adjust the length of the query time period based on the initial value in order to find a suitable query time period. Please refer to the following situation one and situation two for details.

[0077] In case 1, when the number of resource conversion rates obtained is insufficient, that is, when the resource conversion rate is not updated frequently, the server can adjust the length of the query time period. Accordingly, when the initial number is not greater than the preset number, the server increases the length of the query time period at least once until the number of resource conversion rates provided by multiple resource agencies within the query time period is greater than the preset number.

[0078] The solution provided in the embodiment of the present application, when the number of resource conversion rates within the query time period is small, it means that the update frequency of the resource conversion rate within the query time period is low and the resource conversion rate is relatively stable. In this case, the length of the query time period is increased and adjusted, that is, the acquisition (query) range of the resource conversion rate is expanded, until the number of resource conversion rates provided by multiple resource agencies within the query time period is greater than a preset number, so that the final resource conversion rate can be subsequently determined based on the resource conversion rates provided by multiple resource agencies within the query time period, which can more accurately reflect the current resource conversion rate situation in the market.

[0079] In case 2, when a large number of resource conversion rates are obtained, the time span of the resource conversion rates may be large, and the server may also adjust the length of the query time period.

[0080] Among them, the server can determine whether the number of resource conversion rates obtained is large according to the difference between the number of resource conversion rates obtained and the preset number, thereby determining whether it is necessary to adjust the length of the query time period. Accordingly, when the initial number is greater than the preset number, if the difference between the initial number and the preset number is less than the preset value, the server determines that the length of the query time period at the current moment is the initial value. The embodiment of the present application limits the size of the preset value. The solution provided by the embodiment of the present application determines the length of the query time period as the initial value when the difference between the number of resource conversion rates obtained and the preset number is small, so that the final resource conversion rate can be determined based on the resource conversion rates provided by multiple resource agencies within the query time period, which can more accurately reflect the current resource conversion rate situation in the market, and if the initial value is appropriate, there is no need to adjust the length, which can save operating consumption and speed up the determination efficiency of the query time period.

[0081] In the case where the initial number is greater than the preset number, if the difference between the initial number and the preset number is not less than the preset value, the server reduces the length of the query time period at least once until the difference between the number of resource conversion rates provided by multiple resource agencies within the query time period and the preset number is less than the preset value. In the solution provided by the embodiment of the present application, when the difference between the number of resource conversion rates obtained and the preset number is large, it means that the number of resource conversion rates obtained is large, which is likely caused by the large span of the query time period. Since the resource conversion rate is frequently updated, the resource conversion rate of a distant time has almost no reference significance for the current resource conversion rate. In this case, reducing the length of the query time period is to reduce the acquisition (query) scope of the large resource conversion rate until the number of resource conversion rates provided by multiple resource agencies within the query time period is close to the preset number, so that the final resource conversion rate can be determined based on the resource conversion rates provided by multiple resource agencies within the query time period, which can more accurately reflect the current resource conversion rate situation in the market.

[0082] In some embodiments, since the resource conversion rate is frequently updated, the resource conversion rate of a distant time has almost no reference significance to the current resource conversion rate. Therefore, the server can constrain the length of the query time period to avoid the above-mentioned adjustment of the query time period being too long. Accordingly, when the adjusted length is not less than the limited length, the server determines the length of the query time period to be the limited length. The limited length can be 30 seconds, which is not limited in the embodiments of the present application. The scheme provided in the embodiments of the present application, by constraining (limiting) the length of the query time period, makes the resource conversion rates subsequently obtained all be the resource conversion rates provided by the recent resource agencies, which can accurately reflect the current resource conversion rate of the market, and provide accurate resource conversion rates for users in the future. Provide guarantee.

[0083] For example, Figure 4is a flow chart of determining the length of a query time period according to an embodiment of the present application. Figure 4 , the server sets the length of the query time period to the initial value. The initial value can be 1 second. The server obtains the number of resource conversion rates provided by multiple resource agencies within the query time period of the initial value (1 second), that is, the initial number. When the initial number is greater than the preset number, the initial value is determined to be the length of the query time period at the current moment. When the initial number is not greater than the preset number, the server increases and adjusts the length of the query time period, and the length of the query time period cannot exceed the limited length. For example, the length of the query time period can be increased by 1 second each time, and the length of the query time period cannot exceed 30 seconds. When the length of the query time period does not exceed the limited length, based on the increased query time period, the number of resource conversion rates continues to be obtained, and the number is compared with the preset number (Threshold). When it is not greater than the preset number, the server continues to increase and adjust until the number of resource conversion rates obtained is greater than the preset number, or the length of the query time period reaches the limited length.

[0084] In an embodiment of the present application, the server can calculate the length of the query time period at the current moment in real time whenever a user queries the resource conversion rate. When no user queries the resource conversion rate, the server does not calculate the length of the query time period. This method can save operating consumption. Alternatively, the server can calculate the length of the query time period once every preset period and store the length of the latest query time period. When a user queries the resource conversion rate, the server determines the length of the query time period at the current moment based on the length of the latest query time period that has been stored. This method can improve the efficiency of determining the query time period, thereby improving the efficiency of obtaining the resource conversion rate. The embodiment of the present application does not limit the method for determining the length of the query time period.

[0085] For example, Figure 5 is a framework diagram for obtaining the length of a query time period according to an embodiment of the present application. Figure 5 , a communication connection is established between the server and the plurality of resource agencies. Then, the server obtains the resource conversion rate between the first resource and the second resource from the plurality of resource agencies. The server can store the obtained resource conversion rate in a resource database. Then, the server determines the length of the query time period according to the number of obtained resource conversion rates. Then, the server stores the length of the query time period. When the user queries the resource conversion rate, the server can directly obtain the length of the stored query time period and provide the user with the resource conversion rate based on the length.

[0086] Among them, the server can subscribe to resource conversion rates in multiple resource agencies so that when the resource conversion rate is updated, the resource agency can actively push the latest resource conversion rate to the server. For example, the resource is currency, the resource conversion rate is the exchange rate, the resource agency is a bank, and the server is a server of a third-party payment agency. The server can be connected to the price source of the streaming tradable exchange rate of multiple domestic and foreign banks through the Financial Information Exchange (FIX) protocol, and subscribe to the quotes of the best exchange rates that the banks can provide. Alternatively, the server can also frequently visit multiple resource agencies to request the latest resource conversion rate. The embodiment of the present application does not limit the way in which the server obtains the resource conversion rate.

[0087] In some embodiments, the length of the query time period is updated periodically. The update period of the query time period may be 1 second, 5 seconds, or 10 seconds, etc., and the embodiment of the present application does not limit the length of the update period. Accordingly, in the process of determining the length of the query time period, the initial value may be the length of the query time period corresponding to the first update period. The first update period is the update period in which the current moment is located. That is, when the latest length has been calculated in the update period in which the current moment is located, when the user queries the resource conversion rate, the length corresponding to the current update period is used, and the number of resource conversion rate acquisitions is counted. By comparing the number of acquisitions with the preset number, it is determined whether the length corresponding to the current update period can be used directly, or, based on the length corresponding to the current update period, adjustments are made to determine the length of the query time period at the current moment, so that the determined length of the query time period is more accurate, providing a guarantee for the subsequent determination of a more accurate resource conversion rate.

[0088] Alternatively, in the process of determining the length of the query time period, the initial value may also be the length of the query time period corresponding to the second update cycle. The second update cycle is the previous update cycle of the first update cycle. That is, when the user queries the resource conversion rate, the length corresponding to the previous update cycle is obtained using the current update cycle, and the number of resource conversion rate acquisitions is counted. By comparing the number of acquisitions with the preset number, it is determined whether the length corresponding to the previous update cycle can be used directly, or, based on the length corresponding to the previous update cycle, adjustments are made to determine the length of the query time period at the current moment, which not only makes the determined query time period length more accurate, providing a guarantee for the subsequent determination of a more accurate resource conversion rate, but also the update of the resource conversion rate in adjacent update cycles is similar. By adjusting the length corresponding to the previous update cycle, it is possible to speed up the adjustment to the length that meets the current update cycle, that is, it is possible to improve the efficiency of determining the query time period, thereby improving the efficiency of obtaining the resource conversion rate.

[0089] Among them, the initial value of the query time period corresponding to different resource conversion rates, the change amount of each adjustment, and the limited length can be different or the same, and the embodiment of the present application does not limit this. For example, the initial value of the query time period corresponding to the resource conversion rate between the first resource and the second resource is 1 second, the change amount of each adjustment is 1 second, and the limited length is 30 seconds. The initial value of the query time period corresponding to the resource conversion rate between the third resource and the fourth resource is 2 seconds, the change amount of each adjustment is 2 seconds, and the limited length is 35 seconds.

[0090] Optionally, the initial value of the query time period corresponding to each resource conversion rate, the amount of change each time adjustment, and the limited length may be related to the update frequency of the resource conversion rate. For example, the higher the update frequency of the resource conversion rate, the smaller the initial value of the query time period corresponding to the resource conversion rate, the smaller the amount of change each time adjustment, and the smaller the limited length. The lower the update frequency of the resource conversion rate, the larger the initial value of the query time period corresponding to the resource conversion rate, the larger the amount of change each time adjustment, and the larger the limited length.

[0091] 302. The server determines a query time period based on the current time and the length of the query time period, and the end time of the query time period is the current time.

[0092] In the embodiment of the present application, the server uses the time period before the current moment and the length determined in step 301 as the query time period, so as to subsequently obtain the resource conversion rates provided by multiple resource agencies within the query time period. The solution provided by the embodiment of the present application determines a time period before the current moment as the query time period, so that the first resource conversion rate obtained subsequently can accurately reflect the current situation of the resource conversion rate in the market, and provide a guarantee for the subsequent calculation of a more accurate second resource conversion rate.

[0093] 303. The server obtains resource conversion rates between first resources and second resources in multiple resource organizations within a query period, and obtains multiple first resource conversion rates.

[0094] In an embodiment of the present application, the server can store the resource conversion rate between the first resource and the second resource provided by multiple resource agencies in a resource database. In the resource database, the storage format of each resource conversion rate is "value of resource conversion rate + source + update time". The source of the resource conversion rate refers to the resource agency that provides the resource conversion rate of this value. The update time of the resource conversion rate is the time when the resource conversion rate is updated to this value in the resource agency. In the case where the resource agency can actively push the resource conversion rate to the server when updating the resource conversion rate, the update time of the resource conversion rate can be the time when the server receives the resource conversion rate of this value.

[0095] For example, the data of a resource conversion rate in the resource database is: Currency A-Currency B: 7.0+Bank A+2024-06-19 17:01:10. It can be seen that the resource conversion rate is the exchange rate between currency A and currency B, and the exchange rate is 7.0; the exchange rate of 7.0 is provided by Bank A and the update time is 17:01:10 on June 19, 2024.

[0096] When a user queries a resource conversion rate, after determining the query time period, the server can obtain the resource conversion rate whose update time is within the query time period from the resource database to obtain multiple first resource conversion rates. The resource database can be located inside the current server or in other computer devices, which is not limited in the embodiments of the present application.

[0097] In some embodiments, for any resource agency among multiple resource agencies, if the resource agency does not provide a resource conversion rate between a first resource and a second resource within a query time period, the server determines that the latest resource conversion rate previously provided by the resource agency is the first resource conversion rate corresponding to the resource agency. That is, in the case where the resource agency does not provide a resource conversion rate within the query time period, the resource agency is very likely not to have updated the resource conversion rate and still maintains the previous resource conversion rate. In this case, the server obtains the latest resource conversion rate previously provided by the resource agency as the resource conversion rate in the resource agency within the query time period, so that the final resource conversion rate can be calculated based on the resource conversion rates in as many resource agencies as possible, so that the final resource conversion rate is more accurate and more in line with the current resource conversion rate in the market.

[0098] For any resource agency, if the resource agency does not provide a resource conversion rate during the query time period, the resource agency may also stop providing the resource conversion rate due to an abnormality. In this case, the latest resource conversion rate previously provided by the resource agency cannot accurately reflect the situation of the resource conversion rate in the resource agency. Accordingly, the server no longer obtains the resource conversion rate of the resource agency during the query time period. That is, in the process of calculating the final resource conversion rate in the subsequent step 304, the server no longer considers the resource conversion rate of the resource agency (the resource conversion rate of the resource agency does not participate in the subsequent calculation).

[0099] Correspondingly, for any resource agency among the multiple resource agencies, if the resource agency does not provide the resource conversion rate between the first resource and the second resource within the query time period, the server determines the update time of the latest resource conversion rate previously provided by the resource agency. When the time difference between the update time and the current moment is lower than the duration threshold, the server determines that the latest resource conversion rate previously provided by the resource agency is the first resource conversion rate corresponding to the resource agency (the resource conversion rate of the resource agency within the query time period). When the time difference between the update time and the current moment reaches the duration threshold, the server no longer considers the resource conversion rate of the resource agency. The embodiment of the present application does not limit the duration threshold.

[0100] The solution provided in the embodiment of the present application is that for any resource agency, if the resource agency does not provide a new resource conversion rate in a short period of time, no matter the resource agency does not update the resource conversion rate or the resource agency interrupts providing the resource conversion rate, due to the short time difference, the latest resource conversion rate provided previously is almost the same as the current resource conversion rate. The latest resource conversion rate provided previously is used as the resource conversion rate in the resource agency during the query time period, so that the final resource conversion rate can be calculated based on the resource conversion rates in as many resource agencies as possible, so that the final resource conversion rate is more accurate and more in line with the current resource conversion rate in the market; if the resource agency does not provide a new resource conversion rate for a long time, the latest resource conversion rate provided previously cannot reflect the current resource conversion rate. In this case, the resource conversion rate of the resource agency is no longer considered, which can also provide a guarantee for providing accurate resource conversion rates to users in the future.

[0101] 304. The server determines a second resource conversion rate between the first resource and the second resource based on the multiple first resource conversion rates, and outputs the second resource conversion rate.

[0102] In the embodiment of the present application, the server calculates a plurality of first resource conversion rates to obtain a second resource conversion rate between the first resource and the second resource. The embodiment of the present application does not limit the calculation method of the second resource conversion rate.

[0103] In some embodiments, the server can average multiple first resource conversion rates to obtain a second resource conversion rate between the first resource and the second resource. The solution provided in the embodiment of the present application averages the resource conversion rates provided by multiple resource agencies during the query period to obtain a final resource conversion rate, so that the final resource conversion rate can accurately reflect the current resource conversion rate situation in the market, which is more accurate.

[0104] For example, Figure 6 This is a method for calculating resource conversion rate according to an embodiment of the present application. Figure 6, the server obtains the length of the query time period at the current moment. Then, the server determines the query time period based on the current moment and the length of the query time period. Then, the server obtains multiple first resource conversion rates provided by multiple resource agencies within the query time period from the resource database. Then, the server averages the multiple first resource conversion rates and uses the average value as the final resource conversion rate (i.e., the second resource conversion rate).

[0105] In other embodiments, the server can perform weighted summation of multiple first resource conversion rates based on multiple resource agencies to obtain a second resource conversion rate between the first resource and the second resource. The weight of each resource conversion rate is positively correlated with the qualification of the resource agency corresponding to the resource conversion rate. The solution provided in the embodiment of the present application performs weighted summation of the resource conversion rates provided by multiple resource agencies during the query period. Since the resource conversion rates provided by resource agencies with higher qualifications are more accurate and can better reflect the actual situation of resource conversion rates in the market, the resource conversion rates of resource agencies with higher qualifications have higher weights, and the impact on the final resource conversion rate is greater, so that the final resource conversion rate can more accurately reflect the current situation of resource conversion rates in the market, and is more accurate.

[0106] The qualifications of a resource institution may be assessed by a relevant management department or by the resource conversion rate provided by the resource institution in a historical period. For example, the smaller the difference between the resource conversion rate provided by the resource institution and the actual conversion rate when resources were exchanged in the market at that time in the historical period, the higher the qualification of the resource institution. The disclosed embodiment does not limit the method for assessing the qualifications of a resource institution.

[0107] In other embodiments, the server can perform weighted summation of multiple first resource conversion rates based on the update time of multiple first resource conversion rates to obtain a second resource conversion rate between the first resource and the second resource. The weight of each resource conversion rate is negatively correlated with the update time of the first resource conversion rate. The solution provided in the embodiment of the present application performs weighted summation of resource conversion rates provided by multiple resource agencies within the query period. Since the resource conversion rate with a later update time is closer to the current moment, it can more accurately reflect the actual situation of the resource conversion rate in the market at the current moment. The resource conversion rate with an update time closer to the current moment has a higher weight, and the greater the impact on the final resource conversion rate, so that the final resource conversion rate can more accurately reflect the current situation of the resource conversion rate in the market, and is more accurate.

[0108] For example, if the length of the query time period is equal to the initial value (such as 1 second), the weights of multiple first resource conversion rates in the query time period are all 1. If the length of the query time period is greater than the initial value, the weight of the first resource conversion rate in the first sub-time period of the query time period is 0.7, and the weight of the first resource conversion rate in the second sub-time period is 0.3. The first sub-time period is a partial time period in the query time period close to the current time. The length of the first sub-time period is equal to the initial value. The second sub-time period is the remaining time period in the query time period except the first sub-time period.

[0109] In order to more clearly describe the method for obtaining the resource conversion rate provided in the embodiment of the present application, the method for obtaining the resource conversion rate is further described below with reference to the accompanying drawings. Figure 7 is a framework diagram for obtaining resource conversion rate according to an embodiment of the present application. Figure 7 When receiving a query request from a user for a resource conversion rate between a first resource and a second resource, the server obtains the length of the query time period at the current time. Then, the server determines the query time period based on the current time and the length of the query time period. Then, the server obtains multiple first resource conversion rates provided by multiple resource agencies within the query time period from a resource database. Then, the server calculates the second resource conversion rate based on the multiple first resource conversion rates. Then, the server returns the second resource conversion rate to the user.

[0110] The embodiment of the present application provides a method for obtaining a resource conversion rate. In the process of querying the resource conversion rate between a first resource and a second resource, the time period to which the resource conversion rate to be queried belongs is determined according to the update frequency of the resource conversion rates in multiple resource agencies. Since the update status of the resource conversion rates in multiple resource agencies can reflect the overall status of the resource conversion rates in the resource conversion market, that is, the higher the update frequency of the resource conversion rate, the more volatile the resource conversion rate in the market, and the lower the update frequency of the resource conversion rate, the more stable the resource conversion rate in the market. When the resource conversion rate is more volatile, the length of the query time period is shortened so that the first resource conversion rate in a short period of time obtained subsequently can accurately reflect the current resource conversion rate in the market. When the resource conversion rate is more stable, the length of the query time period is extended so that the first resource conversion rate in a long period of time obtained subsequently can also accurately reflect the current resource conversion rate in the market. Therefore, the second resource conversion rate determined based on the above-mentioned first resource conversion rate is more accurate and in line with the current resource conversion rate in the market.

[0111] In other words, the above method makes it possible to determine the second resource conversion rate by taking into account the overall update situation of the resource conversion rate in the market. When any resource institution interrupts providing the resource conversion rate or increases the update frequency of the resource conversion rate, the third-party payment institution can obtain and perceive such sudden situations and calculate appropriate and accurate resource conversion rates for users based on the overall situation of the resource conversion rate in the market, thereby improving the quality of the resource exchange service of the third-party payment institution.

[0112] Figure 8 is a block diagram of a device for obtaining resource conversion rate according to an embodiment of the present application. The device is used to execute the steps of the above-mentioned method for obtaining resource conversion rate, see Figure 8 The resource conversion rate acquisition device includes: a first determination module 801, an acquisition module 802 and a second determination module 803.

[0113] A first determining module 801 is used to determine a query time period in response to a query request for a resource conversion rate between a first resource and a second resource based on the update frequency of the resource conversion rate by multiple resource agencies, wherein the length of the query time period is inversely proportional to the update frequency;

[0114] An acquisition module 802 is used to acquire resource conversion rates between first resources and second resources in multiple resource agencies within a query period, and obtain multiple first resource conversion rates;

[0115] The second determination module 803 is used to determine a second resource conversion rate between the first resource and the second resource based on the multiple first resource conversion rates, and output the second resource conversion rate.

[0116] In some embodiments, the first determining module 801 includes:

[0117] An acquisition unit, configured to, in response to a query request for a resource conversion rate between a first resource and a second resource, acquire a length of a query time period at a current moment based on an update frequency of the resource conversion rate by a plurality of resource agencies;

[0118] The determining unit is used to determine the query time period based on the current time and the length of the query time period, and the end time of the query time period is the current time.

[0119] In some embodiments, an acquisition unit is used to set the length of a query time period to an initial value; based on the query time period whose length is the initial value, an initial number is determined, and the initial number is the number of resource conversion rates provided by multiple resource agencies within the query time period whose length is the initial value; when the initial number is greater than a preset number, the length of the query time period at the current moment is determined to be the initial value.

[0120] In some embodiments, the acquisition unit is further used to increase the length of the query time period at least once when the initial number is not greater than the preset number, until the number of resource conversion rates provided by multiple resource agencies within the query time period is greater than the preset number.

[0121] In some embodiments, the acquisition unit is used to determine the length of the query time period at the current moment as the initial value when the initial number is greater than the preset number and the difference between the initial number and the preset number is less than a preset value.

[0122] In some embodiments, the acquisition unit is also used to, when the initial number is greater than the preset number, if the difference between the initial number and the preset number is not less than a preset value, reduce the length of the query time period at least once, until the difference between the number of resource conversion rates provided by multiple resource agencies within the query time period and the preset number is less than the preset value.

[0123] In some embodiments, the length of the query period is updated periodically; the initial value is any of the following:

[0124] The initial value is the length of the query time period corresponding to the first update cycle, where the first update cycle is the update cycle in which the current moment is located; or,

[0125] The initial value is the length of the query time period corresponding to the second update cycle, and the second update cycle is an update cycle before the first update cycle.

[0126] In some embodiments, the acquisition unit is further configured to determine that the length of the query time period is the limited length when the adjusted length is not less than the limited length.

[0127] In some embodiments, the apparatus further comprises:

[0128] A storage module, used for storing the resource conversion rates provided by multiple resource agencies when updating the resource conversion rates in a resource database;

[0129] The acquisition module 802 is used to acquire, from a resource database, resource conversion rates whose update time is within a query time period, and obtain a plurality of first resource conversion rates.

[0130] In some embodiments, the acquisition module 802 is also used to determine, for any resource agency among multiple resource agencies, that the latest resource conversion rate previously provided by the resource agency is the first resource conversion rate corresponding to the resource agency if the resource agency does not provide a resource conversion rate between the first resource and the second resource within the query time period.

[0131] In some embodiments, the second determination module 803 is used to average multiple first resource conversion rates to obtain a second resource conversion rate between the first resource and the second resource.

[0132] In some embodiments, the second determination module 803 is used to perform weighted summation of multiple first resource conversion rates based on multiple resource agencies to obtain a second resource conversion rate between the first resource and the second resource, and the weight of each resource conversion rate is positively correlated with the qualification of the resource agency corresponding to the resource conversion rate.

[0133] In some embodiments, the second determination module 803 is used to perform weighted summation of multiple first resource conversion rates based on the update time of the multiple first resource conversion rates to obtain the second resource conversion rate between the first resource and the second resource, and the weight of each resource conversion rate is negatively correlated with the update time of the first resource conversion rate.

[0134] The embodiment of the present application provides a device for obtaining a resource conversion rate. In the process of querying the resource conversion rate between a first resource and a second resource, the time period to which the resource conversion rate to be queried belongs is determined according to the update frequency of the resource conversion rates in multiple resource agencies. Since the update status of the resource conversion rates in multiple resource agencies can reflect the overall status of the resource conversion rates in the resource conversion market, that is, the higher the update frequency of the resource conversion rate, the more volatile the resource conversion rate in the market, and the lower the update frequency of the resource conversion rate, the more stable the resource conversion rate in the market. When the resource conversion rate is more volatile, the length of the query time period is shortened so that the first resource conversion rate in a short period of time obtained subsequently can accurately reflect the current resource conversion rate in the market. When the resource conversion rate is more stable, the length of the query time period is extended so that the first resource conversion rate in a long period of time obtained subsequently can also accurately reflect the current resource conversion rate in the market. Therefore, the second resource conversion rate determined based on the above-mentioned first resource conversion rate is more accurate and in line with the current resource conversion rate in the market.

[0135] In other words, the above method makes it possible to determine the second resource conversion rate by taking into account the overall update situation of the resource conversion rate in the market. When any resource institution interrupts providing the resource conversion rate or increases the update frequency of the resource conversion rate, the third-party payment institution can obtain and perceive such sudden situations and calculate appropriate and accurate resource conversion rates for users based on the overall situation of the resource conversion rate in the market, thereby improving the quality of the resource exchange service of the third-party payment institution.

[0136] It should be noted that: the resource conversion rate acquisition device provided in the above embodiment only uses the division of the above functional modules as an example when determining the resource conversion rate. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the resource conversion rate acquisition device provided in the above embodiment and the resource conversion rate acquisition method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0137] In the embodiments of the present application, the computer device can be configured as a terminal or a server. When the computer device is configured as a terminal, the terminal can be used as the execution subject to implement the technical solution provided in the embodiments of the present application. When the computer device is configured as a server, the server can be used as the execution subject to implement the technical solution provided in the embodiments of the present application. The technical solution provided in the present application can also be implemented through interaction between the terminal and the server. The embodiments of the present application are not limited to this.

[0138] Fig. 9 It is a structural diagram of a server provided according to an embodiment of the present application. The server 900 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 901 and one or more memories 902, wherein the memory 902 stores at least one computer program, and the at least one computer program is loaded and executed by the processor 901 to implement the resource conversion rate acquisition method provided by the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server may also include other components for implementing device functions, which will not be described in detail here.

[0139] The embodiment of the present application also provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is loaded and executed by a processor of a computer device to implement the operation performed by the computer device in the method for obtaining the resource conversion rate of the above embodiment. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, and an optical data storage device.

[0140] In some embodiments, the computer program involved in the embodiments of the present application may be deployed and executed on a computer device, or on multiple computer devices located at one location, or on multiple computer devices distributed at multiple locations and interconnected by a communication network. Multiple computer devices distributed at multiple locations and interconnected by a communication network may constitute a blockchain system.

[0141] The embodiment of the present application also provides a computer program product, including a computer program, which is stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the resource conversion rate acquisition method provided in the above various optional implementations.

[0142] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0143] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for obtaining resource conversion rate, characterized in that: The method comprises: In response to a query request for a resource conversion rate between a first resource and a second resource, determining a query time period based on a frequency of updating the resource conversion rate by a plurality of resource agencies, wherein the length of the query time period is inversely proportional to the update frequency; Acquire a resource conversion rate between the first resource and the second resource in the plurality of resource agencies within the query time period to obtain a plurality of first resource conversion rates; Based on the multiple first resource conversion rates, a second resource conversion rate between the first resource and the second resource is determined, and the second resource conversion rate is output.

2. The method according to claim 1, characterized in that The step of determining a query time period in response to a query request for a resource conversion rate between a first resource and a second resource based on update frequencies of resource conversion rates by multiple resource agencies includes: In response to a query request for a resource conversion rate between a first resource and a second resource, based on the update frequency of the resource conversion rate by the multiple resource agencies, obtaining the length of the query time period at the current moment; The query time period is determined based on the current time and the length of the query time period, and the end time of the query time period is the current time.

3. The method according to claim 2, characterized in that The obtaining the length of the query time period at the current moment based on the update frequency of the resource conversion rate by the multiple resource agencies includes: Setting the length of the query time period to an initial value; Determine an initial number based on a query time period having a length of the initial value, wherein the initial number is the number of resource conversion rates provided by the plurality of resource agencies within the query time period having a length of the initial value; In the case that the initial number is greater than the preset number, the length of the query time period at the current moment is determined to be the initial value.

4. The method according to claim 3, characterized in that The method further comprises: When the initial number is not greater than the preset number, the length of the query time period is increased and adjusted at least once until the number of resource conversion rates provided by the multiple resource agencies within the query time period is greater than the preset number.

5. The method according to claim 3, characterized in that: When the initial number is greater than the preset number, determining the length of the query time period at the current moment as the initial value includes: In the case where the initial number is greater than the preset number, if the difference between the initial number and the preset number is less than a preset value, the length of the query time period at the current moment is determined to be the initial value.

6. The method according to claim 5, characterized in that The method further comprises: In the case where the initial number is greater than the preset number, if the difference between the initial number and the preset number is not less than the preset value, the length of the query time period is reduced and adjusted at least once until the difference between the number of resource conversion rates provided by the multiple resource agencies within the query time period and the preset number is less than the preset value.

7. The method according to claim 3, characterized in that The length of the query time period is updated periodically; the initial value is any one of the following: The initial value is the length of the query time period corresponding to a first update period, where the first update period is the update period in which the current moment is located; or The initial value is the length of the query time period corresponding to a second update cycle, and the second update cycle is an update cycle before the first update cycle.

8. The method according to any one of claims 4 or 6, characterized in that: The method further comprises: When the adjusted length is not less than the limited length, the length of the query time period is determined to be the limited length.

9. The method according to claim 1, characterized in that: The method further comprises: storing the resource conversion rates provided by the plurality of resource agencies when updating the resource conversion rates in a resource database; The acquiring the resource conversion rate between the first resource and the second resource in the plurality of resource mechanisms within the query time period to obtain a plurality of first resource conversion rates includes: From the resource database, resource conversion rates whose update time is within the query time period are acquired to obtain the multiple first resource conversion rates.

10. The method according to claim 9, characterized in that The method further comprises: For any resource agency among the multiple resource agencies, if the resource agency does not provide the resource conversion rate between the first resource and the second resource within the query time period, the latest resource conversion rate previously provided by the resource agency is determined as the first resource conversion rate corresponding to the resource agency.

11. The method according to claim 1, characterized in that: The determining, based on the plurality of first resource conversion rates, a second resource conversion rate between the first resource and the second resource comprises: The plurality of first resource conversion rates are averaged to obtain a second resource conversion rate between the first resource and the second resource.

12. The method according to claim 1, characterized in that The determining, based on the plurality of first resource conversion rates, a second resource conversion rate between the first resource and the second resource comprises: Based on the multiple resource agencies, the multiple first resource conversion rates are weighted and summed to obtain a second resource conversion rate between the first resource and the second resource, and the weight of each resource conversion rate is positively correlated with the qualification of the resource agency corresponding to the resource conversion rate.

13. The method according to claim 1, characterized in that The determining, based on the plurality of first resource conversion rates, a second resource conversion rate between the first resource and the second resource comprises: Based on the update time of the multiple first resource conversion rates, the multiple first resource conversion rates are weighted and summed to obtain the second resource conversion rate between the first resource and the second resource, and the weight of each resource conversion rate is negatively correlated with the update time of the first resource conversion rate.

14. A device for obtaining resource conversion rate, characterized in that: The device comprises: A first determining module, configured to determine, in response to a query request for a resource conversion rate between a first resource and a second resource, a query time period based on an update frequency of the resource conversion rate by a plurality of resource agencies, wherein the length of the query time period is inversely proportional to the update frequency; An acquisition module, used for acquiring a resource conversion rate between the first resource and the second resource in the plurality of resource agencies within the query time period, to obtain a plurality of first resource conversion rates; The second determination module is used to determine a second resource conversion rate between the first resource and the second resource based on the multiple first resource conversion rates, and output the second resource conversion rate.

15. A computer device, characterized in that: The computer device includes a processor and a memory, the memory is used to store at least one computer program, and the at least one computer program is loaded by the processor and executes the method for obtaining the resource conversion rate according to any one of claims 1 to 13.

16. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store at least one computer program, and the at least one computer program is used to execute the method for obtaining the resource conversion rate according to any one of claims 1 to 13.

17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method for obtaining the resource conversion rate according to any one of claims 1 to 13 is implemented.