Multiplexing method and system for K line of financial transaction and storage medium

By evaluating the reusability of K-line data in blockchain transactions, the problems of inaccurate K-line data and resource waste caused by block revocation in blockchain transactions are solved, and efficient K-line under block revocation events are achieved. Data processing.

CN119273468AActive Publication Date: 2025-01-07WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411377064.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-01-07
Estimated Expiration
2044-09-30

AI Technical Summary

Technical Problem

Transaction revocation caused by uncertainty in block confirmation of blockchain exchanges leads to inaccurate K-line data, and the existing technology cannot effectively evaluate the K-line reuse situation, resulting in repeated calculation of K-lines and wasted computing resources.

Method used

By obtaining the cancelled blocks in the blockchain, extracting the original transaction data sequence and replacing the transaction data sequence, building a matrix to calculate the proportion of consecutive identical transaction subsequences, calculating the transaction integrity value, and if it is less than the threshold, it is determined that the K-line can be reconciled Use to avoid repeated calculations.

Benefits of technology

Effectively measure the reusability of the K-line data before revocation, avoid inaccurate K-line data and waste of resources, and improve system resource utilization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119273468A_ABST
    Figure CN119273468A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a multiplexing method and system for a K line of a financial transaction and a storage medium, and the method comprises the steps: obtaining a block which is invalid after block revocation in a block chain, and extracting an original transaction data sequence X and a replacement transaction data sequence Y contained in the invalid block; a matrix C is constructed, the size of the matrix C is (m + 1) * (n + 1), m is the number of transaction subsequences of the sequence X, n is the number of transaction subsequences of the sequence Y, values of elements in the matrix C are calculated one by one from C00 to Cmn according to the sequence of first row and second row, and continuous identical transaction subsequences in the sequence X and the sequence Y are backtracked from Cmn; and calculating a plurality of proportions of continuous same transaction subsequences in the sequence X, calculating a transaction integrity value H according to the plurality of proportions, and if H is smaller than a first threshold value, determining that the reuse degree of the sequence X is high, and determining that the K-line containing the sequence X is reused.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer software technology, and specifically relates to a method, system and storage medium for multiplexing K-lines of financial transactions. Background Art

[0002] K-line chart (also known as candle chart) is a commonly used technical analysis tool in the financial market, which uses a visual candle chart to show the price fluctuations of assets within a specific time period.

[0003] Existing financial transactions may lead to uncertainty. For example, due to the uncertainty of block confirmation in blockchain exchanges, transactions may be revoked. Therefore, there is uncertainty in the K-line transactions of the blockchain within the time slices that have passed. In this way, the revocation of transactions will cause inaccurate K-lines. Existing technologies will directly recalculate all K-lines after revocation without evaluating the reuse of K-lines. This will increase the number of repeated calculations of K-lines and waste computing resources. Summary of the invention

[0004] The present application provides a method, system and storage medium for reusing K-lines of financial transactions, which can calculate the K-lines of revoked transactions to determine whether the revoked transactions affect the accuracy of the K-lines, and then determine whether the K-lines of the revoked transactions can be reused. There is no need to recalculate the K-lines that can be reused, thereby reducing the waste of computing resources.

[0005] In a first aspect, the present application provides a method for multiplexing a K-line of a financial transaction, the method comprising the following steps:

[0006] Obtain the invalid block after the block revocation in the blockchain, and extract the original transaction data sequence X and the replacement transaction data sequence Y contained in the invalid block;

[0007] Construct a matrix C whose size is (m+1)*(n+1), where m is the number of blocks in sequence X and n is the number of blocks in sequence Y. 00 Start to C mn Calculate the values ​​of the elements in matrix C one by one in the order of rows first and columns, starting from C mn Start backtracking to obtain consecutive identical transaction subsequences in sequence X and sequence Y;

[0008] Calculate multiple proportions of consecutive identical transaction subsequences in sequence X, and calculate the transaction integrity value H according to the multiple proportions. If H is less than a first threshold, it is determined that the reuse degree of sequence X is high, and the K-line containing sequence X is determined to be reused.

[0009] In a second aspect, a K-line multiplexing system for financial transactions is provided, the system comprising:

[0010] An acquisition unit, used to acquire a block that has become invalid after a block revocation occurs in the blockchain, and extract an original transaction data sequence X and a replacement transaction data sequence Y contained in the invalid block;

