Butterfly counting method and device for financial data monitoring

By constructing a temporal bipartite graph and using node priority, tree merging, and red-black tree filtering, the problem of existing methods failing to capture high-frequency trading characteristics and trading order is solved, enabling efficient monitoring and accurate analysis of financial data.

CN116521779BActive Publication Date: 2026-05-01ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG UNIV
Filing Date
2023-04-23
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing butterfly counting methods fail to effectively capture high-frequency trading characteristics and trading sequences, leading to erroneous monitoring signals and increased data analysis costs.

Method used

By constructing a temporal bipartite graph, enumerating wedge structures using node priority, and filtering butterfly structures of high-frequency trading features using tree merging and red-black trees, the number of butterfly structures with different trading orders is calculated.

Benefits of technology

It enables precise capture and rapid filtering of high-frequency trading characteristics, improving the accuracy and efficiency of transaction monitoring and reducing the computation time for illegal butterfly structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116521779B_ABST
    Figure CN116521779B_ABST
Patent Text Reader

Abstract

The application discloses a butterfly counting method and device for financial data monitoring, and the method comprises the following steps: acquiring stock market transaction information, each piece of information containing an investor, a stock and a transaction time; modeling the investors and the stocks into an investor node set and a stock node set respectively, modeling the transactions into an edge set, each edge connecting an investor node and a stock node and having a transaction time information, so as to construct a time two-part graph; based on the priority of the nodes, enumerating the wedge-shaped structures composed of two transactions in the time two-part graph; according to a set frequency threshold, combining and checking the wedge-shaped structures two by two through a tree merging process, and using a red-black tree to filter the wedge-shaped structures that cannot form butterfly structures of high-frequency transaction characteristics; maintaining the wedge-shaped structure set through two red-black trees, and calculating the number of each butterfly structure representing different transaction sequences.
Need to check novelty before this filing date? Find Prior Art

Description

A butterfly counting method and apparatus for financial data monitoring Technical Field

[0001] This invention belongs to the field of bipartite graph data mining, and particularly relates to a butterfly counting method and apparatus for financial data monitoring. Background Technology

[0002] Bipartite graphs are a common modeling method for depicting the relationship between two types of things and have been widely applied. In the financial field, constructing bipartite graphs can effectively describe the trading relationships between investors and stocks. Among them, the butterfly structure is the most important basic structure in a bipartite graph. In the stock trading market, it is regarded as the most basic unit of capital flow. Counting its number can help financial institutions monitor dynamic changes in the market and discover potential trading risks and opportunities.

[0003] Recently, temporal bipartite graphs have attracted increasing attention by extending traditional bipartite graphs by incorporating temporal information. Existing butterfly counting methods only consider structural features and do not further consider the additional temporal information in temporal bipartite graphs. However, in real financial markets, transaction flow and frequency information are crucial. Therefore, designing a butterfly counting method for financial data monitoring has become an urgent need for both academia and industry.

[0004] In the process of realizing this invention, the inventors discovered at least the following problems in the prior art:

[0005] First, existing butterfly counting methods consider transaction information from all time periods equally, failing to account for high-frequency trading characteristics. These butterfly structures often require transactions to occur within a short period, potentially leading to false detection signals. Furthermore, existing methods ignore the order of transactions within the same butterfly structure, losing transaction flow information. This may require financial institutions to invest additional costs in data analysis, significantly impacting efficiency. Summary of the Invention

[0006] To address the shortcomings of existing technologies, the purpose of this application is to provide a butterfly counting method and apparatus for financial data monitoring, which can more accurately capture the generation of butterfly structures of high-frequency trading characteristics and provide detailed information on the number of butterfly structures for various trading sequences.

[0007] According to a first aspect of the embodiments of this application, a butterfly counting method for financial data monitoring is provided, comprising:

[0008] Get stock market trading information; each piece of information includes the investor, stock, and trading time.

[0009] The investors and stocks in the stock market transaction information are modeled as investor node sets and stock node sets respectively. The transactions between investors and stocks are modeled as edge sets. Each edge connects an investor node and a stock node and carries information about a transaction time, thereby constructing a temporal bipartite graph.

