A security transaction risk control method, system and storage medium
By dividing the risk control rules of the securities trading system into synchronous and asynchronous rules, and constructing a synchronous judgment layer and an asynchronous calculation layer, real-time control of transaction declarations and dynamic adjustment of risk control strategies are achieved without increasing the latency of the transaction link. This solves the latency and stability problems caused by the synchronous execution of risk control rules in existing technologies.
Patent Information
- Application Number
- CN202611447650.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-17
- Publication Date
- 2026-11-27
Smart Images

Figure CN123181133A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of securities trading system technology, and in particular to a securities trading risk control method, system and storage medium. Background Technology
[0002] In securities trading systems, the pre-trade risk control system is deployed on the reporting link between the client and the exchange. It is used to verify and intercept investors' transaction reports in real time, and is a core component in ensuring transaction compliance. With increasingly stringent regulatory requirements, the risk control rule system is constantly being enriched. This includes lightweight rules that can be calculated based on a single report, such as fund verification, blacklists and whitelists, self-trading determination, and order rate control. There are also heavyweight rules that require maintaining sliding time windows, replaying market data, and aggregating historical message sequences from multiple accounts to complete statistical calculations, such as monitoring price manipulation, identifying false reports, monitoring abnormal order cancellation frequencies, monitoring large transactions, and monitoring price manipulation. These different types of risk control rules differ significantly in computational complexity and resource consumption. How to effectively integrate various risk control rules while ensuring low latency and high stability in the trading link is a crucial challenge in this field.
[0003] Currently, existing technologies mainly employ two implementation approaches. One approach executes all risk control rules synchronously along the transaction chain. In this method, heavyweight statistical calculations directly occupy the application processing path, leading to processing backlogs for single applications and impacting system stability. Furthermore, adjustments to risk control rules require system downtime for deployment, hindering rapid iteration. The other approach places abnormal transaction rules entirely outside the transaction chain for offline monitoring. While this avoids impacting chain latency, violations are detected only after the transaction has occurred, making it impossible to promptly intercept subsequent applications from the same controlled entity. This fails to meet the timeliness requirements of in-process supervision, and the monitoring results are isolated from the transaction chain, preventing the formation of a real-time control loop. Moreover, changes to risk control parameters and rule configurations in existing solutions typically require system downtime for modification and restart, making dynamic adjustments based on market conditions impossible. Additionally, the statistical status accumulated in memory is difficult to recover after a risk control process failure.
[0004] Therefore, how to enable computationally intensive statistical risk control rules to exert real-time control over ongoing transaction submissions without imposing significant latency burden on the transaction chain, while also supporting dynamic adjustment of risk control strategies and system fault tolerance recovery, is a technical problem that urgently needs to be solved. Summary of the Invention
[0005] In view of this, embodiments of this application provide a securities trading risk control method, system, and storage medium that enables computationally intensive statistical risk control rules to exert real-time control over ongoing transaction submissions without causing significant latency burden on the transaction chain, while also supporting dynamic adjustment of risk control strategies and system fault tolerance recovery.
[0006] Firstly, this application provides a method for controlling securities trading risks, including: Risk control rules are divided into synchronous rules and asynchronous rules; A synchronous decision-making layer and an asynchronous calculation layer are constructed. The synchronous decision-making layer is deployed on the reporting link between the client and the exchange, while the asynchronous calculation layer is deployed outside the reporting link. The synchronous decision-making layer and the asynchronous calculation layer are coupled through ordered flow and risk status recording. When the synchronous judgment layer receives the current transaction declaration, if the transaction declaration triggers the synchronous rule, it makes a judgment based on the information of the transaction declaration; if the transaction declaration triggers the asynchronous rule, it makes a judgment based on the risk control status table. The synchronous judgment layer writes the transaction declarations that are judged as approved into the orderly transaction log and publishes them to the public; The asynchronous computation layer subscribes to the ordered pipeline, performs statistical calculations on the asynchronous rules based on the messages in the ordered pipeline, and feeds back the risk control status to the synchronous decision layer based on the calculation results, so that the synchronous decision layer can update the risk control status table according to the risk control status.
[0007] Secondly, this application provides a securities trading risk control system, including: The partitioning module is used to divide risk control rules into synchronous rules and asynchronous rules; The module is used to build a synchronous decision layer and an asynchronous calculation layer. The synchronous decision layer is deployed on the reporting link between the client and the exchange, while the asynchronous calculation layer is deployed outside the reporting link. The synchronous decision layer and the asynchronous calculation layer are coupled through ordered flow and risk status records. The synchronous judgment layer is used to determine the transaction based on the information in the transaction declaration when the current transaction declaration is received. If the transaction declaration triggers the synchronous rule, it will make a judgment based on the information in the transaction declaration. If the transaction declaration triggers the asynchronous rule, it will make a judgment based on the risk control status table. The layer also writes the transaction declarations that are approved into the ordered flow and publishes them to the outside world. The asynchronous computation layer is used to subscribe to the ordered flow, perform statistical calculations on the asynchronous rules based on the messages in the ordered flow, and feed back the risk control status to the synchronous judgment layer based on the calculation results, so that the synchronous judgment layer can update the risk control status table according to the risk control status.
[0008] Thirdly, this application provides a storage medium on which a computer program is stored, which, when executed by a processor, implements the above-mentioned securities trading risk control method.
[0009] By employing the above technical solutions, the securities trading risk control method, system, storage medium, and computer equipment provided in this application divide risk control rules into synchronous and asynchronous rules, and construct a synchronous judgment layer deployed within the application chain and an asynchronous calculation layer deployed outside the chain. This allows computationally intensive asynchronous rules to be moved entirely out of the application chain, avoiding heavyweight statistical calculations from occupying the application processing path, thereby solving the problem of linearly increasing latency with the number of statistical rules in a fully synchronous route. Simultaneously, by coupling the synchronous judgment layer and the asynchronous calculation layer through ordered pipeline and risk status recording, the asynchronous calculation layer subscribes to the ordered pipeline bypass replay calculation and... The risk status is fed back to the synchronous judgment layer in real time to update the risk control status table. This allows the statistical calculation results of asynchronous rules to be applied to the synchronous judgment layer in real time, enabling immediate interception of subsequent applications for the same controlled object. This overcomes the shortcomings of pure post-event monitoring, such as delayed violation detection and inability to form a real-time control loop. Thus, without causing significant latency burden on the transaction link, computationally intensive statistical risk control rules can have a real-time control effect on ongoing transaction applications. At the same time, it supports dynamic adjustment of risk control strategies and system fault tolerance recovery. This achieves an organic unity of low link latency, high processing efficiency, and high operational flexibility in the pre-event risk control process of securities trading.
[0010] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0011] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 A flowchart illustrating a securities trading risk control method provided in an embodiment of this application is shown. Figure 2 This paper shows a schematic diagram of the structure of a securities trading risk control system provided in an embodiment of this application; Figure 3 A schematic diagram of the system structure of a computer device provided in an embodiment of this application is shown. Detailed Implementation
[0012] The present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of the present application can be combined with each other.
[0013] This invention provides a method for controlling securities trading risks, such as... Figure 1 As shown, the method includes: S101 divides risk control rules into synchronous rules and asynchronous rules.
[0014] In this embodiment, the risk control rules involved in pre-trade risk control are first categorized into synchronous rules and asynchronous rules. Synchronous rules are risk control rules that can be independently calculated based on the information carried by a single transaction declaration. Their judgment process does not rely on historical trading data, market data sequences, or related information from other accounts. These rules have simple calculation logic and fast execution speed, making them suitable for synchronous judgment on the real-time path of transaction declarations. Asynchronous rules, on the other hand, cannot be directly judged based solely on the information of a single transaction declaration. Instead, they require statistical calculation based on historical message sequences over a period of time to determine the risk status. Their calculation process typically involves maintaining a sliding time window, replaying market data, and aggregating historical declarations or transaction records from multiple accounts. Typical examples include monitoring price manipulation, identifying false declarations, monitoring abnormal order cancellation frequencies, monitoring large transactions, and monitoring price manipulation. These rules have high computational complexity and consume significant resources. If executed synchronously on the real-time path of transaction declarations, they will significantly increase transaction latency, thereby affecting the overall performance and stability of the trading system. By dividing the rules into different types, the risk control rules are logically decoupled, laying the foundation for subsequent layered deployment and differentiated processing. This allows computationally intensive asynchronous rules to be removed from the real-time processing path of transaction declarations without impacting latency-sensitive businesses in the transaction chain.
[0015] In some embodiments, risk control rules are divided into synchronous rules and asynchronous rules, including: rules that can be calculated based on a single declaration are identified as synchronous rules; and rules that perform statistical calculations based on historical message sequences are identified as asynchronous rules.
[0016] For example, rules that can be independently determined based on the information carried by the current single order are defined as synchronous rules, such as fund verification rules, blacklist / whitelist filtering rules, self-trading judgment rules, and order rate control rules; rules that require maintaining a sliding time window, replaying market data, or aggregating historical message sequences from multiple accounts to complete statistical calculations are defined as asynchronous rules, such as rules for monitoring price manipulation, rules for identifying false orders, rules for monitoring abnormal order cancellation frequency, rules for monitoring large transactions, and rules for monitoring price manipulation.
[0017] S102, construct a synchronous judgment layer and an asynchronous calculation layer. The synchronous judgment layer is deployed on the reporting link between the client and the exchange, and the asynchronous calculation layer is deployed outside the reporting link. The synchronous judgment layer and the asynchronous calculation layer are coupled through ordered flow and risk status recording.
[0018] The synchronous judgment layer is a risk control processing node connected in the reporting link between the client and the exchange. It is used to uniformly schedule and perform lightweight judgment of all risk control rules on the real-time path of transaction reporting, and publish the transaction reporting and reward messages that are judged as approved in sequence as an ordered flow. Specifically, the synchronous judgment layer is implemented as a synchronous risk control kernel process, including a relay channel, a rule execution module, a risk control status table, and a flow record publishing module. The relay channel is used to receive transaction reporting on the client side and reward messages on the exchange side. The rule execution module is used to complete the judgment calculation of synchronous rules in real time within the link and to perform constant-time judgment of asynchronous rules by querying the corresponding approval or blocking status in the risk control status table. The risk control status table is used to maintain the approval or blocking status of each asynchronous rule with the risk control rule identifier and security code as the primary key. The flow record publishing module is used to write all reporting and reward messages into the ordered flow in sequence and publish them externally.
[0019] The asynchronous computation layer, deployed as an independent risk control processing node outside the application chain, is used to subscribe to all messages in the ordered transaction flow bypass replay, perform complete statistical calculations of asynchronous rules to determine the risk status, and push the risk status back to the synchronous judgment layer in real time. Specifically, this asynchronous computation layer is implemented as an asynchronous risk control kernel process, including a transaction flow subscription module, a statistical calculation module, and a result pushback module. The transaction flow subscription module is used to subscribe to the ordered transaction flow to obtain all messages, the statistical calculation module is used to perform complete statistical calculations of asynchronous rules (such as maintaining a sliding time window counter, a market data increment queue, and aggregating historical message sequences from multiple accounts), and the result pushback module is used to push the calculated risk status back to the synchronous judgment layer in real time.
[0020] The ordered pipeline is a message sequence uniquely written and published by the synchronization decision layer. It appends application messages and exchange reward messages in the order of arrival. Each message carries a monotonically increasing sequence number, thus ensuring message ordering. Specifically, this ordered pipeline is an append-only log stream, with the synchronization decision layer as its sole writer. This ordering ensures that the message consumption order of the asynchronous computing layer and backup nodes matches the actual arrival order of messages in the link, providing a foundation for the asynchronous computing layer to achieve lock-free statistical calculations using single-threaded sequential consumption.
[0021] Risk status, determined through statistical calculations of asynchronous rules, is a judgment result indicating whether the current controlled object has triggered risk control. It includes both release and block statuses. Specifically, the statistical calculation module of the asynchronous calculation layer completes statistical calculations based on historical message sequences and determines whether the calculation results meet preset risk triggering conditions. If they do, the risk status of the corresponding asynchronous rule is set to block; otherwise, it is set to release. The determined risk status is then published to the synchronous judgment layer in real time via the result pushback module. The synchronous judgment layer updates the record of the corresponding asynchronous rule in the risk control status table based on the received risk status, ensuring that the risk status applies to subsequent declaration judgments for the same controlled object.
[0022] S103, when the synchronous judgment layer receives the current transaction declaration, if the transaction declaration triggers the synchronous rule, it makes a judgment based on the information of the transaction declaration; if the transaction declaration triggers the asynchronous rule, it makes a judgment based on the risk control status table.
[0023] Specifically, the synchronous judgment layer uses its rule execution module to uniformly schedule risk control rules: For triggered synchronous rules, such as fund verification rules, blacklist / whitelist filtering rules, self-trading judgment rules, or order rate control rules, since these rules can be calculated independently based on the information carried by the current single order, the rule execution module directly obtains the corresponding fields in the current transaction order, such as account identifier, security code, order amount, order price, and order quantity, within the link for verification and calculation, and outputs the release or blocking judgment of the order in real time based on the verification results; For triggered asynchronous rules, such as rules for monitoring price manipulation, rules for identifying false orders, rules for monitoring abnormal order cancellation frequency, rules for monitoring large transactions, or rules for monitoring price manipulation, since the complete judgment of these rules requires statistical calculation based on historical message sequences and cannot be completed in real time within the link, the rule execution module does not directly perform complex calculations based on the information of the current transaction order, but judges the transaction order based on the risk control status table.
[0024] In some embodiments, if a transaction declaration triggers a synchronous rule, a judgment is made based on the information in the transaction declaration; if a transaction declaration triggers an asynchronous rule, a judgment is made based on the risk control status table. This includes: if the risk control rule is a synchronous rule, the synchronous judgment layer verifies the information in the transaction declaration and outputs the judgment result of the transaction declaration based on the verification result; if the risk control rule is an asynchronous rule, the synchronous judgment layer queries the risk control status table using the risk control rule identifier and security code corresponding to the transaction declaration as keys, obtains the corresponding risk control status in the risk control status table, and outputs the judgment result of the transaction declaration based on the risk control status.
[0025] Specifically, for triggered synchronous rules, the rule execution module directly obtains the message from the current transaction declaration within the link, that is, performs verification calculations on the corresponding fields, and outputs the release or blocking judgment of the declaration in real time based on the verification results. For triggered asynchronous rules, the rule execution module does not directly perform complex calculations based on the information of the current transaction declaration. Instead, it uses the risk control rule identifier and security code corresponding to the current transaction declaration as keys to query the current status record corresponding to the asynchronous rule in the risk control status table. The risk control status table maintains the release or blocking status of each asynchronous rule with the risk control rule identifier + security code as the primary key. When an asynchronous rule is configured for the first time, the synchronous judgment layer establishes an initial status of release for the asynchronous rule in the risk control status table. Subsequently, the asynchronous calculation layer provides real-time feedback and continuously updates the status based on the statistical calculation results, thereby obtaining the release or blocking status of the asynchronous rule for the current controlled object, and outputs the judgment result of the declaration based on this status.
[0026] In this way, the synchronous judgment layer performs real-time verification of synchronous rules within the link and outputs the judgment. For asynchronous rules, it performs a constant-time table lookup operation using the risk control rule identifier and securities code as the key to complete the judgment. This completely removes the complete calculation of statistical asynchronous rules from the transaction link, and only lightweight table lookup judgment is retained within the link. The processing latency of the application link is completely decoupled from the number and computational load of asynchronous rules.
[0027] S104, the synchronous judgment layer writes the transaction declarations with the judgment result of approval into the orderly flow and publishes them to the outside world.
[0028] Specifically, the synchronous judgment layer writes the declaration messages that are judged to be released into the ordered pipeline in the order of arrival, assigns a sequence number to each declaration message, and publishes the ordered pipeline carrying the sequence number to the outside world.
[0029] In this embodiment, the synchronization determination layer, through its pipeline publishing module, appends all declaration messages that have been approved after synchronous rule verification and asynchronous rule lookup to an ordered pipeline, in the order in which each declaration arrives in the link. Each declaration message is assigned a monotonically increasing sequence number (e.g., a sequence number starting from 0 and increasing sequentially), ensuring that each message in the ordered pipeline carries a globally unique sequence number, thereby guaranteeing the orderliness and integrity of the messages within the pipeline. This ordered pipeline is published externally through a network topic, and the synchronization determination layer, as the sole writer of this ordered pipeline, ensures the uniqueness of message writing and the continuity and non-conflict of sequence numbers.
[0030] It should be noted that the subscribers of this ordered pipeline include at least the asynchronous computing layer and the backup nodes of the synchronous decision layer. The asynchronous computing layer obtains all release messages by subscribing to this ordered pipeline in order to perform statistical calculations of asynchronous rules. The backup nodes achieve primary and secondary temperature backup of the synchronous decision layer by subscribing to the same ordered pipeline, so that one pipeline can serve three purposes at the same time: asynchronous computing, primary and secondary temperature backup, and audit disk write-to-disk.
[0031] In addition, the synchronization judgment layer also writes the return messages returned by the exchange into the ordered flow in the order of arrival, so that the ordered flow can completely record the entire chain message sequence of declaration and return.
[0032] In the above way, after the asynchronous computing layer subscribes to the ordered flow, it can replay the declaration messages and reward messages in sequence according to the sequential number, and fully restore the message sequence and business context in the transaction link. Thus, it can independently execute the complete statistical calculation of asynchronous rules without any synchronous interaction with the synchronous judgment layer.
[0033] S105, the asynchronous computing layer subscribes to the ordered flow, performs statistical calculations on the asynchronous rules based on the messages in the ordered flow, and feeds back the risk control status to the synchronous judgment layer based on the calculation results, so that the synchronous judgment layer can update the risk control status table according to the risk control status.
[0034] Specifically, the asynchronous computing layer subscribes to the ordered flow through its flow subscription module, reads the declaration messages and exchange return messages in the ordered flow to obtain the data source required for asynchronous rule statistical calculation, and then performs complete statistical calculation of asynchronous rules on each message through its statistical calculation module. Based on the calculation results, it determines the risk control status corresponding to each asynchronous rule, and finally feeds back the determined risk control status to the synchronous judgment layer in real time through its result pushback module, so that the synchronous judgment layer updates the record of the corresponding asynchronous rule in the risk control status table according to the received risk control status.
[0035] In some embodiments, the asynchronous computing layer subscribes to an ordered flow and performs statistical calculations on asynchronous rules based on the messages in the ordered flow. This includes: the asynchronous computing layer sequentially reads messages in the ordered flow according to the sequential number carried by the ordered flow, and establishes a rule index indexed by the target account and securities code; when a read message hits the rule index and the corresponding rule instance does not exist, the corresponding rule instance is created, and the statistical calculations of the corresponding asynchronous rule are performed through the rule instance.
[0036] Specifically, the asynchronous computing layer subscribes to ordered transaction logs through its transaction log subscription module. It reads the declaration messages and exchange feedback messages sequentially according to their sequential numbers. Because the message order in the ordered transaction log strictly matches the actual arrival order in the transaction chain, and each message carries a globally unique sequence number, the asynchronous computing layer can directly obtain a deterministic message sequence when reading the transaction log, without needing additional sorting or alignment processing. This supports lock-free statistical computation using a single-rule thread sequential processing method. During the statistical computation process, the asynchronous computing layer's rule engine maintains a two-level rule index: the first level uses the target account (i.e., investor account) as the key, and the second level uses the security code as the key, thus constructing a two-level index structure of accounts and securities. After each message is read, the rule engine first searches the first-level index using the investor account in the message as the key. If a match is found, it further searches the second-level index using the security code as the key to determine whether a rule instance corresponding to the message exists. When the read message matches the rule index and the corresponding rule instance does not exist, that is, when the combination of the account and security triggers the statistical calculation requirement of the asynchronous rule for the first time, the rule engine creates the corresponding rule instance as needed and loads the statistical structure required by the instance (such as a sliding time window counter, market data increment queue, etc.), thus completing the initialization of the rule instance.
[0037] Based on this, statistical calculations of the corresponding asynchronous rules are performed through the created or existing rule instances: For each inflow message, the rule instance continuously updates its maintained sliding time window counter (which is used to count the number of submissions, transactions, and cancellations within the preset time window), maintains the market data increment queue (which records the price and transaction volume sequence within the preset window, calculates the maximum increase change, maximum decrease change, and transaction volume ratio within the window), and aggregates historical submission and transaction records from multiple accounts, etc., to update the statistical indicators of each asynchronous rule in real time and determine whether a risk has been triggered.
[0038] In this way, the asynchronous computing layer utilizes the deterministic message order of the ordered pipeline and the on-demand indexing mechanism to achieve efficient and low-memory-consumption statistical computing, making the complete calculation of asynchronous rules completely independent of the transaction chain.
[0039] In some embodiments, the asynchronous computing layer feeds back the risk control status to the synchronous decision layer based on the calculation result, including: the asynchronous computing layer determining whether the calculation result meets the preset risk triggering conditions, the risk triggering conditions including at least one of the following: the calculation result is greater than a preset threshold, the rate of change of the calculation result is greater than a preset rate of change, and the statistical pattern matches a preset risk pattern; when the calculation result meets the risk triggering conditions, the asynchronous computing layer sets the corresponding risk control status to an interception status and sends the interception status to the synchronous decision layer, so that the synchronous decision layer updates the risk control status table based on the interception status and intercepts subsequent applications of the controlled object corresponding to the interception status.
[0040] Specifically, after completing the statistical calculations for each asynchronous rule and obtaining the corresponding statistical indicators (i.e., calculation results), the statistical calculation module of the asynchronous calculation layer further determines whether the statistical indicator meets the preset risk triggering conditions of the corresponding asynchronous rule. Taking the large transaction monitoring rule as an example, the asynchronous calculation layer records the price sequence and transaction volume sequence within a preset window in the market incremental queue, calculates the price increase change and transaction volume ratio within the window, and determines that the risk triggering condition is met when both exceed their respective preset thresholds. Taking the abnormal order cancellation frequency monitoring rule as an example, the asynchronous calculation layer counts the number of order cancellations and the proportion of cancellations to the number of orders within the statistical window. When the order cancellation frequency exceeds the preset threshold, it determines that the risk triggering condition is met. Taking the false order identification rule as an example, the asynchronous calculation layer analyzes the transaction ratio and cancellation behavior pattern of multiple orders. When the statistical pattern matches the preset risk pattern, it determines that the risk triggering condition is met. Taking the price manipulation monitoring rule as an example, the asynchronous calculation layer aggregates all investor account indicators associated with the same risk control rule for correlation analysis. When the joint behavior pattern of multiple accounts matches the preset risk pattern, it determines that the risk triggering condition is met. Once the risk trigger condition is met, the asynchronous calculation layer sets the corresponding risk control status to an intercept status through its result pushback module and sends this intercept status to the synchronous judgment layer. Upon receiving the intercept status, the synchronous judgment layer queries the risk control status table using the corresponding risk control rule identifier and securities code as keys, updating the corresponding record to the intercept status. Subsequently, when subsequent applications for the same controlled object arrive at the synchronous judgment layer, the rule execution module reads the intercept status during the table lookup judgment, intercepts the application, and returns the corresponding error code, thus achieving a real-time control closed loop of detection and interception.
[0041] Understandably, when the calculation result does not meet the risk triggering conditions, the asynchronous calculation layer will continue to maintain the corresponding risk control status as the release status or set it to the release status, and send the release status to the synchronous judgment layer so that the synchronous judgment layer can maintain or update the corresponding record in the risk control status table according to the release status, thereby continuing to release subsequent declarations of the controlled object.
[0042] In this way, the asynchronous computing layer continuously performs statistical calculations on the asynchronous rules and provides real-time feedback on the risk control status. The synchronous judgment layer dynamically updates the risk control status table based on the received risk control status, so that the risk control status can be dynamically adjusted in real time according to market trading conditions.
[0043] In some embodiments, the asynchronous computing layer feeds back the risk control status to the synchronous decision layer based on the calculation result. The asynchronous computing layer further includes: determining whether the calculation result meets preset recovery conditions. Recovery conditions include at least one of the following: the calculation result is less than or equal to a preset threshold; the historical message sequence on which the statistical calculation is based exceeds a preset time range; or the transaction behavior of the controlled object returns to normal. When the calculation result meets the recovery conditions, the asynchronous computing layer sets the corresponding risk control status to a release status and sends the release status to the synchronous decision layer, so that the synchronous decision layer updates the risk control status table based on the release status and restores the release status for subsequent applications from the controlled object corresponding to the release status.
[0044] Specifically, after setting the risk control status to the interception state, the statistical calculation module of the asynchronous computing layer continues to perform statistical calculations on subsequent inflows of orderly transaction messages and continuously updates statistical indicators. When the statistical indicators change as the time window slides or new messages flow in, the asynchronous computing layer determines whether the updated statistical indicators meet the recovery conditions preset by the corresponding asynchronous rule. Taking the large transaction monitoring rule as an example, when the statistical window slides forward, the price increase change and the proportion of transaction amount within the historical window gradually decline. When both fall below their respective preset thresholds, the recovery condition is determined to be met. Taking the abnormal order cancellation frequency monitoring rule as an example, when the preset time window slides forward, the number of order cancellations and the proportion of order cancellations within the window fall below the preset threshold, the recovery condition is determined to be met. Taking rules that require matching preset risk patterns, such as false declaration identification or price manipulation monitoring, when the statistical pattern of transaction behavior within the window no longer matches the preset risk pattern after the statistical window slides forward, the recovery condition is determined to be met. Once the recovery conditions are met, the asynchronous calculation layer sets the corresponding risk control status to a release status through its result pushback module and sends this release status to the synchronous judgment layer. Upon receiving the release status, the synchronous judgment layer queries the risk control status table using the corresponding risk control rule identifier and securities code as keys, updating the corresponding record to the release status. Subsequently, when subsequent applications from the same controlled object arrive at the synchronous judgment layer, the rule execution module reads the release status during the table lookup judgment, thus restoring the release status for that application and allowing it to pass normally.
[0045] As can be seen from the above, the securities trading risk control method provided in this application divides risk control rules into synchronous rules and asynchronous rules, and constructs a synchronous judgment layer deployed within the application chain and an asynchronous calculation layer deployed outside the chain. This allows computationally intensive asynchronous rules to be moved entirely out of the application chain, avoiding heavyweight statistical calculations from occupying the application processing path, thereby solving the problem of linear growth in latency with the number of statistical rules in a fully synchronous route. Simultaneously, by coupling the synchronous judgment layer and the asynchronous calculation layer through ordered pipeline and risk status recording, the asynchronous calculation layer subscribes to the ordered pipeline bypass replay calculation and feeds back the risk status in real time. The synchronous judgment layer updates the risk control status table, enabling the statistical calculation results of asynchronous rules to be applied to the synchronous judgment layer in real time. This provides immediate interception for subsequent applications from the same controlled object, overcoming the shortcomings of delayed violation detection and inability to form a real-time control loop in purely post-event monitoring. Thus, without significantly increasing the latency burden on the transaction link, computationally intensive statistical risk control rules can provide real-time control over ongoing transaction applications. It also supports dynamic adjustment of risk control strategies and system fault tolerance recovery, thereby achieving an organic unity of low link latency, high processing efficiency, and high operational flexibility in the pre-event risk control process of securities trading.
[0046] Furthermore, as Figure 1 In terms of specific implementation, this application provides a securities trading risk control system, such as... Figure 2 As shown, the system includes: The partitioning module 201 is used to divide risk control rules into synchronous rules and asynchronous rules; Module 202 is used to build a synchronous judgment layer and an asynchronous calculation layer. The synchronous judgment layer is deployed on the reporting link between the client and the exchange, and the asynchronous calculation layer is deployed outside the reporting link. The synchronous judgment layer and the asynchronous calculation layer are coupled through ordered flow and risk status recording. The judgment module 203, integrated into the synchronous judgment layer, is used to make a judgment based on the information of the transaction declaration when the current transaction declaration is received if the transaction declaration triggers the synchronous rule, and to make a judgment based on the risk control status table if the transaction declaration triggers the asynchronous rule. The transaction release module 204, integrated into the synchronous judgment layer, is used to write transaction declarations that are judged to be approved into the ordered transaction log and release them to the outside world. The calculation feedback module 205, integrated into the asynchronous calculation layer, is used to subscribe to the ordered flow, perform statistical calculations on the asynchronous rules based on the messages in the ordered flow, and feed back the risk control status to the synchronous judgment layer based on the calculation results, so that the synchronous judgment layer can update the risk control status table according to the risk control status.
[0047] This application also provides a computer device, which may specifically be a personal computer, a server, a network device, etc. Figure 3 As shown, the computer device includes a bus, a processor, memory, and a communication interface, and may also include an input / output interface and a display device. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores location information. The network interface allows communication with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps in the various method embodiments.
[0048] Those skilled in the art will understand that Figure 3 The structure shown is only a part of the structure related to the present application and does not constitute a limitation on the computer device on which the present application is applied. The specific computer device may include more or fewer components, or combine certain components, or have different component arrangements.
[0049] In one embodiment, a computer-readable storage medium is provided, which may be non-volatile or volatile, having stored thereon a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0050] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0051] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0052] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0053] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for controlling risks in securities trading, characterized in that, include: Risk control rules are divided into synchronous rules and asynchronous rules; A synchronous decision-making layer and an asynchronous calculation layer are constructed. The synchronous decision-making layer is deployed on the reporting link between the client and the exchange, and the asynchronous calculation layer is deployed outside the reporting link. The synchronous decision-making layer and the asynchronous calculation layer are coupled through ordered flow and risk status recording. When the synchronous judgment layer receives the current transaction declaration, if the transaction declaration triggers the synchronous rule, it makes a judgment based on the information of the transaction declaration; if the transaction declaration triggers the asynchronous rule, it makes a judgment based on the risk control status table. The synchronous judgment layer writes the transaction declarations that are judged to be approved into the ordered flow and publishes them to the outside world. The asynchronous computing layer subscribes to the ordered flow, performs statistical calculations on the asynchronous rules based on the messages in the ordered flow, and feeds back the risk control status to the synchronous decision layer based on the calculation results, so that the synchronous decision layer updates the risk control status table based on the risk control status.
2. The securities trading risk control method according to claim 1, characterized in that, The division of risk control rules into synchronous rules and asynchronous rules includes: Rules that can be calculated based on a single declaration are defined as synchronous rules; The rules for statistical calculations based on historical message sequences are defined as asynchronous rules.
3. The securities trading risk control method according to claim 1, characterized in that, If the transaction declaration triggers the synchronous rule, a determination is made based on the information in the transaction declaration; if the transaction declaration triggers the asynchronous rule, a determination is made based on the risk control status table, including: If the risk control rule is the synchronization rule, the synchronization determination layer verifies the transaction declaration information and outputs the determination result of the transaction declaration based on the verification result. If the risk control rule is the asynchronous rule, the synchronous judgment layer queries the risk control status table using the risk control rule identifier and securities code corresponding to the transaction declaration as keys, obtains the corresponding risk control status in the risk control status table, and outputs the judgment result of the transaction declaration based on the risk control status.
4. The securities trading risk control method according to claim 1, characterized in that, The synchronous judgment layer writes the transaction declarations that are deemed acceptable into the ordered transaction log and publishes them externally, including: The synchronous determination layer writes the declaration messages that are determined to be approved into the ordered pipeline in the order of arrival, assigns a sequence number to each declaration message, and publishes the ordered pipeline carrying the sequence number to the outside world.
5. The securities trading risk control method according to claim 1, characterized in that, The method further includes: The synchronization determination layer also writes the return messages returned by the exchange into the ordered transaction log in the order of arrival, and publishes the ordered transaction log to the outside world.
6. The securities trading risk control method according to claim 4, characterized in that, The asynchronous computing layer subscribes to the ordered pipeline and performs statistical calculations on the asynchronous rules based on the messages in the ordered pipeline, including: The asynchronous computing layer reads the messages in the ordered flow sequentially according to the sequential number carried by the ordered flow, and establishes a rule index indexed by the target account and securities code; When a read message matches the rule index and the corresponding rule instance does not exist, a corresponding rule instance is created, and the statistical calculation of the corresponding asynchronous rule is performed through the rule instance.
7. The securities trading risk control method according to claim 6, characterized in that, The asynchronous computation layer feeds back the risk control status to the synchronous decision layer based on the computation results, including: The asynchronous computing layer determines whether the calculation result meets the preset risk triggering conditions. The risk triggering conditions include at least one of the following: the calculation result is greater than a preset threshold, the change rate of the calculation result is greater than a preset change rate, and the statistical pattern matches a preset risk pattern. When the calculation result meets the risk triggering condition, the asynchronous calculation layer sets the corresponding risk control status to the interception status and sends the interception status to the synchronous judgment layer, so that the synchronous judgment layer updates the risk control status table according to the interception status and intercepts the subsequent declarations of the control object corresponding to the interception status.
8. The securities trading risk control method according to claim 7, characterized in that, The asynchronous computation layer feeds back the risk control status to the synchronous decision layer based on the computation results, and also includes: The asynchronous computing layer determines whether the calculation result meets the preset recovery conditions. The recovery conditions include at least one of the following: the calculation result is less than or equal to the preset threshold, the historical message sequence on which the statistical calculation is based exceeds the preset time range, and the transaction behavior of the controlled object returns to the normal mode. When the calculation result meets the recovery condition, the asynchronous calculation layer sets the corresponding risk control status to the release status and sends the release status to the synchronous judgment layer, so that the synchronous judgment layer updates the risk control status table according to the release status and restores the release for subsequent applications of the controlled object corresponding to the release status.
9. A securities trading risk control system, characterized in that, include: The partitioning module is used to divide risk control rules into synchronous rules and asynchronous rules; The module is used to build a synchronous decision layer and an asynchronous calculation layer. The synchronous decision layer is deployed on the reporting link between the client and the exchange, and the asynchronous calculation layer is deployed outside the reporting link. The synchronous decision layer and the asynchronous calculation layer are coupled through ordered flow and risk status recording. The synchronous determination layer is used to determine the transaction based on the information of the transaction when it receives the current transaction declaration. If the transaction declaration triggers the synchronous rule, the layer determines the transaction declaration based on the risk control status table. And to write the transaction declarations that are deemed approved into the orderly transaction log and release them to the public; The asynchronous computing layer is used to subscribe to the ordered flow, perform statistical calculations on the asynchronous rules based on the messages in the ordered flow, and feed back the risk control status to the synchronous judgment layer based on the calculation results, so that the synchronous judgment layer updates the risk control status table based on the risk control status.
10. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 8.