[0011] A construction unit, used to construct a matrix C, wherein the size of the matrix C is (m+1)*(n+1), where m is the number of blocks of the sequence X, and n is the number of blocks of the sequence Y;

[0012] Assignment traceback unit for C 00 Start to C mn Calculate the values ​​of the elements in matrix C one by one in the order of rows first and columns, starting from C mn Start backtracking to obtain consecutive identical transaction subsequences in sequence X and sequence Y;

[0013] The calculation and judgment unit is used to calculate multiple proportions of consecutive identical transaction subsequences in sequence X, and calculate the transaction integrity value H according to the multiple proportions. If H is less than a first threshold, it is determined that the reuse degree of sequence X is high, and the K-line containing sequence X is determined to be reused.

[0014] In a third aspect, the present application provides a computer storage medium storing a computer program for electronic data exchange, wherein the computer program enables a computer to execute some or all of the steps described in the first aspect of the present application.

[0015] The embodiments of the present application have the following beneficial effects:

[0016] When a block is revoked in a financial transaction and the K-line data changes, this application measures the degree of reusability of the calculation results of the candle entity before the revocation by comparing the changes in the block data, and reuses the calculation conclusions of the candle entity differently. This avoids the inaccurate K-line data caused by the inability to cope with the block revocation event in the pre-calculation scheme, and avoids the problem of blindly recalculating the K-line data and causing waste of system resources caused by the real-time calculation scheme. It copes with the K-line data changes caused by the block revocation event with smaller computing resources to the greatest extent, and at the same time improves the efficiency of system resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art 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 paying creative work.

[0018] Figure 1 is a schematic diagram of the structure of a computer provided in an embodiment of the present application;

[0019] Figure 2 It is a flowchart of a method for multiplexing a K-line of a financial transaction provided by an embodiment of the present application;

[0020] Figure 3 This is a flow chart of a method for multiplexing a K-line of a financial transaction provided in the first embodiment of the present application;

[0021] Figure 4 It is a structural diagram of a K-line multiplexing system for financial transactions provided in an embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0023] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, systems, products or devices.

[0024] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0025] The following is an introduction to the relevant terms involved in this application.

[0026] Blockchain: A new distributed infrastructure and computing method that uses block chain data structures to verify and store data, distributed node consensus algorithms to generate and update data, cryptography to ensure the security of data transmission and access, and smart contracts composed of automated script codes to program and operate data.

[0027] K-line reuse means that the K-line data with canceled transactions will not be recalculated, and the original K-line will be used directly.

[0028] Open Price: The starting point of the candle body (i.e. K-line), that is, the first transaction price of a certain trading cycle.

[0029] Closing Price: The end point of the candle body (i.e. K-line), that is, the last trading price of a certain trading cycle.

[0030] High Price: The highest transaction price within a certain trading cycle (i.e. K-line), usually indicated by the top of the upper shadow line.

[0031] Low Price: The lowest transaction price within a certain trading cycle (i.e. K-line), usually indicated by the bottom of the lower shadow.

[0032] Real-time calculation of candle entities: Select the stocks that need to calculate K-lines from the transaction data according to the stock code, and divide the transaction data selected in the first step into small shards of corresponding time granularity according to the type of K-line to be calculated. For example, the calculation of minute K-lines requires the transaction data to be divided into small shards per minute; the calculation of hourly K-lines requires the transaction data to be divided into small shards per hour to find the shard set within the K-line query time range, and find the following data in each small shard: the price corresponding to the earliest transaction record in the shard is used as the opening price of the candle entity, the price corresponding to the latest transaction record in the shard is used as the closing price of the candle entity, the price corresponding to the transaction record with the highest price in the shard is used as the highest price of the candle entity, and the price corresponding to the transaction record with the lowest price in the shard is used as the lowest price of the candle entity. If the closing price is higher than the opening price, the candle entity is positive, otherwise it is negative, so as to calculate the corresponding candle entity details of the shard, and arrange all candle entities in chronological order from small to large to obtain the required K-line chart.

[0033] Pre-calculated candle entities: The calculation method of candle entities is the same as the real-time calculation scheme. The difference is that the pre-calculated scheme will store the calculated candle entity data. When querying, you do not need to calculate the candle entity data in real time, but directly retrieve the candle entity data of the corresponding time range.