[0010] Based on the node priority, enumerate the wedge structure composed of two transactions in the temporal bipartite graph;

[0011] According to the set frequency threshold, the wedge structures are combined and verified in pairs through a tree merging process, and red-black trees are used to filter out wedge structures that cannot form high-frequency trading characteristics, wherein the butterfly structure is composed of two wedge structures with the same start node, the same end node, and different intermediate nodes.

[0012] By maintaining a set of wedge structures using two red-black trees, the number of butterfly structures representing different transaction orders is calculated.

[0013] Furthermore, based on node priority, the wedge structure consisting of two transactions in the temporal bipartite graph is enumerated, including:

[0014] The edges in each set of adjacent edges in the temporal bipartite graph are sorted according to the priority of the nodes that reach the nodes;

[0015] Treat each node as a starting node, traverse its neighbor set to determine the middle node, and then traverse the neighbor set of the middle node to determine the ending node. The node priority of the middle node and the ending node must be less than that of the starting node, thus enumerating the wedge structure.

[0016] Furthermore, for nodes u and w, if the size of u's neighbor set is greater than the size of v's neighbor set, or if the size of u's neighbor set is equal to the size of v's neighbor set and u's ID is greater than v's ID, then node u has a higher priority than node w.

[0017] Furthermore, based on a set frequency threshold, the wedge structures are combined and verified pairwise through a tree-based merging process, and red-black trees are used to filter out wedge structures that cannot form high-frequency trading characteristics, including:

[0018] If the filtering time interval is longer than the set frequency threshold, a wedge structure that cannot form the butterfly structure characteristic of high-frequency trading cannot be formed.

[0019] For wedge-shaped structures that have the same start node and the same end node after filtering, they are placed into different sets according to the different intermediate nodes;

[0020] Sort the wedge structures within each set according to temporal priority;

[0021] According to temporal priority, all wedge structure sets are merged in a tree structure to ensure that each pair of wedge structures can form a butterfly structure. During the merging process, a red-black tree is used to further verify whether each pair of wedge structures can form a butterfly structure with high-frequency trading characteristics and to filter out wedge structures that cannot form a butterfly structure with high-frequency trading characteristics.

[0022] Furthermore, for the wedge-shaped structure ∠ i ,∠ j If ∠ i The start time is greater than ∠ j The start time, or, ∠ i The start time is equal to ∠ j The start time and ∠ i The end time is less than ∠ j The end time of the wedge structure ∠ i Temporal priority is higher than that of wedge structure ∠ j Temporal priority.

[0023] Furthermore, by maintaining the set of wedge structures using two red-black trees, the number of butterfly structures representing different transaction orders is calculated, including:

[0024] The same set of wedge structures is maintained by two red-black trees, one of which uses the start time of the wedge structure as the key value of the tree, and the other red-black tree uses the end time of the wedge structure as the key value of the tree.

[0025] Based on the time relationships of the four edges of different butterfly structures, queries are performed on two red-black trees to calculate the number of various butterfly structures.

[0026] Furthermore, the method may also include:

[0027] If the number of one type of butterfly structure exceeds a predetermined threshold, a prompt will be triggered.

[0028] According to a second aspect of the embodiments of this application, a butterfly counting device for financial data monitoring is provided, comprising:

[0029] The acquisition module is used to acquire stock market transaction information. Each piece of information includes the investor, stock, and transaction time.

[0030] The construction module is used to model investors and stocks in the stock market transaction information as investor node sets and stock node sets respectively, and to model the transactions between investors and stocks as edge sets. Each edge connects an investor node and a stock node and carries information about a transaction time, thereby constructing a temporal bipartite graph.

[0031] The enumeration module is used to enumerate the wedge structure consisting of two transactions in the temporal bipartite graph based on the priority of the nodes;

[0032] The filtering module is used to combine and verify the wedge structures in pairs through a tree merging process according to a set frequency threshold, and to filter the wedge structures that cannot form butterfly structures that cannot form high-frequency trading characteristics using a red-black tree. The butterfly structure is composed of two wedge structures with the same start node, the same end node, and different intermediate nodes.

