K-line reuse method, system and storage medium for financial transactions

By constructing the matrix C to calculate the proportion of consecutive identical transaction subsequences in blockchain transaction data, the K-line is determined to be reusable, which solves the problem of inaccurate K-line caused by blockchain transaction revocation, reduces the waste of computing resources, and improves the efficiency of system resource utilization.

CN119273468BActive Publication Date: 2025-10-14WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The cancellation of blockchain transactions in existing financial transactions leads to inaccurate K-lines. Existing technology requires recalculating all K-lines, wasting computing resources.

Method used

By constructing the matrix C, the proportion of consecutive identical transaction subsequences in the transaction data sequences X and Y before and after the revoked transaction in the blockchain is calculated to determine the transaction integrity value H. If H is less than the threshold, it is determined that the K-line can be reused to avoid repeated calculations.

Benefits of technology

It reduces the waste of computing resources, improves the efficiency of system resource utilization, and ensures the accuracy of K-line data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119273468B_ABST
    Figure CN119273468B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a kind of financial transaction K line multiplexing method, system and storage medium, the method comprises: obtaining the block in block chain that occurs block revocation after invalid block, extract the original transaction data sequence X and replacement transaction data sequence Y contained in invalid block;Matrix C is constructed, the size of the matrix C is (m+1)*(n+1), wherein m is the transaction subsequence quantity of sequence X, n is the transaction subsequence quantity of sequence Y, from C 00 Start to C mn According to the order of first row and then column, the value of each element in matrix C is calculated one by one, from C mn Start backtracking to obtain continuous same transaction subsequence in sequence X and sequence Y;Calculate the multiple proportions of continuous same transaction subsequence in sequence X in sequence X, calculate transaction integrity value H according to multiple proportions, if H is less than first threshold value, determine that the reuse degree of sequence X is high, determine that K line multiplexing contains sequence X.
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 K-line multiplexing method, system, and storage medium for financial transactions. Background Art

[0002] K-line charts (also known as candlestick charts) are commonly used technical analysis tools in financial markets. They use visual candlestick charts to display the price fluctuations of assets within a specific time period.

[0003] Existing financial transactions are subject to uncertainty. For example, due to the uncertainty of block confirmation in blockchain exchanges, transactions may be revoked. Therefore, the blockchain's K-line transactions within the past time shards are subject to uncertainty. Such revoked transactions will lead to 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 K-lines calculations 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 canceled transactions to determine whether the canceled transactions affect the accuracy of the K-lines, and then determine whether the K-lines of the canceled 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 K-line in financial transactions, 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 of size (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 the 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 a transaction integrity value H based on 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 reused.

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

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

[0011] A construction unit, configured 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;

[0012] Assignment backtrace unit, used to 00 Start to C mn Calculate the values ​​of the elements in the 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 configured to calculate multiple proportions of consecutive identical transaction subsequences in sequence X, calculate a transaction integrity value H based on the multiple proportions, and if H is less than a first threshold, determine that the reuse degree of sequence X is high, and determine that the K-line containing sequence X is 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, causing changes in K-line data, this application compares the changes in block data to measure the degree of reusability of the candle entity calculation results before the revocation, and differentially reuses the calculation conclusions of the candle entity. This avoids both the inaccurate K-line data caused by the inability of pre-calculation schemes to cope with block revocation events, and the waste of system resources caused by blindly recalculating K-line data bands in real-time calculation schemes. This approach maximizes the use of minimal computing resources to cope with K-line data changes caused by block revocation events, while also improving system resource utilization efficiency. 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 following briefly introduces the drawings required for use in the embodiments or the description of the prior art. 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 any creative work.

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

[0019] Figure 2 This is a flow chart of a method for multiplexing K-lines in financial transactions provided by an embodiment of the present application;

[0020] Figure 3 This is a flow chart of a method for multiplexing K-lines in financial transactions provided in Example 1 of the present application;

[0021] Figure 4 This 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 present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, 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," and the like in the specification and claims of this application and the accompanying drawings are used to distinguish between different objects, not to describe a particular order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, system, product, or apparatus.

[0024] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, 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 a block chain data structure to verify and store data, a distributed node consensus algorithm to generate and update data, cryptography to ensure the security of data transmission and access, and smart contracts composed of automated script code to program and operate data.

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

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

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

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

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

[0032] Calculate candlestick entities in real time: Select the stocks for which K-line calculations are required from the trading data based on their stock symbols. Based on the type of K-line to be calculated, divide the trading data selected in the first step into smaller shards of corresponding time granularity. For example, to calculate minute K-lines, the trading data needs to be divided into minute-by-minute shards; to calculate hourly K-lines, the trading data needs to be divided into hourly shards. Find the set of shards within the K-line query time range, and find the following data in each shard: the price corresponding to the earliest transaction record in the shard is used as the candlestick entity's opening price; the price corresponding to the latest transaction record in the shard is used as the candlestick entity's closing price; the price corresponding to the highest transaction record in the shard is used as the candlestick entity's high price; and the price corresponding to the lowest transaction record in the shard is used as the candlestick entity's low price. If the closing price is higher than the opening price, the candlestick entity is positive; otherwise, it is negative. Calculate the candlestick entity details for each shard, and arrange all candlestick entities in chronological order from smallest to largest to obtain the desired K-line chart.