[0034] Hybrid calculation candle entity: It combines the above pre-calculation and hybrid calculation strategies.

[0035] The following describes the system architecture of a computer related to an embodiment of the present application.

[0036] The present application also provides a computer 10, such as Figure 1As shown, it includes at least one processor 11 and a memory 12, and may also include a communications interface 14 and a bus 13. The processor 11, the memory 12 and the communications interface 14 may communicate with each other through the bus 13. The communications interface 14 may transmit information. The processor 11 may call the logic instructions in the memory 12 to execute the method in the above embodiment.

[0037] In addition, the logic instructions in the above-mentioned memory 12 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. The above-mentioned logic instructions can also become an operating system, application program or computer program, etc.

[0038] The memory 12 is a computer-readable storage medium that can be configured to store software programs, computer executable programs, such as program instructions or modules corresponding to the methods in the embodiments of the present disclosure. The processor 11 executes functional applications and data processing by running the software programs, instructions or modules stored in the memory 12, that is, implementing the methods in the above embodiments.

[0039] The memory 12 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the computer 10, etc. In addition, the memory 12 may include a high-speed random access memory and may also include a non-volatile memory. For example, a variety of media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, may also be a transient storage medium.

[0040] It is understandable that the computer in this embodiment can be understood as a server, for example, the server includes a cloud server or an edge server, and no unique limitation is made here. Of course, in an optional technical scenario, the above-mentioned computer can also be a personal computer (PC), a tablet computer, a laptop computer, and other smart devices. This application does not limit the specific form of the above-mentioned computer, as long as the above-mentioned computer has an operating system and shortcuts.

[0041] The specific methods are introduced in detail below.

[0042] See also Figure 2 The present application also provides a method for reusing K-line in financial transactions. Figure 2A schematic diagram of a method for reusing a K-line of a financial transaction provided by the present application. The method can be used in Figure 1 The computer shown in the figure can be a personal computer, a server, a tablet computer, a laptop computer or other smart devices. The computer can form a blockchain network. The method is as follows: Figure 2 As shown, the following steps are included:

[0043] Step S201, obtaining a block in the blockchain that is invalid after block revocation occurs, and extracting the original transaction data sequence X and the replacement transaction data sequence Y contained in the invalid block;