[0033] The computation module is used to maintain a set of wedge structures using two red-black trees and to calculate the number of each butterfly structure representing a different transaction order.

[0034] According to a third aspect of the embodiments of this application, an electronic device is provided, comprising:

[0035] One or more processors;

[0036] Memory, used to store one or more programs;

[0037] When the one or more programs are executed by the one or more processors, the one or more processors perform the method as described in the first aspect.

[0038] According to a fourth aspect of the embodiments of this application, a computer-readable storage medium is provided that stores computer instructions thereon, which, when executed by a processor, implement the steps of the method as described in the first aspect.

[0039] The technical solutions provided by the embodiments of this application may include the following beneficial effects:

[0040] As can be seen from the above embodiments, this application constructs a butterfly counting method and apparatus that can fully utilize time information for financial data monitoring. This application uses a temporal bipartite graph to vividly model financial data for analysis and mining; it utilizes node priority to accelerate the enumeration of wedge structures; it uses tree merging and red-black trees to solve the problem that existing methods cannot count the number of butterfly structures representing high-frequency trading features, achieving the goal of quickly filtering out invalid butterfly structures; it uses two red-black trees to maintain the wedge structure set, quickly calculating the number of each butterfly structure representing different trading sequences; finally, based on a set quantity threshold, it determines whether to trigger a prompt.

[0041] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0042] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0043] Figure 1 is a flowchart illustrating a butterfly counting method for financial data monitoring according to an exemplary embodiment.

[0044] Figure 2 is a flowchart illustrating step S14 according to an exemplary embodiment.

[0045] Figure 3 is a schematic diagram illustrating tree merging according to an exemplary embodiment.

[0046] Figure 4 is a schematic diagram of all butterfly structures representing different transaction sequences according to an exemplary embodiment.

[0047] Figure 5 is a flowchart illustrating step S15 according to an exemplary embodiment.

[0048] Figure 6 is a block diagram illustrating a butterfly counting device for financial data monitoring according to an exemplary embodiment.

[0049] Figure 7 is a schematic diagram of an electronic device according to an exemplary embodiment. Detailed Implementation

[0050] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application.

[0051] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0052] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0053] Figure 1 is a flowchart illustrating a butterfly counting method for financial data monitoring according to an exemplary embodiment. As shown in Figure 1, the method is applied in a terminal and may include the following steps:

[0054] S11: Obtain stock market trading information, each piece of information including the investor, stock, and trading time;

[0055] S12: Construct a temporal bipartite graph based on the stock market transaction information;

[0056] S13: Quickly enumerate wedge structures consisting of two transactions by using node priority;

[0057] S14: Based on the set frequency threshold, the wedge structures are combined and verified in pairs through a tree merging process, and a red-black tree is used to filter out butterfly structures with non-high-frequency trading characteristics.

[0058] S15: Maintain the set of wedge structures using two red-black trees, and quickly calculate the number of each butterfly structure representing different transaction orders;

[0059] S16: If the number of one type of butterfly structure exceeds a set threshold, a prompt will be triggered.

[0060] As can be seen from the above embodiments, this application constructs a butterfly counting method and apparatus that can fully utilize time information for financial data monitoring. This application uses a temporal bipartite graph to vividly model financial data for analysis and mining; it utilizes node priority to accelerate the enumeration of wedge structures; it uses tree merging and red-black trees to solve the problem that existing methods cannot count the number of butterfly structures representing high-frequency trading features, achieving the goal of quickly filtering out invalid butterfly structures; it uses two red-black trees to maintain the wedge structure set, quickly calculating the number of each butterfly structure representing different trading sequences; finally, based on a set quantity threshold, it determines whether to trigger a prompt.

[0061] In a specific implementation of S11, stock market transaction information is obtained, and each piece of information includes the investor, stock, and transaction time.

[0062] Specifically, in financial markets, tens of thousands of transaction data points are generated every moment. An investor buying or selling a stock at a given time generates one transaction data point. For example, at a certain moment, when an investor transacts with a stock (i.e., buys or sells), a transaction information point represented by a triple (investor, stock, time) is obtained. In practice, transactions are typically collected over a period of time, and the specific collection period can be dynamically adjusted according to actual needs.