[0033] Pre-calculated candle entities: The calculation method for candle entities is the same as the real-time calculation method. The difference is that the pre-calculated candle entity data is stored. When querying, you do not need to calculate the candle entity data in real time, but can directly retrieve the candle entity data for 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 involved in the embodiments 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 memory 12, and may also include a communications interface 14 and a bus 13. The processor 11, memory 12, and communications interface 14 can communicate with each other via the bus 13. The communications interface 14 can transmit information. The processor 11 can call 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 or computer program, etc.

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

[0039] The memory 12 may include a program storage area and a data storage area. 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 generated based on the use of the computer 10. Furthermore, the memory 12 may include high-speed random access memory and non-volatile memory. For example, various media that can store program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, may also be transient storage media.

[0040] It is understood that the computer in this embodiment can be understood as a server. For example, the server includes a cloud server or an edge server. This is not limited to a unique server. Of course, in an optional technical scenario, the above-mentioned computer can also be a personal computer (PC), tablet computer, 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 This application also provides a K-line multiplexing method for financial transactions. Figure 2This is a flowchart of a K-line reuse method for financial transactions provided by this application. The above method can be used in Figure 1 The computer shown in FIG. 1 is executed on the computer shown in FIG. 1 , which may be a personal computer, a server, a tablet computer, a laptop computer or other smart device. The computer may form a blockchain network. The method is as follows: Figure 2 As shown, the following steps are included:

[0043] Step S201: Obtain a block in the blockchain that has become invalid after block revocation, and extract the original transaction data sequence X and the replacement transaction data sequence Y contained in the invalid block;

[0044] For example, it is assumed that the sequence X can be specifically: X = [x1, x2,,,,x m ], sequence Y can specifically be: Y = [y1, y2,,,,yn]; where x1 in transaction data sequence X represents the first block in X, x represents a block within sequence X, subscript 1 represents the sequence number of the block in sequence X, and m represents the maximum sequence number of blocks in sequence X. For sequence Y, y1 represents the first block in Y, y represents a block within sequence Y, subscript 1 represents the sequence number of the block in sequence Y, and n represents the maximum sequence number of blocks in sequence Y. In some technical scenarios, some blocks in the above sequences X and Y can be the same, or they can be different, and this is not a limitation here.

[0045] Step S202: Construct a matrix C. The size of the matrix C 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 the 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. For C 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 the block x1 in sequence X is not equal to the 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 include:

[0053] From C mn Start backtracking, if x m =y n , determine x m 、y n It is an element in the consecutive identical transaction subsequence, continuing 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 a transaction integrity value H based on 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 calculation of multiple proportions of consecutive identical transaction subsequences in sequence X may specifically include:

[0056] Sequence X is divided into multiple subsequences based on 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, 3, 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 information entropy values ​​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 information entropy values ​​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 i-th consecutive identical subsequence, 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, causing changes in K-line data, this application compares the changes in block data to measure the degree of reusability of the candle entity calculation results before the revocation, and differentially reuses the calculation conclusions of the candle entity. This avoids both the inaccurate K-line data caused by the inability of pre-calculation schemes to cope with block revocation events, and the waste of system resources caused by blindly recalculating K-line data bands in real-time calculation schemes. This approach maximizes the use of minimal computing resources to cope with K-line data changes caused by block revocation events, while also improving system resource utilization efficiency.

[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-performing 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 then use real-time calculation of the candle entities to get the new K-line;

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

[0082] Alternatively, replace the sequence X in the K-line with the sequence Y and then use mixed calculation to calculate the candle body to get a new K-line.

[0083] Example 1

[0084] The first embodiment of the present application also provides a method for reusing K-line in financial transactions. Figure 3 This is a flow chart of a method for reusing K-line in financial transactions provided in Example 1 of the present application. The method can be used in Figure 1The above computer can be a personal computer, server, tablet computer, laptop computer or other smart device, and the above 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. Figure 3 As shown, the following steps are included:

[0085] Step S301: Obtain block t3 in the blockchain that has become invalid after block revocation, and extract the original transaction data sequence X and replacement transaction data sequence Y contained in the invalid block;

[0086] Step S302: Construct a matrix C with a size of 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] Therefore, t3 is not an element in a consecutive identical transaction subsequence;

[0109] Because 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] And 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; furthermore, the continuous identical subsequences are determined to be: [t1, t2], [t4, t5, t6].