[0044] For example, it is assumed here that the sequence X can be specifically: X = [x1, x2,,,,x m 】, the sequence Y can be specifically: Y=

y1,y2,,,,yn

[0045] Step S202: construct a matrix C, the size of which is (m+1)*(n+1), where m is the number of blocks in sequence X, and n is the number of blocks in sequence Y. 00 Start to C mn Calculate the values ​​of the elements in matrix C one by one in the order of rows first and columns, starting from C mn Start backtracking to obtain consecutive identical transaction subsequences in sequence X and sequence Y;

[0046] For example, the above from C 00 Start to C mn Calculating the values ​​of the elements in the matrix C one by one in the order of rows first and columns may specifically include:

[0047] For the element C in the matrix C ij Assign values ​​according to the following rules;

[0048] If C ij Where i = 0 or j = 0, determine C ij =0;

[0049] If x i =y j , then C ij The value of C (i-1)(j-1) Add 1;

[0050] If x i ≠y j , then C ij The value of C (i-1)j With C i(j-1) The maximum value among: where 0≤i≤m, 0≤j≤n;

[0051] The following example illustrates how to calculate the values ​​in the matrix C. Assume that m=3, n=3, and construct a 4*4 matrix. The first column and the first row of the 4*4 matrix are both 0. 11 For example, if block x1 in sequence X is equal to block y1 in sequence Y, then C 11 =C 00 +1, then for C 12 , assuming that block x1 in sequence X is not equal to block y2 in sequence Y, then C 12 I would choose C 02 With C 11 The maximum value in the 02 =0, C 11 =1, so C 12 =1, and similarly, all element values ​​in the matrix C can be calculated.

[0052] For example, the above from C mn The process of starting to backtrack and obtain consecutive identical transaction subsequences in sequence X and sequence Y may specifically include:

[0053] From C mn Start backtracking, if x m =y n , determine x m ,y n It is an element in a continuous identical transaction subsequence, and continues to trace back to C (m-1) ( n-1) , if x m-1 =y n-1 , determine x m-1 ,y n-1 is an element in a consecutive identical transaction subsequence. If x m-1 ≠y n-1 , determine x m-1 ,y n-1 It is not an element in a consecutive identical transaction subsequence. (m-1)n , C m(n-1) The maximum value in is traced back until it reaches C 11 Get all consecutive identical transaction subsequences.

[0054] Step S203, calculate multiple proportions of consecutive identical transaction subsequences in sequence X, and calculate the transaction integrity value H according to the multiple proportions. If H is less than a first threshold, it is determined that the reuse degree of sequence X is high, and the K-line containing sequence X is determined to be reused.

[0055] For example, the above calculation of multiple proportions of consecutive identical transaction subsequences in sequence X may specifically include:

[0056] Sequence X is divided into multiple subsequences according to the continuous transaction subsequences, the number of blocks in each of the multiple subsequences is obtained, and the ratio of the number of blocks in each subsequence to the total number of blocks in sequence X is calculated to obtain multiple proportions.

[0057] For example, there are 3 subsequences, the number of blocks in the 3 subsequences are 2, 1, and 3 respectively, and the total number of blocks is 6. Then the proportions are 1 / 3, 1 / 6, and 1 / 2 respectively.

[0058] For example, the calculation of the transaction integrity value H based on multiple proportions may specifically include:

[0059] The information entropy values ​​of the multiple proportions are calculated, and the information entropy values ​​are the transaction integrity H.

[0060] In an optional technical scenario, the values ​​of the information entropy for calculating the multiple proportions may specifically include:

[0061]

[0062] Among them, H is the value of information entropy, p i is the proportion of the i-th consecutive identical subsequence.

[0063] For example, the first threshold is dynamically adjusted according to the number of blocks in sequence X. The specific method for determining the first threshold may include:

[0064] The difference between the constant and the information entropy of the number of blocks. The above constant can be set by the user, such as 0.5, 0.6, etc. This application does not limit the specific display method of the above constant.

[0065] The specific calculation formula is as follows:

[0066]

[0067] Wherein, H0 is the first threshold, and m is the maximum block number of sequence X.

[0068] In another optional technical scenario, the values ​​of the information entropy for calculating the multiple proportions may specifically include:

[0069]

[0070] Among them, H is the value of information entropy, p i is the proportion of the ith consecutive identical subsequences, and e is a natural constant.

[0071] For example, the first threshold is dynamically adjusted according to the number of blocks in sequence X. The specific method for determining the first threshold may include:

[0072] The difference between the constant and the information entropy of the number of blocks. The above constant can be set by the user, such as 0.5, 0.6, etc. This application does not limit the specific display method of the above constant.

[0073] The specific calculation formula is as follows:

[0074]

[0075] Wherein, H0 is the first threshold, and m is the maximum block number of sequence X.

[0076] When a block is revoked in a financial transaction and the K-line data changes, this application measures the degree of reusability of the calculation results of the candle entity before the revocation by comparing the changes in the block data, and reuses the calculation conclusions of the candle entity differently. This avoids the inaccurate K-line data caused by the inability to cope with the block revocation event in the pre-calculation scheme, and avoids the problem of blindly recalculating the K-line data and causing waste of system resources caused by the real-time calculation scheme. It copes with the K-line data changes caused by the block revocation event with smaller computing resources to the greatest extent, and at the same time improves the efficiency of system resource utilization.

[0077] For example, the above method may further include:

[0078] If H is greater than the first threshold, it is determined that the reuse degree of sequence x is low, and sequence X in the K-line containing sequence X is replaced with sequence Y, and then the K-line calculation is re-executed to obtain a new K-line.

[0079] For example, replacing sequence X in the K-line containing sequence X with sequence Y and then re-executing the K-line calculation to obtain a new K-line may specifically include:

[0080] Replace the sequence X in the K-line with the sequence Y and use real-time calculation of the candle entity to get the new K-line;

[0081] Or replace the sequence X in the candlestick with the sequence Y and use the pre-calculated candle entities to get the new candlestick;

[0082] Or replace the sequence X in the K-line with the sequence Y and then use mixed calculation of the candle entity to get a new K-line.

[0083] Embodiment 1

[0084] The first embodiment of the present application also provides a method for multiplexing a K-line of a financial transaction. Figure 3 A flowchart of a method for multiplexing a K-line of a financial transaction provided in Example 1 of the present application, the method can be used in Figure 1The computer shown in the figure can be a personal computer, a server, a tablet computer, a laptop or other smart device. The computer can form a blockchain network. In this application, X = [t1, t2, t3, t4, t5, t6], Y = [t1, t2, t7, t4, t5, t6], m = n = 6. For the original sequence X, the third block, t3, is revoked and then replaced by t7. The above method is as follows Figure 3 As shown, the following steps are included:

[0085] Step S301, obtaining a block t3 that is invalid after the block is revoked in the blockchain, and extracting the original transaction data sequence X and the replacement transaction data sequence Y contained in the invalid block;

[0086] Step S302: construct a matrix C, the size of which is 7*7. 00 Start to C 66 Calculate the values ​​of the elements in matrix C one by one in the order of rows first and columns later.

[0087] The values ​​of each element of the constructed matrix C are as follows: 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 1 2 2 2 2 2 0 1 2 2 2 2 2 0 1 2 2 3 3 3 0 1 2 2 3 4 4 0 1 2 2 3 4 5

[0095] Step S303: From C 66 Start backtracking to obtain consecutive identical transaction subsequences [t1, t2], [t4, t5, t6] in sequence X and sequence Y;

[0096] For example, the specific implementation of the above method is:

[0097] From C 66 Start backtracking.

[0098] Since x6=y6=t6

[0099] So t6 is an element in a subsequence of consecutive identical transactions;

[0100] Continue backtracking C 55

[0101] Since x5=y5=t5

[0102] So t5 is an element in a subsequence of consecutive identical transactions;

[0103] Continue backtracking C 44

[0104] Since x4=y4=t4

[0105] So t4 is an element in a subsequence of consecutive identical transactions;

[0106] Continue backtracking C 33

[0107] Since x3≠y3

[0108] So t3 is not an element in a consecutive identical transaction subsequence;

[0109] Due to C 23 =C 32

[0110] So any backtracking C 23 or C 32 In this example, select C 23 ;

[0111] Continue backtracking C 23

[0112] Since x2≠y3

[0113] Also because C 12 <C 22

[0114] So backtracking C 22

[0115] Since x2=y2=t2

[0116] So t2 is an element in a subsequence of consecutive identical transactions;

[0117] Continue backtracking C 11

[0118] Since x1=y1=t1

[0119] Therefore, t1 is an element in the continuous identical transaction subsequence; further, the continuous identical subsequences are determined to be: [t1, t2], [t4, t5, t6].

[0120] Step S304: Determine that the consecutive identical transaction subsequences of sequence X are [t1, t2], [t3], [t4, t5, t6]; the corresponding proportions of the three subsequences are 1 / 3, 1 / 6, 1 / 2, respectively, and the calculated integrity value H=1.459147; calculate the first threshold H0=2.554135; determine that H is less than H0, determine that the reuse degree of sequence X is high, and determine that the K-line containing sequence X is reused.

[0121] For example, the above calculation method may specifically include:

[0122]

[0123] The calculation method of the first threshold may include:

[0124]

[0125] The constant in the above H0 is taken as 0.5.

[0126] When a block is revoked in a financial transaction and the K-line data changes, this application measures the degree of reusability of the calculation results of the candle entity before the revocation by comparing the changes in the block data, and reuses the calculation conclusions of the candle entity differently. This avoids the inaccurate K-line data caused by the inability to cope with the block revocation event in the pre-calculation scheme, and avoids the problem of blindly recalculating the K-line data and causing waste of system resources caused by the real-time calculation scheme. It copes with the K-line data changes caused by the block revocation event with smaller computing resources to the greatest extent, and at the same time improves the efficiency of system resource utilization.

[0127] See also Figure 4 , Figure 4 A schematic diagram of a multiplexing system for K-line of financial transactions is provided, the system comprising:

[0128] The acquisition unit 401 is used to acquire a block that is invalid after the block is revoked in the blockchain, and extract the original transaction data sequence X and the replacement transaction data sequence Y contained in the invalid block;

[0129] A construction unit 402 is used to construct a matrix C, wherein the size of the matrix C is (m+1)*(n+1), where m is the number of blocks in the sequence X, and n is the number of blocks in the sequence Y;

[0130] Assignment backtracking unit 403, used to 00 Start to C mn Calculate the values ​​of the elements in matrix C one by one in the order of rows first and columns, starting from C mn Start backtracking to obtain consecutive identical transaction subsequences in sequence X and sequence Y;

[0131] The calculation and judgment unit 404 is used to calculate multiple proportions of consecutive identical transaction subsequences in sequence X, and calculate the transaction integrity value H according to the multiple proportions. If H is less than a first threshold, it is determined that the reuse degree of sequence X is high, and the K-line containing sequence X is determined to be reused.

[0132] For example, the assignment backtracking unit 403 is specifically used for the element C in the matrix C ij Assign values ​​according to the following rules;

[0133] If C ijWhere i = 0 or j = 0, determine C ij =0;

[0134] If x i =y j , then C ij The value of C (i-1)(j-1) Add 1;

[0135] If x i ≠y j , then C ij The value of C (i-1)j With C i(j-1) The maximum value in: where 0≤i≤m, 0≤j≤n; m is the maximum block number in sequence X, and n is the maximum block number in sequence Y.

[0136] For example, the assignment backtracking unit 403 is specifically used to mn Start backtracking, if x m =y n , determine x m ,y n It is an element in a continuous identical transaction subsequence, and continues to trace back to C (m-1) ( n-1) , if x m-1 =y n-1 , determine x m-1 ,y n-1 is an element in a consecutive identical transaction subsequence. If x m-1 ≠y n-1 , determine x m-1 ,y n-1 It is not an element in a consecutive identical transaction subsequence. (m-1)n , C m(n-1) The maximum value in is traced back until it reaches C 11 Get all consecutive identical transaction subsequences.

[0137] For example, the calculation and judgment unit 404 is specifically used to divide the sequence X into multiple subsequences according to the continuous transaction subsequences, obtain the number of blocks in each of the multiple subsequences, and calculate the ratio of the number of blocks in each subsequence to the total number of blocks in the sequence X to obtain multiple proportions.

[0138] For example, the calculation and judgment unit 404 is specifically used to calculate the value of information entropy of multiple proportions, and the value of the information entropy is the transaction integrity H.

[0139] For example, the first threshold is a difference between a constant and information entropy of the number of blocks.

[0140] For example, the calculation and judgment unit 404 is further configured to, if H is greater than a first threshold, determine that the reuse degree of sequence x is low, replace sequence X in the K-line containing sequence X with sequence Y, and then re-execute the K-line calculation to obtain a new K-line.

[0141] For example, the calculation and judgment unit 404 is specifically used to replace the sequence X in the K-line with the sequence Y and then obtain a new K-line by calculating the candle entity in real time;

[0142] Or replace the sequence X in the candlestick with the sequence Y and use the pre-calculated candle entities to get the new candlestick;

[0143] Or replace the sequence X in the K-line with the sequence Y and then use mixed calculation of the candle entity to get a new K-line.

[0144] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps of any method described in the above method embodiments, and the above computer includes an electronic device.

[0145] The embodiment of the present application also provides a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, the computer program is operable to cause a computer to execute some or all of the steps of any method described in the method embodiment. The computer program product may be a software installation package, and the computer includes an electronic device.

[0146] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0147] In the several embodiments provided in the present application, it should be understood that the disclosed methods, systems and systems can be implemented in other ways. For example, the system embodiments described above are only schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.