[0063] In the specific implementation of S12, the investors and stocks in the stock market transaction information are modeled as investor node sets and stock node sets respectively, and the transactions between investors and stocks are modeled as edge sets. Each edge connects an investor node and a stock node and carries information about a transaction time, thereby constructing a temporal bipartite graph.

[0064] Specifically, investors and stocks are modeled as nodes, and transactions are modeled as edges, resulting in a temporal bipartite graph G = (V = (U, L), E). V represents the set of nodes, containing the set of investor nodes U and the set of stock nodes L; E represents the set of edges, containing several undirected edges e = (u, v, t) representing transactions, where u ∈ U represents an investor node, v ∈ L represents a stock node, and t represents the corresponding transaction time. Unlike ordinary bipartite graphs, there may be multiple edges with different times between the same pair of investor nodes and stock nodes. Furthermore, the set of neighboring edges of node v is denoted as N(v), representing the set of transactions associated with that investor or stock.

[0065] In a specific implementation of S13, based on the priority of the nodes, the wedge structure composed of two transactions in the temporal bipartite graph is enumerated;

[0066] Specifically, the wedge structure ∠=(u, v, w, t) s , t a ) is formed by two adjacent edges (u, v, t) s ) and (v, w, t) a It consists of ) where v, v, and w represent the start, middle, and end nodes, respectively, and t s , t a These represent the start and end times, respectively. A wedge-shaped structure, resembling investor-stock-investor or stock-investor-stock, indicates turnover in stock market transactions.

[0067] S31: Sort the edges in each set of adjacent edges in the temporal bipartite graph according to the priority of the nodes that reach the nodes;

[0068] Specifically, for each node u, its node priority is denoted as P. v (u). For two nodes u and w, their node priorities satisfy P. v (u)>P v (w) if and only if: (1) the size of the neighbor set of u is greater than the size of the neighbor set of v, i.e., |N(u)|>|N(w)|, where |N()| represents the size of set N(); (2) the size of the neighbor set of u is equal to the size of the neighbor set of v and the ID of u is greater than the ID of v, i.e., |N(u)|=|N(w)|∧id(u)>id(w), where id() represents the node ID given when constructing the graph. There are no special rules for ID; it is only necessary to ensure that each node has a unique ID. For each neighbor set, the edges are sorted in ascending order according to the node priority that the edge reaches.

[0069] S32: Treat each node as the starting node, traverse its neighbor set to determine the middle node, and then traverse the neighbor set of the middle node to determine the ending node. The node priority of the middle node and the ending node must be less than that of the starting node, so as to quickly enumerate the wedge structure.

[0070] Specifically, first, each investor node in the graph is traversed as the starting node u. Then, the set of adjacent edges of u is traversed to determine the intermediate node v. The traversal process must satisfy the node priority: the node priority of the intermediate node is lower than that of the starting node, i.e., P. v (u)>P v (v), finally, traverse the set of adjacent edges of v to determine the ending node w. The traversal process must satisfy the condition that the node priority of the ending node is less than the node priority of the starting node, i.e., P v (u)>P v (w). Since the neighbor set has already been sorted in ascending order of node priority in S31, when determining the intermediate and ending nodes, if a node priority does not meet the condition, the loop can be exited directly, and the next traversal process can begin. By using node priority, not only is the enumeration of wedge structures accelerated, but it also ensures that wedge structures are not enumerated repeatedly and that the correct number of combinations is achieved when forming butterfly structures.

[0071] In a specific implementation of S14, according to the set frequency threshold, the wedge structures are combined and verified in pairs through a tree merging process, and a red-black tree is used to filter the butterfly structures with non-high-frequency trading characteristics. The butterfly structure is composed of two wedge structures with the same start node, the same end node, and different intermediate nodes.

