Exchange rate data collection method, device, equipment, storage medium and program product
By acquiring and storing real-time exchange rate data and calculating and storing historical exchange rate data, the problem of unstable exchange rate data is solved, the stability and consistency of exchange rate data is achieved, and business risks are reduced.
Patent Information
- Application Number
- CN202111592451.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-23
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-12-23
AI Technical Summary
In the existing technology, when obtaining exchange rate data between multiple currencies, the providers are diverse and unstable, resulting in large fluctuations in exchange rate data and affecting the stability of business processing.
By obtaining real-time exchange rate data from data providers, calculating historical exchange rate data, and storing it in a distributed storage system, it ensures that multiple business users obtain the same exchange rate data and reduces data volatility.
It improves the stability of exchange rate data, ensures the consistency of data obtained by each business user, and reduces the risk of data loss and business impact.
Smart Images

Figure CN114266572B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data acquisition and processing, and in particular to a method, device, equipment, storage medium and program product for collecting exchange rate data. Background Art
[0002] In the process of e-commerce, live broadcast applications, finance and other business processes, conversion between multiple currencies is often involved.
[0003] In the related art, in order to handle business involving multiple currencies, recent exchange rate data that is free and open is obtained through network query. However, in the process of multiple queries, the providers of exchange rate data are various, which leads to the large volatility and instability of the exchange rate data obtained. Summary of the invention
[0004] The embodiment of the present application provides a method, device, equipment, storage medium and program product for collecting exchange rate data. The technical solution is as follows:
[0005] According to one aspect of an embodiment of the present application, a method for collecting exchange rate data is provided, the method comprising:
[0006] Acquire real-time exchange rate data at at least one time point within a first period from a data provider;
[0007] Determining historical exchange rate data for the first period based on real-time exchange rate data at multiple different time points within the first period;
[0008] The historical exchange rate data of the first period is stored in a distributed storage system, and the distributed system is used to provide exchange rate data to multiple different business users.
[0009] According to one aspect of an embodiment of the present application, a device for collecting exchange rate data is provided, the device comprising:
[0010] A data acquisition module, used to acquire real-time exchange rate data at at least one time point within a first period from a data provider;
[0011] a data determination module, configured to determine the historical exchange rate data for the first period of time based on the real-time exchange rate data at a plurality of different time points within the first period of time;
[0012] The data storage module is used to store the historical exchange rate data of the first period in a distributed storage system, and the distributed system is used to provide exchange rate data to multiple different business users.
[0013] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned method for collecting exchange rate data.
[0014] According to one aspect of an embodiment of the present application, a computer program product is provided, which includes computer instructions stored in a computer-readable storage medium, and a processor reads and executes the computer instructions from the computer-readable storage medium to implement the above-mentioned method for collecting exchange rate data.
[0015] The technical solution provided in the embodiments of the present application can bring the following beneficial effects:
[0016] By storing the acquired exchange rate data in a distributed storage system, it is ensured that the exchange rate data acquired by each business user is the same, thereby improving the stability of the acquired exchange rate data.
[0017] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application;
[0019] Figure 2 is a flow chart of a method for collecting exchange rate data provided by an embodiment of the present application;
[0020] Figure 3 is a flow chart of a method for collecting exchange rate data provided by another embodiment of the present application;
[0021] Figure 4 This is a schematic diagram of currency conversion provided by an embodiment of the present application;
[0022] Figure 5 is a schematic diagram of a distributed storage system provided by an embodiment of the present application;
[0023] Figure 6 is a schematic diagram of a distributed storage system provided by another embodiment of the present application;
[0024] Figure 7 is a block diagram of a device for collecting exchange rate data provided by one embodiment of the present application;
[0025] Figure 8 It is a block diagram of an exchange rate data collection device provided by another embodiment of the present application. DETAILED DESCRIPTION
[0026] 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.
[0027] In the method provided in the embodiment of the present application, the execution subject of each step may be a computer device, which refers to an electronic device with data calculation, processing and storage capabilities. The computer device may be a terminal such as a PC (Personal Computer), a tablet computer, a smart phone, a wearable device, an intelligent robot, etc.; or it may be a server. Among them, the server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0028] The technical solution of the present application is introduced and explained below through several embodiments.
[0029] Please refer to Figure 1 , which shows a schematic diagram of the implementation environment of the solution provided by an embodiment of the present application. The implementation environment can be implemented as a collection system 10 for exchange rate data. Figure 1 As shown, the system 10 includes: an exchange rate service system 11, a service user 12 and a data provider 13. Among them:
[0030] In some embodiments, the exchange rate service system 11 obtains and stores exchange rate data from the data provider 13. Optionally, the exchange rate service system 11 can be the above-mentioned computer device, or can be set on a computer device. The business user 12 is used to query and obtain the exchange rate data required for processing the business from the exchange rate service system 11. Optionally, the business user can be an e-commerce system, a financial system, a live broadcast application system, etc., which is not specifically limited in the embodiments of the present application.
[0031] Optionally, the exchange rate service system 11 includes an exchange rate query module 14, an exchange rate configuration module 15 and an exchange rate routing module 16. The exchange rate query module 14 is used to provide exchange rate data query services to the service user 12, the exchange rate configuration module 15 is used to calculate the exchange rate data of some currency pairs, and the exchange rate routing module 16 is used to obtain the exchange rate data from the data provider 13.
[0032] Please refer to Figure 2 , which shows a flow chart of a method for collecting exchange rate data provided by an embodiment of the present application. The method may include the following steps (201-203):
[0033] Step 201: obtaining real-time exchange rate data of at least one time point in a first period from a data provider.
[0034] In some embodiments, the data provider refers to a data source that can provide real-time exchange rate data, such as a website that specifically provides real-time exchange rate data or a functional module in the website. The first time period can be within a certain day, within a certain week, within a certain month, etc., and the embodiments of the present application do not specifically limit this. Exemplarily, the first time period refers to a certain day, and at least one time point is one or more time points within this day. For example, at least one time point can be 00:30, 12:00, and 23:00 in a certain day. The real-time exchange rate data refers to the exchange rate data corresponding to the three time points of 00:30, 12:00, and 23:00 on this day provided by the data provider.
[0035] Optionally, obtaining real-time exchange rate data from a fixed data provider can reduce the volatility of the exchange rate data obtained and improve the stability of the exchange rate data. Optionally, the exchange rate data provided by the data provider is provided for a fee or free of charge, which is not specifically limited in the embodiments of the present application.
[0036] Step 202: determining historical exchange rate data for the first period based on real-time exchange rate data at multiple different time points within the first period.
[0037] In some embodiments, for two currencies, if at least one time point includes multiple time points, the historical exchange rate data for the first time period may be the average of the real-time exchange rate ratios of the two currencies at at least one time point; if at least one time point includes only one time point, the historical exchange rate data for the first time period is the real-time exchange rate ratio of the two currencies at that time point.
[0038] Step 203: storing the historical exchange rate data of the first period in the distributed storage system.
[0039] In some embodiments, the distributed storage system may use KV (Key-Value) for storage, and the distributed storage system is used to provide exchange rate data to multiple different business users. Multiple different business users establish communication connections with the distributed storage system, and store the historical exchange rate data of the first period in the storage system for query by each business user.
[0040] Optionally, the real-time exchange rate data of at least one time point in the first period needs to be stored in the distributed storage system. In the case where the historical exchange rate data of the first period is lost or cannot be found, the real-time exchange rate data of at least one time point in the first period stored in advance can be obtained to recalculate the historical exchange rate data of the first period. This improves the stability of obtaining exchange rate data and reduces the risk of losing exchange rate data.
[0041] In summary, the technical solution provided in the embodiment of the present application ensures that the exchange rate data obtained by each business user is the same by storing the obtained exchange rate data in a distributed storage system, thereby improving the stability of the obtained exchange rate data.
[0042] Please refer to Figure 3 , which shows a flow chart of a method for collecting exchange rate data provided by an embodiment of the present application. The method may include at least one of the following steps (301-308):
[0043] Step 301: Send a first acquisition request to a primary provider, where the first acquisition request is used to request real-time exchange rate data of at least one time point within a first period from the primary provider.
[0044] In some embodiments, the data provider includes a main provider and a backup provider. First, the main provider is requested to obtain real-time exchange rate data of at least one time point in the first time period. Optionally, the main provider charges more favorable fees than the backup provider, or updates the exchange rate data of the backup provider more timely, or is more accurate than the exchange rate data of the backup provider, or is more stable than the exchange rate data of the backup provider, or is more convenient than obtaining the exchange rate data from the backup provider. Optionally, the first acquisition request also includes the currency corresponding to the exchange rate data requested to be obtained, such as requesting to obtain the real-time exchange rate ratio of the US dollar to the RMB.
[0045] In some embodiments, after step 301, the following steps are also included:
[0046] 1. If the first feedback information is not received from the primary provider, a second acquisition request is sent to the backup provider;
[0047] 2. Receive second feedback information from the backup provider;
[0048] 3. Store the second feedback information.
[0049] In this embodiment, when the first acquisition request fails multiple times, or the first feedback information from the main provider is not received, or the first acquisition request times out and fails to be sent or the first feedback information is not received due to timeout, no time is wasted on waiting for the first feedback information, but a second acquisition request is sent to the backup provider to obtain and store the real-time exchange rate data provided by the backup provider. Exemplarily, the second acquisition request is used to request the real-time exchange rate ratio of currency 1 to currency B, and the second feedback information includes the real-time exchange rate ratio of currency 1 to currency C provided by the backup provider and the corresponding time.
[0050] Step 302: Receive first feedback information from a main provider, where the first feedback information includes real-time exchange rate data of at least one time point within a first period provided by the main provider.
[0051] In some embodiments, the first feedback information generated by the receiving main provider according to the first acquisition request can be used to obtain the exchange rate data requested by the first acquisition request, that is, the real-time exchange rate data of at least one time point in the first time period.
[0052] Step 303: Send a second acquisition request to the backup provider, where the second acquisition request is used to request the backup provider for real-time exchange rate data at at least one time point within the first period.
[0053] In some embodiments, after obtaining the first feedback information from the primary provider, a second acquisition request is continuously sent to the backup provider to obtain the real-time exchange rate data of at least one time point within the first period provided by the backup provider.
[0054] Step 304: receiving second feedback information from the backup provider, where the second feedback information includes real-time exchange rate data of at least one time point within the first period provided by the backup provider.
[0055] Step 305: When it is determined based on the second feedback information that the first feedback information is valid, the first feedback information is stored and the second feedback information is discarded.
[0056] In some embodiments, the real-time exchange rate data of at least one time point within the first time period provided by the main provider is compared with the real-time exchange rate data of at least one time point within the first time period provided by the backup provider. If the difference between the exchange rate data provided by the main provider and the exchange rate data provided by the backup provider is small, it can be considered that the first feedback information (i.e., the exchange rate data provided by the main provider) is more credible and the information is valid. Only the first feedback information (i.e., the real-time exchange rate data of at least one time point within the first time period provided by the main provider) is stored for use by the business user, and the second feedback information is discarded to save storage resources.
[0057] Optionally, the difference between the exchange rate data provided by the main provider and the exchange rate data provided by the backup provider is small, which may refer to the ratio of the difference between the exchange rate data provided by the main provider and the exchange rate data provided by the backup provider to the exchange rate data provided by the main provider being less than or equal to a threshold. On the contrary, if the ratio is greater than the threshold, it means that the difference between the exchange rate data provided by the main provider and the exchange rate data provided by the backup provider is large, and the first feedback information may be considered invalid.
[0058] In some possible implementations, when it is determined that the first feedback information is invalid based on the second feedback information, an alarm message is generated, and the alarm message is used to trigger manual intervention to calibrate the real-time exchange rate data at at least one time point in the first time period. In the case that the first feedback information is invalid, manual troubleshooting and calibration are enabled, such as through experience or previously stored real-time exchange rate data at various time points, from the real-time exchange rate data of at least one time point provided by the main provider and the backup provider, respectively, to determine the exchange rate data with higher credibility, and store it in the distributed storage system as the real-time exchange rate data of the corresponding time point, thereby further improving the stability and reliability of the acquired exchange rate data. Optionally, after triggering manual intervention calibration, the real-time exchange rate data of at least one time point in the first time period is obtained from other data providers other than the main provider and the backup provider, and the exchange rate data obtained from the other data providers is compared with the main provider and the backup provider (refer to the above-mentioned comparison process of the exchange rate data of the main provider and the backup provider) to confirm whether the first feedback information of the main provider is valid.
[0059] Step 306: Determine the real-time exchange rate data of at least one other currency pair at at least one time point in the first period based on the real-time exchange rate data of at least one target currency pair at at least one time point in the first period.
[0060] In some embodiments, the real-time exchange rate data of at least one target currency pair is obtained from a data provider. Based on the real-time exchange rate data of the acquired target currency pair, the real-time exchange rate data of other currency pairs at the corresponding time period or time point can be calculated, thereby reducing the number of times the exchange rate data is obtained from the data provider, and further saving the cost of obtaining the exchange rate data.
[0061] In some embodiments, the currencies in the target currency pair are commonly used currencies in global trade (such as US dollars, RMB, euros, etc.). Figure 3 As shown, there are exchange rate data between one currency and multiple other currencies. Since the transaction volume and transaction scale of commonly used currencies are large, the exchange rate data of currency pairs containing commonly used currencies are relatively stable, accurate, and reliable. Therefore, the exchange rate data of currency pairs containing commonly used currencies can be obtained from data providers. The transaction volume and transaction scale of uncommon currencies are small. Even if the data provider can provide its exchange rate data, it is relatively unstable, inaccurate, and less reliable. Therefore, the exchange rate data between two uncommon currencies can be calculated by obtaining the exchange rate data between one commonly used currency and two uncommon currencies.
[0062] For example, Figure 4As shown, in the known target currency pair, the real-time exchange rate ratio of currency 41 (i.e. commonly used currency a) to currency 42 (i.e. commonly used currency B) at a certain point in time is 1:6.3748, and the real-time exchange rate ratio of commonly used currency 41 to currency 43 (i.e. commonly used currency C) at the same point in time is 1:113.67. It can be calculated that the real-time exchange rate ratio of commonly used currency 42 to currency 43 at the same point in time is 6.3748:113.67≈1:17.83.
[0063] Step 307: determining historical exchange rate data for the first period according to the average of the real-time exchange rate data at multiple different time points in the first period.
[0064] In some embodiments, the average value of the real-time exchange rate data at at least one time point is directly summing the real-time exchange rate ratios of each time point and then dividing by the number of at least one time point. Exemplarily, the real-time exchange rate ratios of currency A to currency B at three time points in one day are 1:113.67, 1:113.96, and 1:113.44, respectively. The historical exchange rate data of currency A to currency B in the first period can be calculated according to the following process: 1 / 113.67+1 / 113.96+1 / 113.44=1 / 113.6896=1:113.6896, then the historical exchange rate data of currency A to currency B in the first period is 1:113.6896.
[0065] In some embodiments, the average value of the real-time exchange rate ratio at at least one time point is obtained by first taking the reciprocal of the real-time exchange rate ratio at each time point, then summing the reciprocals of the real-time exchange rate ratios corresponding to each time point to obtain the reciprocal sum, and then dividing the reciprocal sum by the number of at least one time point to obtain the historical exchange rate data for the first period. Exemplarily, the real-time exchange rate ratios of currency A to currency B at three time points in a day are 1:113.67, 1:113.96, and 1:113.44, respectively. The historical exchange rate data of currency A to currency B in the first period can be calculated according to the following process: the reciprocals of the real-time exchange rate ratios corresponding to the three time points are 113.67, 113.96, and 113.44, respectively; the average of the reciprocals of the three time points is (113.67+113.96+113.44) / 3=113.69, and the reciprocal of 113.69 is 1:113.69. Therefore, the historical exchange rate data of currency A to currency B in the first period is 1:113.69.
[0066] Step 308: Store the historical exchange rate data of the first period in the main database and the main cache node respectively.
[0067] In some embodiments, Figure 5 As shown, the distributed storage system 50 includes a distributed database 51 and a distributed cache 52. Figure 6As shown, the multiple databases in the distributed database 51 include a master database 61 and at least one slave database 62, and the multiple cache nodes in the distributed cache 52 include a master cache node 63 and at least one slave cache node 64. The master database is used to synchronize the historical exchange rate data of the first period to the slave database for storage, and the master cache node is used to synchronize the historical exchange rate data of the first period to the slave cache node for storage.
[0068] For example, after the exchange rate service system in Singapore obtains the exchange rate data a, the exchange rate data a is stored in the Singapore distributed cache node and the Singapore database, such as Figure 6 As shown, at this time, the Singapore database is used as the main database 61, the Americas database, the European database and the Chinese database are all used as slave databases 62, and the exchange rate data a is synchronously stored from the main database 62 (i.e., the Singapore database) to several slave databases 62 (i.e., the Americas database, the European database and the Chinese database).
[0069] For example, after the exchange rate service system in Singapore obtains the exchange rate data a, the exchange rate data a is stored in the Singapore distributed cache node and the Singapore database, such as Figure 6 As shown, at this time, the Singapore distributed cache node is used as the main cache node 63, the Americas distributed cache node, the European distributed cache node and the China distributed cache node are all used as slave cache nodes 64, and the exchange rate data a is synchronously cached from the main cache node 64 (i.e., the Singapore distributed cache node) to several slave cache nodes 64 (i.e., the Americas distributed cache node, the European distributed cache node and the China distributed cache node).
[0070] In some embodiments, optionally, the database is MySQL, and the task scheduling adopts XXL-JOB. When the business user needs to obtain exchange rate data from the distributed storage system, according to the principle of proximity, in order to minimize access delay and shorten the data query time: the required exchange rate data is preferentially queried from the local cache of the exchange rate service node closest to the business user; if the required exchange rate data cannot be queried from the local cache of the exchange rate service node closest to the business user, then the required exchange rate data is queried from the nearest distributed cache node; if the required exchange rate data cannot be queried from the nearest distributed cache node, then the required exchange rate data is queried from the nearest database; if the required exchange rate data still cannot be queried from the nearest database, then the required exchange rate data is queried from the distributed cache nodes and databases in other regions in turn. That is, the query priority of the exchange rate data is: local cache>distributed cache node>database.
[0071] For example, when a business user located in China needs to obtain exchange rate data from a distributed storage system, the required exchange rate data is preferentially queried from the local cache of the exchange rate service node closest to the business user in China; if the required exchange rate data cannot be queried from the local cache of the exchange rate service node closest to the business user, the exchange rate data is queried from the distributed cache China node; if the required exchange rate data cannot be queried from the distributed cache China node, the exchange rate data is queried from the China database; if the required exchange rate data still cannot be queried from the China database, the exchange rate data is queried from the distributed cache Singapore node; if the required exchange rate data still cannot be queried from the distributed cache Singapore node, the exchange rate data is queried from the Singapore database…
[0072] In some embodiments, the distributed storage system corresponds to multiple distributed query nodes, each query node has a corresponding local cache, cache node and database; wherein the data query priority is from high to low: local cache, cache node, database.
[0073] In summary, the technical solution provided in the embodiment of the present application improves the accuracy and reliability of the stored exchange rate data by comparing and verifying the exchange rate data provided by the backup provider with the exchange rate data provided by the main provider.
[0074] In addition, by using CRDT (Convergent Replicated Data Type) for multi-level distributed storage of exchange rate data, each database and distributed cache node keeps synchronization with the exchange rate data at the same point in time, thereby ensuring the uniformity and consistency of exchange rate data queried in different regions, thereby improving the stability of exchange rate data and reducing the impact of exchange rate instability on the business; in addition, multi-level distributed storage of exchange rate data also reduces the risk of exchange rate data loss.
[0075] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0076] Please refer to Figure 7 , which shows a block diagram of an exchange rate data collection device provided by an embodiment of the present application. The device has the function of implementing the above-mentioned exchange rate data collection method, and the function can be implemented by hardware, or by hardware executing corresponding software. The device can be a computer device, or it can be set in a computer device. The device 700 can include: a data acquisition module 710, a data determination module 720 and a data storage module 730.
[0077] The data acquisition module 710 is used to acquire real-time exchange rate data at at least one time point in a first period from a data provider.
[0078] The data determination module 720 is used to determine the historical exchange rate data for the first period according to the real-time exchange rate data at multiple different time points in the first period.
[0079] The data storage module 730 is used to store the historical exchange rate data of the first period in a distributed storage system, and the distributed system is used to provide exchange rate data to multiple different business users.
[0080] In an exemplary embodiment, the data provider includes a primary provider and a backup provider; the data acquisition module 710 is used to:
[0081] Sending a first acquisition request to the primary provider, wherein the first acquisition request is used to request the primary provider for real-time exchange rate data of at least one time point within the first time period;
[0082] receiving first feedback information from the main provider, wherein the first feedback information includes real-time exchange rate data of at least one time point within the first time period provided by the main provider;
[0083] Sending a second acquisition request to the backup provider, where the second acquisition request is used to request the backup provider for real-time exchange rate data of at least one time point within the first time period;
[0084] receiving second feedback information from the backup provider, wherein the second feedback information includes real-time exchange rate data of at least one time point within the first time period provided by the backup provider;
[0085] If it is determined based on the second feedback information that the first feedback information is valid, the first feedback information is stored and the second feedback information is discarded.
[0086] In an exemplary embodiment, if Figure 8 As shown, the device 700 also includes: an information generating module 740.
[0087] The information generating module 740 is configured to generate warning information when it is determined based on the second feedback information that the first feedback information is invalid, wherein the warning information is used to trigger manual intervention to calibrate the real-time exchange rate data at at least one time point within the first period.
[0088] In an exemplary embodiment, if Figure 8 As shown, the device 700 also includes: a request sending module 750, an information receiving module 760 and an information storage module 770.
[0089] The request sending module 750 is configured to send the second acquisition request to the backup provider when the first feedback information is not received from the primary provider.
[0090] The information receiving module 760 is configured to receive the second feedback information from the backup provider.
[0091] The information storage module 770 is used to store the second feedback information.
[0092] In an exemplary embodiment, the real-time exchange rate data of at least one target currency pair is obtained from the data provider; the data determination module 720 is also used to determine the real-time exchange rate data of at least one other currency pair at at least one time point within the first time period based on the real-time exchange rate data of the at least one target currency pair at at least one time point within the first time period.
[0093] In an exemplary embodiment, the data determination module 720 is used to determine the historical exchange rate data for the first period according to the average of the real-time exchange rate data at multiple different time points within the first period.
[0094] In an exemplary embodiment, the distributed storage system includes a distributed database and a distributed cache, wherein the multiple databases in the distributed database include a master database and at least one slave database, and the multiple cache nodes in the distributed cache include a master cache node and at least one slave cache node; the data storage module 730 is used to store the historical exchange rate data of the first time period in the master database and the master cache node respectively; wherein the master database is used to synchronize the historical exchange rate data of the first time period to the slave database for storage, and the master cache node is used to synchronize the historical exchange rate data of the first time period to the slave cache node for storage.
[0095] In an exemplary embodiment, the distributed storage system corresponds to multiple distributed query nodes, each query node has a corresponding local cache, cache node and database; wherein the data query priority is from high to low: the local cache, the cache node, the database.
[0096] In summary, the technical solution provided in the embodiment of the present application ensures that the exchange rate data obtained by each business user is the same by storing the obtained exchange rate data in a distributed storage system, thereby improving the stability of the obtained exchange rate data.
[0097] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the content structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0098] In an exemplary embodiment, a computer device is also provided, which includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the above-mentioned method for collecting exchange rate data.
[0099] In an exemplary embodiment, a computer-readable storage medium is also provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned method for collecting exchange rate data.
[0100] In an exemplary embodiment, a computer program product is also provided, the computer program product comprising computer instructions, the computer instructions being stored in a computer-readable storage medium, and the processor reading and executing the computer instructions from the computer-readable storage medium to implement the above-mentioned method for collecting exchange rate data.
[0101] The above description is only an exemplary 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.
[0102] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application are not limited to this.
[0103] The above are merely exemplary embodiments of the present application and are 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 collecting exchange rate data, It is characterized in that The method comprises: Sending a first acquisition request to a primary provider, wherein the first acquisition request is used to request the primary provider for real-time exchange rate data at at least one time point within a first period, wherein the data providers include the primary provider and a backup provider, and the primary provider is superior to the backup provider; receiving first feedback information from the main provider, wherein the first feedback information includes real-time exchange rate data of at least one time point within the first time period provided by the main provider; Sending a second acquisition request to the backup provider, where the second acquisition request is used to request the backup provider for real-time exchange rate data of at least one time point within the first time period; receiving second feedback information from the backup provider, wherein the second feedback information includes real-time exchange rate data of at least one time point within the first time period provided by the backup provider; If it is determined based on the second feedback information that the first feedback information is valid, storing the first feedback information and discarding the second feedback information; Determining historical exchange rate data for the first period according to the first feedback information; The historical exchange rate data of the first period is stored in a distributed storage system, and the distributed system is used to provide exchange rate data to multiple different business users.
2. The method according to claim 1, It is characterized in that The method further comprises: In the case where it is determined based on the second feedback information that the first feedback information is invalid, an alarm message is generated, where the alarm message is used to trigger manual intervention to calibrate the real-time exchange rate data at at least one time point within the first time period.
3. The method according to claim 1, It is characterized in that After sending the first acquisition request to the main provider, the method further includes: In case the first feedback information is not received from the primary provider, sending the second acquisition request to the backup provider; receiving the second feedback information from the backup provider; The second feedback information is stored.
4. The method according to claim 1, It is characterized in that Real-time exchange rate data of at least one target currency pair is obtained from the data provider; The method further comprises: Based on the real-time exchange rate data of the at least one target currency pair at at least one time point in the first time period, the real-time exchange rate data of at least one other currency pair at at least one time point in the first time period is determined.
5. The method according to claim 1, It is characterized in that The method further comprises: The historical exchange rate data for the first time period is determined according to an average of the real-time exchange rate data at multiple different time points within the first time period.
6. The method according to claim 1, It is characterized in that The distributed storage system includes a distributed database and a distributed cache, wherein the multiple databases in the distributed database include a master database and at least one slave database, and the multiple cache nodes in the distributed cache include a master cache node and at least one slave cache node; The storing of the historical exchange rate data of the first period into the distributed storage system includes: storing the historical exchange rate data of the first period in the main database and the main cache node respectively; The master database is used to synchronize the historical exchange rate data of the first period to the slave database for storage, and the master cache node is used to synchronize the historical exchange rate data of the first period to the slave cache node for storage.
7. The method according to claim 6, It is characterized in that The distributed storage system corresponds to a plurality of distributedly deployed query nodes, each query node having a corresponding local cache, a cache node and a database; wherein the data query priority is from high to low: the local cache, the cache node, the database.
8. A device for collecting exchange rate data, It is characterized in that The device comprises: A data acquisition module, configured to send a first acquisition request to a primary provider, wherein the first acquisition request is used to request the primary provider for real-time exchange rate data at at least one time point within a first time period, wherein the data providers include the primary provider and a backup provider, wherein the primary provider is superior to the backup provider; receive first feedback information from the primary provider, wherein the first feedback information includes real-time exchange rate data at at least one time point within the first time period provided by the primary provider; send a second acquisition request to the backup provider, wherein the second acquisition request is used to request the backup provider for real-time exchange rate data at at least one time point within the first time period; receive second feedback information from the backup provider, wherein the second feedback information includes real-time exchange rate data at at least one time point within the first time period provided by the backup provider; and if it is determined based on the second feedback information that the first feedback information is valid, store the first feedback information and discard the second feedback information; A data determination module, configured to determine the historical exchange rate data of the first period according to the first feedback information; The data storage module is used to store the historical exchange rate data of the first period in a distributed storage system, and the distributed system is used to provide exchange rate data to multiple different business users.
9. A computer device, It is characterized in that The computer device comprises a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that The storage medium stores a computer program, which is loaded and executed by a processor to implement the method according to any one of claims 1 to 7.
11. A computer program product, It is characterized in that The computer program product comprises computer instructions, which are stored in a computer-readable storage medium. A processor reads and executes the computer instructions from the computer-readable storage medium to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
System and method for conducting web-based financial transactions in capital markets
AU2005200921A1
Online transaction method and online transaction system for realizing off-shore transaction
CN101655947A
Method for acquiring and using exchange rate information
CN104503990A
Method, device and system for achieving high availability of database
CN106855869A
Exchange rate data display method and system
CN107103532A