[0148] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0149] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0150] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a volatile memory or a non-volatile memory. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM) and direct RAM bus RAM (DR RAM). Various media that can store program code are available.

[0151] Although the present invention is disclosed as above, the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions without departing from the spirit and scope of the present invention, and can make various changes and modifications, including the combination of the above-mentioned different functions and implementation steps, including software and hardware implementation methods, all of which are within the scope of protection of the present invention.

Claims

1. A K-line multiplexing method for financial transactions, characterized in that: The method comprises the following steps: Obtain the invalid block after the block revocation in the blockchain, and extract the original transaction data sequence X and the replacement transaction data sequence Y contained in the invalid block; Construct a matrix C whose size is (m+1)*(n+1), where m is the number of blocks in sequence X and n is the number of blocks in sequence Y. 00 Start to C mn Calculate the values ​​of the elements in matrix C one by one in the order of rows first and columns, starting from C mn Start backtracking to obtain consecutive identical transaction subsequences in sequence X and sequence Y; Calculate multiple proportions of consecutive identical transaction subsequences in sequence X, and calculate the transaction integrity value H according to the multiple proportions. If H is less than a first threshold, it is determined that the reuse degree of sequence X is high, and the K-line containing sequence X is determined to be reused.

2. The method for multiplexing K-line of financial transactions according to claim 1, characterized in that: The 00 Start to C mn Calculating the values ​​of the elements in the matrix C one by one in the order of rows first and columns specifically includes: For the element C in the matrix C ij Assign values ​​according to the following rules; If C ij Where i = 0 or j = 0, determine C ij =0; If x i =y j , then C ij The value of C (i-1)(j-1) Add 1; If x i ≠y j , then C ij The value of C (i-1)j With C i(j-1) The maximum value among: where 0≤i≤m, 0≤j≤n.