[0072] Specifically, the butterfly structure consists of two wedge-shaped structures with the same start node, the same end node, and different intermediate nodes. It can also be viewed as consisting of two investor nodes, two stock nodes, and four edges connected end-to-end. The butterfly structure represents the simplest capital flow structure in stock market trading, and the number of butterfly structures indicates the level of trading activity in the stock market. Based on the set frequency threshold δ, a butterfly structure with high-frequency trading characteristics needs to satisfy that the intervals in which the four trading times (i.e., edges) occur are no greater than δ. That is, the four edges e1, e2, e3, and e4 of the butterfly structure satisfy max{e1.t, e2.t, e3.t, e4.t} - min{e1.t, e2.t, e3.t, e4.t} ≤ δ, where max{} and min{} represent finding the maximum and minimum elements within the set, respectively. As shown in Figure 2, this step may include the following sub-steps:

[0073] S41: A wedge structure that cannot form a high-frequency trading characteristic butterfly structure if the filtering time interval is greater than the set frequency threshold.

[0074] Specifically, since the butterfly structure characteristic of high-frequency trading requires that the time intervals of its four sides be no greater than δ, it can be inferred that the wedge structure ∠ that can constitute the butterfly structure characteristic of high-frequency trading requires that the time intervals of its two sides be no greater than δ, i.e., |∠.t s -∠.t a |≤δ. This necessary condition allows for direct filtering of |∠.t. s -∠.t a The wedge structure of |>δ greatly reduces the size of the candidate set of the wedge structure, reduces the number of times the wedge structure is combined for verification, and accelerates the calculation of the number of butterfly structures.

[0075] S42: For wedge-shaped structures with the same start node and the same end node after filtering, put them into different sets according to the different intermediate nodes;

[0076] Specifically, for two wedge structures to form a butterfly structure, they must have the same start and end nodes and different intermediate nodes. In S32, the start node of each wedge structure is first determined. The enumerated wedge structures are then placed in different positions within the hash table according to their end nodes, thus satisfying the condition of having the same start and end nodes. These wedge structures are then placed into different sets according to their different intermediate nodes. Taking two wedge structures from different sets will guarantee the formation of a butterfly structure, but it may not necessarily satisfy the characteristics of high-frequency trading.

[0077] S43: Sort the wedge structures within each set according to temporal priority;

[0078] Specifically, for a wedge structure ∠, its temporal priority is denoted as P. w (∠). For two wedge-shaped structures ∠ i ,∠ j Its temporal priority satisfies P w (∠ i ) < P w (∠ j ) if and only if: (1)∠ i The start time is greater than ∠ j The start time, i.e., ∠ i .t s >∠ j .t s (2)∠ i The start time is equal to ∠ j The start time and ∠ i The end time is less than ∠ j The end time, ∠ i .ts=∠ j .t s ∧∠ i .t a <∠j .t a For each set, sort them in ascending order according to the temporal priority corresponding to the wedge structure.

[0079] S44: According to temporal priority, all wedge structure sets are merged in a tree structure to ensure that each pair of wedge structures can form a butterfly structure. During the merging process, a red-black tree is used to further verify whether each pair of wedge structures can form a butterfly structure with high-frequency trading characteristics and to filter out wedge structures that cannot form a butterfly structure with high-frequency trading characteristics.

[0080] Specifically, each round of pairwise merging of wedge structure sets continues until only one set remains, as shown in Figure 3. During the merging process, temporal priority is used as the merging rule; that is, when merging two sets into a new set, each time an unprocessed wedge structure with a lower temporal priority is added to the new set. Through this process, the wedge structures in the resulting new set also satisfy the temporal priority. Simultaneously, each extracted wedge structure is combined with the already processed wedge structure set in the other set for verification, ensuring that each wedge structure can undergo a merge verification with a wedge structure whose intermediate node is different and has a lower temporal priority. Through tree-based merging, each initial wedge structure set participates in log(n) merging operations, where n represents the initial number of sets, ensuring a balanced processing time for each set during the process.