[0120] Step S304: Determine the consecutive identical transaction subsequences of sequence X as [t1, t2], [t3], and [t4, t5, t6]. The corresponding proportions of the three subsequences are 1 / 3, 1 / 6, and 1 / 2, respectively. 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, causing changes in K-line data, this application compares the changes in block data to measure the degree of reusability of the candle entity calculation results before the revocation, and differentially reuses the calculation conclusions of the candle entity. This avoids both the inaccurate K-line data caused by the inability of pre-calculation schemes to cope with block revocation events, and the waste of system resources caused by blindly recalculating K-line data bands in real-time calculation schemes. This approach maximizes the use of minimal computing resources to cope with K-line data changes caused by block revocation events, while also improving system resource utilization efficiency.

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

[0128] An acquisition unit 401 is configured to acquire a block in the blockchain that has become invalid after a block revocation occurs, 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 sequence X and n is the number of blocks in sequence Y;

[0130] Assignment backtracking unit 403, used to 00 Start to C mn Calculate the values ​​of the elements in the 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 configured to calculate multiple proportions of consecutive identical transaction subsequences in sequence X, and calculate a transaction integrity value H based on 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 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 the consecutive identical transaction subsequence, continuing 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 configured to divide the sequence X into multiple subsequences based on 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 configured to calculate the information entropy values ​​of a plurality of proportions, where the information entropy values ​​are 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 configured to replace the sequence X in the K-line with the sequence Y and then calculate the candle entities in real time to obtain a new K-line;

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

[0143] Alternatively, replace the sequence X in the K-line with the sequence Y and then use mixed calculation to calculate the candle body 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, and 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 present application also provides a computer program product comprising a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to perform some or all of the steps of any of the methods described in the above method embodiments. The computer program product may be a software installation package, and the computer may comprise 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 this 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 merely illustrative; for example, the division of the units is merely a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection of the system or unit, which may be electrical, mechanical or other forms.

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

[0149] In addition, the functional units in various embodiments of the present invention may be integrated into a single processing unit, each unit may be physically included separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or 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 and includes a number of instructions for enabling 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 and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM (DR RAM), among other media that can store program code.

[0151] Although the present invention is disclosed above, it is not limited thereto. Any person skilled in the art may readily conceive of variations or substitutions, and may make various modifications and alterations without departing from the spirit and scope of the present invention. Combinations of the above-described functions and implementation steps, including software and hardware implementations, are all 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 of size (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 the 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 the proportions of consecutive identical transaction subsequences in sequence X, and calculate the transaction integrity value H based on the 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 reused. 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 in: where 0≤i≤m, 0≤j≤n; mn Start backtracking to obtain consecutive identical transaction subsequences in sequence X and sequence Y, specifically including: From C mn Start backtracking, if x m =y n , determine x m 、y n It is an element in the same consecutive 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; The step of replacing sequence X in a K-line containing sequence X with sequence Y and then re-performing K-line calculation to obtain a new K-line specifically includes: Replace the sequence X in the K-line with the sequence Y and then use real-time calculation of the candle entities to get the new K-line; Or replace the sequence X in the candlestick with sequence Y and use the pre-calculated candle bodies to get the new candlestick; Alternatively, replace the sequence X in the K-line with the sequence Y and then use mixed calculation to calculate the candle body to get a new K-line.

2. The K-line multiplexing method for financial transactions according to claim 1, characterized in that: The calculation of multiple proportions of consecutive identical transaction subsequences in sequence X specifically includes: Sequence X is divided into multiple subsequences based on 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.

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

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

5. The K-line multiplexing method for financial transactions according to any one of claims 1 to 4, 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.

6. A K-line multiplexing system for financial transactions, characterized in that: The system comprises: An acquisition unit, configured to acquire a block in the blockchain that has become invalid after a block revocation occurs, and extract the original transaction data sequence X and the replacement transaction data sequence Y contained in the invalid block; A construction unit, configured 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; Assignment backtrace unit, used to 00 Start to C mn Calculate the values ​​of the elements in the 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; a calculation and judgment unit, configured to calculate multiple proportions of consecutive identical transaction subsequences in sequence X, and calculate a transaction integrity value H based on the multiple proportions; if H is less than a first threshold, determining that the reuse degree of sequence X is high, and determining that the K-line containing sequence X is reused; Assignment backtracking unit, specifically used for element C in 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 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; Assignment backtracking unit, specifically used to mn Start backtracking, if x m =y n , determine x m 、y n It is an element in the same consecutive 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; The calculation and judgment unit is specifically used to replace the sequence X in the K-line with the sequence Y and then use real-time calculation of the candle entities to obtain a new K-line; Or replace the sequence X in the candlestick with sequence Y and use the pre-calculated candle bodies to get the new candlestick; Alternatively, replace the sequence X in the K-line with the sequence Y and then use mixed calculation to calculate the candle body to get a new K-line.

7. 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 5.

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