3. The method for multiplexing K-line of financial transactions according to claim 2, characterized in that: The mn Start backtracking to obtain consecutive identical transaction subsequences in sequence X and sequence Y, including: From C mn Start backtracking, if x m =y n , determine x m ,y n It is an element in a continuous identical transaction subsequence, and continues to trace back to C (m-1)(n-1) , if x m-1 =y n-1 , determine x m-1 ,y n-1 is an element in a consecutive identical transaction subsequence. If x m-1 ≠y n-1 , determine x m-1 ,y n-1 It is not an element in a consecutive identical transaction subsequence. (m-1)n , C m(n-1) The maximum value in is traced back until it reaches C 11 Get all consecutive identical transaction subsequences.

4. The method for multiplexing K-line of financial transactions according to claim 3, characterized in that: The calculation of the proportions of consecutive identical transaction subsequences in sequence X specifically includes: Sequence X is divided into multiple subsequences according to the continuous transaction subsequences, the number of blocks in each of the multiple subsequences is obtained, and the ratio of the number of blocks in each subsequence to the total number of blocks in sequence X is calculated to obtain multiple proportions.

5. The method for multiplexing K-line of financial transactions according to claim 4, characterized in that: The calculation of the transaction integrity value H according to the multiple proportions specifically includes: The information entropy values ​​of the multiple proportions are calculated, and the information entropy values ​​are the transaction integrity H.