[0081] During the merging process, a sphere is constructed for each wedge-shaped structure set with a termination time t. a The red-black tree is a key-value pair that maintains the processed wedge structures. A red-black tree is a balanced binary tree that efficiently maintains sets. Its internal elements are organized according to a set key-value relationship, allowing for fast addition, deletion, and search operations without disrupting the key-value relationship. The time complexity of each of these operations is log(m), where m represents the number of elements in the tree. As shown in S44, the temporal priority of unprocessed wedge structures is higher than that of wedge structures within the red-black tree. For two wedge structures ∠... i ,∠ j , and ∠ i .t s <∠ i .t s If ∠ j .t a -∠ i .t s If ≤δ, then the butterfly structure formed by the two wedge structures satisfies the characteristics of high-frequency trading. Therefore, for each new unprocessed wedge structure ∠ i Determine whether the last element of a red-black tree (i.e., the wedge structure with the longest termination time) satisfies the condition that it is less than or equal to ∠1 / 2.i .t s If the condition is not met (+δ), the element is deleted. This process is repeated until the last element satisfies the condition, thus ensuring that the butterfly structure satisfies the high-frequency trading characteristic. The time complexity of searching for the last element and deleting an element in a red-black tree is log(m), where m represents the number of elements in the tree.

[0082] In the specific implementation of S15, the set of wedge structures is maintained by two red-black trees, and the number of each butterfly structure representing different transaction orders is calculated.

[0083] Specifically, the four transactions in a butterfly structure can occur in multiple different sequences. Isomorphic analysis reveals six different butterfly structures. More specifically, the four edges correspond to A(4,4) = 24 different temporal sequences, where A() represents the permutation formula. Since the two investor nodes and the two stock nodes belong to the same type of node, the isomorphic analysis yields A(4,4) / A(2,2) / A(2,2) = 6 sequences. As shown in Figure 4, there are six types of non-isomorphic butterfly structures representing different transaction sequences, denoted as... Their corresponding quantities are denoted as C0, C1, ..., C5.

[0084] As shown in Figure 5, this step may include the following sub-steps:

[0085] S51: Maintain the same set of wedge structures using two red-black trees, one of which uses the start time of the wedge structure as the key value of the tree, and the other red-black tree uses the end time of the wedge structure as the key value of the tree.

[0086] Specifically, S45 has constructed a timer t with a wedge-shaped structure. a If we use a red-black tree with key-value pairs, denoted as TA, then we only need to construct another tree with a wedge structure starting at time t. s A red-black tree with keys, denoted as TS. Both trees maintain the same wedge-shaped structure set. When deleting an element in TA, the corresponding element in TS must also be deleted.

[0087] S52: Based on the time relationship of the four edges of different butterfly structures, query on two red-black trees to calculate the number of various butterfly structures;

[0088] Specifically, when two wedge structures form a butterfly structure, the following four rules apply: (1) For two wedge structures that both satisfy the condition that the start time is greater than the end time, ∠ i ,∠ j , and ∠ i The start time is less than ∠ j The start time, if ∠ i The end time is less than ∠ jThe start time, then ∠ i .t s <∠ i .t a <∠ j .t s <∠ j .t a (2) For two wedge structures ∠, both satisfying that the start time is greater than the end time. i ,∠ j , and ∠ i The start time is less than ∠ j The start time, if ∠ i The end time is less than ∠ j The end time, then ∠ i .t s <∠ i .t a ≤∠ j .t s <∠ j .t a Or ∠ i .t s <∠ j .t s <∠ i .t a <∠ j .t a (3) For two wedge structures ∠, both satisfying that the start time is greater than the end time. i ,∠ j , and ∠ i The start time is less than ∠ j The start time, if ∠ i The end time is less than or equal to ∠ j The start time, then ∠ i .t s <∠ i .t a ≤∠ j .t s <∠ j .t a (4) For two wedge structures where both start time is greater than end time, ∠ i ,∠ j , and ∠ i The start time is less than ∠ j The start time, if ∠ j The end time is less than ∠ i The start time, then ∠ i .t s <∠ j .t s <∠ j .t a<∠ i .t a Given a wedge structure ∠, according to rule (1), query >∠.t on TS. a The number of elements can be calculated. The quantity; according to rules (2) and (3), query on TA > ∠.t a The quantity minus the query result on TS ≥∠.t a The quantity can be calculated The quantity; according to rule (4), the <∠.t query on TS a The number of elements can be calculated The quantity. When both wedge structures satisfy the condition that the start time is greater than the end time, the corresponding quantity can be calculated similarly. The number; when one wedge structure satisfies the condition that the start time is greater than the end time, and the other satisfies the condition that the start time is less than the end time, the corresponding number can be calculated similarly. The number of elements is calculated by summing the counts for C0, C1, ..., C5. The time complexity of searching for the number of elements satisfying the conditions on a red-black tree is log(m), where m represents the number of elements in the tree.

[0089] In specific implementation, this method may also include step S16: if the number of one type of butterfly structure exceeds a predetermined threshold, a prompt is triggered.

[0090] Specifically, if any one of the six butterfly species, C0, C1, ..., C5, exceeds a predetermined threshold value C... δ The triggering of the alert indicates that one or more types of high-frequency trading sequences are being generated on a large scale, which requires attention.

[0091] Corresponding to the aforementioned embodiments of the butterfly counting method for financial data monitoring, this application also provides embodiments of a butterfly counting device for financial data monitoring.

[0092] Figure 6 is a block diagram of a butterfly counting device for financial data monitoring according to an exemplary embodiment. Referring to Figure 6, the device may include:

[0093] Module 21 is used to obtain stock market transaction information. Each piece of information includes the investor, stock, and transaction time.

[0094] The construction module 22 is used to model the investors and stocks in the stock market transaction information as investor node sets and stock node sets respectively, and to model the transactions between investors and stocks as edge sets. Each edge connects an investor node and a stock node and carries information about a transaction time, thereby constructing a temporal bipartite graph.

[0095] Enumeration module 23 is used to enumerate the wedge structure composed of two transactions in the temporal bipartite graph based on the priority of the nodes;

[0096] The filtering module 24 is used to combine and verify the wedge structures in pairs through a tree merging process according to a set frequency threshold, and use a red-black tree to filter the wedge structures that cannot form butterfly structures that do not have high-frequency trading characteristics. The butterfly structure is composed of two wedge structures with the same start node, the same end node and different middle nodes.

[0097] The computation module 25 is used to maintain a set of wedge structures using two red-black trees and to calculate the number of each butterfly structure representing a different transaction order.

[0098] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0099] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. 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 the modules can be selected to achieve the purpose of this application according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0100] Accordingly, this application also provides an electronic device, including: one or more processors; a memory for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the butterfly counting method for financial data monitoring as described above. Figure 7 shows a hardware structure diagram of any data processing device in which the butterfly counting method for financial data monitoring provided in this embodiment of the invention is implemented. Besides the processor, memory, and network interface shown in Figure 7, the device in this embodiment, depending on its actual function, may also include other hardware, which will not be elaborated further.

[0101] Accordingly, this application also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the butterfly counting method for financial data monitoring as described above. The computer-readable storage medium can be an internal storage unit of any data-processing device as described in any of the foregoing embodiments, such as a hard disk or memory. The computer-readable storage medium can also be an external storage device, such as a plug-in hard disk, smart media card (SMC), SD card, flash card, etc., equipped on the device. Furthermore, the computer-readable storage medium can include both internal storage units of any data-processing device and external storage devices. The computer-readable storage medium is used to store the computer program and other programs and data required by the data-processing device, and can also be used to temporarily store data that has been output or will be output.

[0102] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.

[0103] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.

Claims

1. A butterfly counting method for financial data monitoring, characterized in that, include: Acquire stock market trading information, each piece of information containing investor, stock, and trading time; model the investors and stocks in the stock market trading information as investor node sets and stock node sets respectively, and model the transactions between investors and stocks as edge sets, each edge connecting an investor node and a stock node and carrying a transaction time information, thereby constructing a temporal bipartite graph; based on node priority, enumerate the wedge structures composed of two transactions in the temporal bipartite graph; according to a set frequency threshold, verify the pairwise combination of the wedge structures through a tree merging process, and use a red-black tree to filter out wedge structures that cannot form high-frequency trading characteristics, such as butterfly structures. The structure consists of two wedge structures with the same start node, the same end node, and different intermediate nodes. The set of wedge structures is maintained using two red-black trees, and the number of butterfly structures representing different transaction orders is calculated. Specifically, based on node priority, the wedge structures composed of two transactions in the temporal bipartite graph are enumerated, including: sorting the edges in each neighboring edge set of the temporal bipartite graph according to the node priority reaching the node; treating each node as the start node, traversing its neighboring edge set to determine the intermediate node, and then traversing the neighboring edge set of the intermediate node to determine the end node, ensuring that the node priority of the intermediate node and the end node is less than that of the start node, thereby enumerating the wedge structures.