6. The method for multiplexing K-line of financial transactions according to claim 5, characterized in that: The first threshold is a difference between a constant and information entropy of the number of blocks.

7. The method for multiplexing K-line of financial transactions according to any one of claims 1 to 6, characterized in that: The method further comprises: If H is greater than the first threshold, it is determined that the reuse degree of sequence x is low, and sequence X in the K-line containing sequence X is replaced with sequence Y, and then the K-line calculation is re-executed to obtain a new K-line.

8. The method for multiplexing K-line of financial transactions according to claim 7, characterized in that: The step of replacing the sequence X in the K-line containing the sequence X with the sequence Y and then re-executing the K-line calculation to obtain a new K-line specifically includes: Replace the sequence X in the K-line with the sequence Y and use real-time calculation of the candle entity to get the new K-line; Or replace the sequence X in the candlestick with the sequence Y and use the pre-calculated candle entities to get the new candlestick; Or replace the sequence X in the K-line with the sequence Y and then use mixed calculation of the candle entity to get a new K-line.

9. A K-line multiplexing system for financial transactions, characterized in that: The system comprises: An acquisition unit, used to acquire a block that has become invalid after a block revocation occurs in the blockchain, and extract an original transaction data sequence X and a replacement transaction data sequence Y contained in the invalid block; A construction unit, used to construct a matrix C, wherein the size of the matrix C is (m+1)*(n+1), where m is the number of blocks of the sequence X, and n is the number of blocks of the sequence Y; Assignment traceback unit for C 00 Start to C mn Calculate the values ​​of the elements in matrix C one by one in the order of rows first and columns, starting from C mn Start backtracking to obtain consecutive identical transaction subsequences in sequence X and sequence Y; The calculation and judgment unit is used to calculate multiple proportions of consecutive identical transaction subsequences in sequence X, and calculate the transaction integrity value H according to the multiple proportions. If H is less than a first threshold, it is determined that the reuse degree of sequence X is high, and the K-line containing sequence X is determined to be reused.

10. A computer storage medium storing a computer program for electronic data exchange, characterized in that: The computer program enables a computer to execute the steps of the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method and device for extracting time series data composition mode and terminal equipment

    CN110928918A

  • K-line candle graph drawing method and system and storage medium

    CN112541824A