2. The method according to claim 1, characterized in that, For nodes ,like The size of the adjacent edge set is greater than size of the adjacent edge set or The size of the adjacent edge set is equal to Size of adjacent edge set and ID greater than The ID of the node Its priority is higher than that of the node. Priority.

3. The method according to claim 1, characterized in that, Based on a set frequency threshold, the wedge structures are combined and verified in pairs through a tree-based merging process. A red-black tree is used to filter wedge structures that cannot form butterfly structures with high-frequency trading characteristics. This includes: filtering wedge structures whose time interval exceeds the set frequency threshold, thus preventing them from forming butterfly structures with high-frequency trading characteristics; placing filtered wedge structures with the same start and end nodes into different sets based on their intermediate nodes; sorting the wedge structures in each set according to temporal priority; and merging all wedge structure sets in a tree-based merging process according to temporal priority to ensure that each pair of wedge structures can form a butterfly structure. During the merging process, a red-black tree is used to further verify whether each pair of wedge structures can form a butterfly structure with high-frequency trading characteristics and to filter wedge structures that cannot form butterfly structures with high-frequency trading characteristics.

4. The method according to claim 3, characterized in that, For wedge structure ,like The start time is greater than The start time, or, The start time is equal to start time and The end time is less than The end time of the wedge structure Temporal priority is higher than wedge structure Temporal priority.

5. The method according to claim 1, characterized in that, The set of wedge structures is maintained using two red-black trees. The number of butterfly structures representing different transaction orders is calculated. This includes maintaining the same set of wedge structures using two red-black trees, where one red-black tree uses the start time of the wedge structure as the key and the other red-black tree uses the end time of the wedge structure as the key. The number of butterfly structures is calculated by querying the two red-black trees according to the time relationship of the four edges of different butterfly structures.

6. The method according to claim 1, characterized in that, The method may also include triggering a prompt if the number of one type of butterfly structure exceeds a predetermined threshold.

7. A butterfly counting device for financial data monitoring, characterized in that, include: The acquisition module is used to acquire stock market transaction information. Each piece of information includes the investor, stock, and transaction time. The construction module is used to model investors and stocks in the stock market transaction information as sets of investor nodes and stock nodes respectively, and to model the transactions between investors and stocks as sets of edges. Each edge connects an investor node and a stock node and carries information about a transaction time, thereby constructing a temporal bipartite graph. The enumeration module is used to enumerate wedge structures composed of two transactions in the temporal bipartite graph based on node priority. The filtering module is used to verify the pairwise combination of the wedge structures according to a set frequency threshold through a tree merging process, and to filter out wedge structures that cannot form high-frequency trading characteristics using a red-black tree. The butterfly structure consists of two wedge structures with... The system consists of wedge structures with the same start node, the same end node, and different intermediate nodes; a calculation module is used to maintain the wedge structure set through two red-black trees and calculate the number of each butterfly structure representing different transaction orders; wherein, based on the node priority, the system enumerates the wedge structures composed of two transactions in the temporal bipartite graph, including: sorting the edges in each neighbor set of the temporal bipartite graph according to the node priority of reaching the node; treating each node as the start node, traversing its neighbor set to determine the intermediate node, and then traversing the neighbor set of the intermediate node to determine the end node, and it is necessary to satisfy that the node priority of the intermediate node and the end node is less than that of the start node, thereby enumerating the wedge structures.

8. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-6.

9. A computer-readable storage medium storing computer instructions thereon, characterized in that, When executed by the processor, this instruction implements the steps of the method as described in any one of claims 1-6.