CN116611926A - Wind control rule management control method, device and system and storage medium - Google Patents

Wind control rule management control method, device and system and storage medium Download PDF

Info

Publication number
CN116611926A
CN116611926A CN202310657726.1A CN202310657726A CN116611926A CN 116611926 A CN116611926 A CN 116611926A CN 202310657726 A CN202310657726 A CN 202310657726A CN 116611926 A CN116611926 A CN 116611926A
Authority
CN
China
Prior art keywords
wind control
rule
control rule
order information
syntax tree
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310657726.1A
Other languages
Chinese (zh)
Inventor
龚畅优
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202310657726.1A priority Critical patent/CN116611926A/en
Publication of CN116611926A publication Critical patent/CN116611926A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing

Abstract

The invention provides a method, a device, a system and a storage medium for managing and controlling wind control rules, and relates to the technical fields of financial science and technology and data analysis. The wind control rule management control method comprises the following steps: constructing an abstract syntax tree by using a syntax parsing tool; loading wind control rules based on the abstract syntax tree to form AST form rules corresponding to the abstract syntax tree; and determining the corresponding wind control rule according to the order information, and accessing the node value in the abstract syntax tree of the AST form rule by utilizing a displayer method. The invention creates the wind control rule engine based on the grammar analysis tool, configures the threshold value, the range and the like of the rule in the interface, does not need to modify codes each time to realize, improves the efficiency and reduces the risk.

Description

Wind control rule management control method, device and system and storage medium
Technical Field
The invention relates to the technical field of financial science and technology and data analysis, in particular to a method, a device, a system and a storage medium for managing and controlling wind control rules.
Background
The financial domain of the wind control rules engine is a software system for monitoring and managing risk in the financial market. It automatically identifies, evaluates and processes potential risk events based on a series of rules and algorithms to protect the interests of financial institutions and investors. Typically, the wind control rules engine will use real-time data to govern transactions, such as price, quantity, cost, etc., while taking into account various factors, such as market fluctuations, credit risk, liquidity risk, operational risk, etc. The wind control rules engine may be applied to a variety of financial products and markets, including stocks, futures, foreign exchanges, bonds, derivatives, and the like.
At present, the screening conditions of the wind control rule orders of the foreground transaction system are high in complexity, large in dimension, large in index, large in threshold and complex in aggregation rule.
The method is characterized in that:
1. the complexity of the order screening conditions is high, and the screening conditions are multiple conditions such as OR, AND, NOT, containing and the like and are used in combination;
2. the dimension is more, and the screening conditions comprise a trade center, a product, a trade direction and the like;
3. the index and the corresponding threshold value are more, including single order limit, dv01 limit, integer multiple limit and bin holding limit;
4. the aggregation rules are complex, such as dv01 distinguishing bonds, interest rate interchange, precious metal futures and the like, and the statistics are combined after the calculation of holding bins respectively. For example, the withdrawal ratio of the cash register needs to count each transaction account, the order and the withdrawal amount of each product respectively, and finally the withdrawal ratio is calculated respectively.
Disclosure of Invention
In view of the above, the present invention provides a method for managing and controlling wind control rules applied to the field of financial science and technology or related technical fields of the field of financial science and technology, comprising:
constructing an abstract syntax tree by using a syntax parsing tool;
loading all wind control rules based on the abstract syntax tree to form AST form rules corresponding to the abstract syntax tree;
and determining the corresponding wind control rule according to the order information, and accessing the node value in the abstract syntax tree of the AST form rule by utilizing a displayer method so as to determine the feasibility of the wind control rule corresponding to the order information.
Preferably, before the constructing the abstract syntax tree by using the syntax parsing tool, the method further comprises:
triggering a wind control rule construction flow according to the creation instruction;
according to the wind control rule construction flow, obtaining the wind control name and category of the wind control rule;
acquiring the corresponding action range information of the wind control names and the categories, and determining corresponding wind control template information;
and acquiring corresponding wind control screening conditions and wind control thresholds based on the wind control template information to obtain the wind control rule.
Preferably, the determining the corresponding wind control rule according to the order information, and accessing the node value in the abstract syntax tree of the AST form rule by using a motormeter method so as to determine the feasibility of the wind control rule corresponding to the order information includes:
acquiring the order information to determine the corresponding wind control rule;
traversing the AST form rule, and accessing the node value of each word sequence in the AST form rule by using a monitor method to return a result to determine the feasibility of the wind control rule corresponding to the order information.
Preferably, the accessing the node value of each word sequence in the AST form rule by using a monitor method to return a result to determine feasibility of a wind control rule corresponding to the order information includes:
acquiring attribution information corresponding to the order information;
judging whether the order information belongs to the action range information according to the attribution information;
if the order information belongs to the action range information, determining that the order information belongs to a department and/or a trading desk in the action range information, and determining the feasibility of the wind control rule corresponding to the order information based on the returned result.
Preferably, after the determining that the order information belongs to the department and/or the transaction table within the scope information, the method further includes:
acquiring transaction element information corresponding to the order information;
judging whether the transaction element information accords with wind control screening conditions or not;
and if the transaction element information accords with the wind control screening condition, determining the feasibility of the wind control rule corresponding to the order information based on the return result.
Preferably, after the transaction element information meets the wind control screening condition, the method further comprises:
judging whether the order information can trigger the wind control threshold value or not;
if the order information can trigger the wind control threshold value, judging that a wind control rule corresponding to the order information is not feasible;
if the order information cannot trigger the wind control threshold, judging that the wind control rule corresponding to the order information is feasible.
Preferably, the constructing an abstract syntax tree by using a syntax parsing tool includes:
defining grammar rules of the grammar parsing tool;
generating parser code based on the grammar rules using the grammar parsing tool;
creating node classes in the abstract syntax tree;
defining a displayer method corresponding to the node class and the node class;
in the parser code, the node class and the initiator method are combined, and the abstract syntax tree is constructed by using the syntax parsing tool.
In addition, in order to solve the above problem, the present invention further provides a wind control rule management control device, including:
the construction module is used for constructing an abstract syntax tree by using a syntax parsing tool;
the loading module is used for loading all wind control rules based on the abstract syntax tree to form AST form rules corresponding to the abstract syntax tree;
the determining module is used for determining the corresponding wind control rule according to the order information, and accessing the node value in the abstract syntax tree of the AST form rule by utilizing a displayer method so as to determine the feasibility of the wind control rule corresponding to the order information.
In addition, in order to solve the above problems, the present invention further provides an air control rule management control system, which includes a memory and a processor, wherein the memory stores an air control rule management control program, and the processor runs the air control rule management control program to make the air control rule management control system execute the air control rule management control method as described above.
In addition, in order to solve the above problem, the present invention further provides a computer readable storage medium, where a wind control rule management control program is stored, where the wind control rule management control program implements the wind control rule management control method described above when executed by a processor.
The invention provides a method, a device, a system and a storage medium for managing and controlling wind control rules, wherein the method comprises the following steps: constructing an abstract syntax tree by using a syntax parsing tool; loading all wind control rules based on the abstract syntax tree to form AST form rules corresponding to the abstract syntax tree; and determining the corresponding wind control rule according to the order information, and accessing the node value in the abstract syntax tree of the AST form rule by utilizing a displayer method so as to determine the feasibility of the wind control rule corresponding to the order information. The invention creates the wind control rule engine based on the grammar analysis tool, configures the threshold value, the range and the like of the rule in the interface, does not need to modify codes each time to realize, improves the efficiency and reduces the risk.
Drawings
FIG. 1 is a schematic structural diagram of a hardware operating environment according to an embodiment of the wind control rule management control method of the present invention;
FIG. 2 is a flowchart of an embodiment 1 of a method for controlling wind control rule management according to the present invention;
FIG. 3 is a flowchart illustrating the supplementary steps before step S100 in embodiment 2 of the wind control rule management control method according to the present invention;
FIG. 4 is a flowchart illustrating the refinement of step S300 in embodiment 2 of the wind control rule management control method according to the present invention;
FIG. 5 is a flowchart illustrating refinement of step S320 in embodiment 2 of the wind control rule management control method according to the present invention;
FIG. 6 is a flowchart illustrating the steps after step S323 in the embodiment 2 of the wind control rule management control method according to the present invention;
FIG. 7 is a schematic diagram of connection and flow of functional modules of the wind control rule management control method according to the embodiment 2 of the present invention, wherein the supplementary steps follow the step S326;
FIG. 8 is a flowchart illustrating the refinement of step S100 in embodiment 3 of the wind control rule management control method according to the present invention;
fig. 9 is a schematic diagram of module connection of the wind control rule management control device according to the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
Embodiments of the present invention are described in detail below, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the present invention, the meaning of "a plurality" is two or more, unless explicitly defined otherwise.
In the present invention, unless explicitly specified and limited otherwise, the terms "mounted," "connected," "secured," and the like are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally formed; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communicated with the inside of two elements or the interaction relationship of the two elements. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art according to the specific circumstances.
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Fig. 1 is a schematic structural diagram of a hardware operating environment of a terminal according to an embodiment of the present invention.
The wind control rule management control system of the embodiment of the invention can be a PC, a mobile terminal device such as a smart phone, a tablet computer or a portable computer, and the like. The wind control rule management control system may include: a processor 1001, e.g. a CPU, a network interface 1004, a user interface 1003, a memory 1005 and a communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a display screen, an input unit such as a keyboard, a remote control, and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a stable memory such as a disk memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above. Optionally, the wind control rule management control system may further include an RF (Radio Frequency) circuit, an audio circuit, a WiFi module, and the like. In addition, the wind control rule management control system can be further provided with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor and the like, and the detailed description is omitted.
Those skilled in the art will appreciate that the air control rule management control system shown in FIG. 1 is not limiting and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components. As shown in fig. 1, an operating system, a data interface control program, a network connection program, and an air control rule management control program may be included in a memory 1005 as one type of computer-readable storage medium.
In a word, the invention creates the wind control rule engine based on the grammar analysis tool, configures the threshold value, the range and the like of the rule in the interface, does not need to modify codes each time to realize, improves the efficiency and reduces the risk.
Example 1:
referring to fig. 2, embodiment 1 of the present invention provides a method for managing and controlling wind control rules, including:
step S100, constructing an abstract syntax tree by using a syntax parsing tool;
the above-mentioned grammar parsing tool is a software tool for parsing an inputted text or code into a grammar tree or other data structure, so that a program can perform more deep analysis and processing thereof. They are commonly used in compiler, interpreter, static analyzer, etc. applications.
The syntax parsing tools mentioned in this embodiment may include, but are not limited to ANTLR, bison, javaCC and peg.js, etc.
In this embodiment, ANTLR is used as a syntax analysis tool.
As described above, ANTLR (ANother Tool for Language Recognition) is a popular grammar parsing tool that supports multiple languages (including Java, c++, python, etc.) and platforms, and has the following features:
(1) Automatically generating a parser: ANTLR converts the input grammar rules into a parser of Java or other target language without having to manually write the parser code.
(2) Support a variety of parsing techniques: ANTLR supports various analysis techniques such as recursive descent, LL (x), LR (k), and the like, and can select the most appropriate technique as needed.
(3) Generating grammar error information with good readability: the ANTLR-generated parser can detect illegal syntax structures and generate error information that is easy to understand.
(4) Support nesting of grammar files: ANTLR supports combining multiple grammar files together so that common grammar rules can be easily reused.
(5) Has wide community support: ANTLR has a huge community of users and active communities, provides rich documents, example code, and extension plug-ins, and can help developers build syntax parsers faster.
The abstract syntax tree (Abstract Syntax Tree, AST) is a tree-shaped data structure that the programming language converts source code into a computer that is easy to understand and process during compilation or interpretation. It is a tree-like structure in which each node represents a syntax element in the original code, such as variables, functions, operators, etc.
Abstract syntax trees are typically constructed by analyzing source code, identifying various syntax structures in the source code, and attempting to translate them into a series of interrelated nodes. The nodes are connected by different types of edges to represent hierarchies and dependencies in the source code.
Unlike source code, the abstract syntax tree ignores some details and syntax rules, so it is more abstract and generalized. The method can be used in the fields of compiler optimization, code generation, static analysis and the like, and is one of important tools for program analysis and conversion.
In the compiler, an abstract syntax tree (Abstract Syntax Tree, AST) is a data structure generated from source code. It is a tree structure that represents the source code of a program and plays an important role in the compiler.
An abstract syntax tree, generated by a syntax Parser (Parser), can break the source code into smaller, more manageable parts and construct an AST node for each part. These nodes represent different elements in the grammar rules, such as expressions, function calls, variable declarations, etc. Relationships between nodes describe the hierarchy and dependencies between them.
By building an abstract syntax tree, a compiler can better understand the meaning of source code and can perform operations such as semantic analysis and code generation. In addition, the abstract syntax tree can be used for realizing functions of a code editor, intelligent prompt and the like, and has wide application in code development.
The process of constructing an abstract syntax tree is a process of parsing source code into syntax trees. It involves lexical and grammatical analysis of source code, which is then converted into a tree structure using a parser. The resulting abstract syntax tree is an abstract representation for the source code, facilitating further processing and analysis.
In step S100, an AST is created based on antlr, which is used to parse the inputted rule into a syntax tree and provide a mechanism for accessing these nodes. The implementation needs to implement the initiator method for each operator respectively, so that different operators can be processed in the subsequent rule matching process.
Step S200, loading all wind control rules based on the abstract syntax tree to form AST form rules corresponding to the abstract syntax tree;
step S300, determining a corresponding wind control rule according to order information, and accessing a node value in the abstract syntax tree of the AST form rule by using a monitor method so as to determine the feasibility of the wind control rule corresponding to the order information.
All rules are loaded during service initialization, and this part of work can be completed at system start-up, and the parsed AST (i.e. AST form rules) is stored for use during query.
And further, after order information provided by the user is obtained, determining a corresponding wind control rule according to the order information, and screening the wind control rule. Therefore, the node values in the abstract syntax tree of the AST form rule are accessed by using a displayer method so as to determine the feasibility of the wind control rule corresponding to the order information.
In short, the wind control rule engine is created based on the grammar parsing tool, and the threshold value, the range and the like of the rule are configured in the interface, so that the implementation of modifying codes every time is not needed, the efficiency is improved, and the risk is reduced.
Example 2:
referring to fig. 3, embodiment 2 of the present invention provides a method for managing and controlling wind control rules, which is based on embodiment 1 described above. The step S100, before constructing the abstract syntax tree by using the syntax parsing tool, further includes:
step S400, triggering a wind control rule construction flow according to the creation instruction;
step S500, according to the wind control rule construction flow, obtaining the wind control name and category of the wind control rule;
step S600, acquiring the wind control name and the corresponding action range information of the category, and determining the corresponding wind control template information;
and step S700, acquiring corresponding wind control screening conditions and wind control thresholds based on the wind control template information, and obtaining the wind control rule.
The user can create the wind control rule on the platform.
When creating, the creation instruction can be triggered to be generated, and the construction flow is started according to the instruction.
In the above construction process, various information needs to be acquired and set.
For example, the following procedure is possible:
1. setting a wind control name and determining a corresponding category;
2. setting a wind control throwing group, namely action range information, as a scope;
3. selecting a wind control template, namely wind control template information;
4. setting a wind control rule screening condition, namely criterion;
5. setting a wind control threshold;
thus obtaining the constructed wind control rule.
Further, referring to fig. 4, the step S300 of determining the corresponding wind control rule according to the order information, and accessing the node value in the abstract syntax tree of the AST form rule by using a monitor method so as to determine the feasibility of the wind control rule corresponding to the order information includes:
step S310, acquiring the order information to determine the corresponding wind control rule;
and triggering the evaluation and screening flow aiming at the wind control rule according to the order information submitted by the user.
The order information can determine the wind control rule for the user according to the order information.
Step S320, traversing the AST form rule, and accessing the node value of each word sequence in the AST form rule by using a motormeter method, so as to return a result to determine the feasibility of the wind control rule corresponding to the order information.
When a transaction user places an order, traversing the wind control rule, accessing the node value of each word sequence in the AST form rule by using a motormeter method, and determining whether the operation is feasible or not by returning a value.
Further, referring to fig. 5, the step S320 of accessing the node value of each word sequence in the AST form rule by using a monitor method to return a result to determine feasibility of the wind control rule corresponding to the order information includes:
step S321, obtaining attribution information corresponding to the order information;
step S322, judging whether the order information belongs to the action range information according to the attribution information;
step S323, if the order information belongs to the action range information, determining that the order information belongs to a department and/or a trading desk in the action range information, and determining feasibility of the wind control rule corresponding to the order information based on the returned result.
When the transaction user orders, the wind control rule is traversed, the scope (action range information) is checked first to see whether the current order information belongs to the department and/or the transaction platform of the rule, if not, the current order information is skipped directly.
In the above steps, it is necessary to traverse the wind control rule and check whether the current order belongs to the department and exchange of the rule, i.e. the attribution situation. This process may be implemented by the following logic steps:
traversing the wind control rule, and executing the following operations on the wind control rule:
the scope attribute of the rule is checked to determine if its affiliated department and exchange match the current order.
If so, the AST created by antlr is used to parse the criterion attribute of the rule and convert it to an executable bootean expression.
It is checked whether the bootan expression is true. If yes, the order meets the screening condition of the rule, and the next step is continuously executed; otherwise, the rule is skipped.
If all rules have been traversed and no matching rule is found, the order fails the pneumatic screening and no order is allowed.
In the above procedure, it is necessary to parse the criterion attribute of the rule using the AST created by ANTLR and convert it into an executable bootean expression. Therefore, the screening conditions of the rules can be converted into codes which can be understood and executed by a computer, and whether the order meets the screening conditions can be conveniently judged. At the same time, care must be taken to follow a certain order when traversing the rules to ensure that all rules are properly checked.
Further, referring to fig. 6, after determining that the order information belongs to the department and/or the transaction table in the scope information in step S323, the method further includes:
step S324, transaction element information corresponding to the order information is obtained;
step S325, judging whether the transaction element information accords with wind control screening conditions;
step S326, if the transaction element information accords with the wind control screening condition, determining the feasibility of the wind control rule corresponding to the order information based on the return result.
The trade factor of the order is determined whether or not criterion is satisfied.
The form thereof may be, for example:
"Instrument_class in ('BOND') and instrument_subs in ('LGB'), and judging whether the order meets the product BOND or not by using the analysis rule of 1, and judging whether the order is a local institution BOND or not.
Aiming at the steps, the method needs to analyze the transaction elements in the order and match with the screening conditions defined in the rules so as to judge whether the order meets the requirement of the rules. The specific implementation steps are as follows:
(1) The regular character string is converted into an Abstract Syntax Tree (AST) using an ANTLR generation lexical and grammatical parser.
(2) The scope and criterion node information of the rule is obtained from AST, and is analyzed and stored. The scope node comprises department and transaction table information to which the rule is applicable; the criterion node contains screening conditions, i.e., constraints on the transaction elements that the order needs to satisfy.
(3) And analyzing the information of the order transaction elements, such as the information of the product types, the sub-types and the like in the order.
(4) And matching the order transaction elements with screening conditions in the rules, and judging whether the order meets the rule requirements. An ANTLR generated monitor method may be used to traverse an AST, with matching logic implemented by invoking a different monitor method for each expression node.
(5) And if the order meets the rule requirement, allowing the order, otherwise, refusing the order.
It should be noted that in implementing the above steps, it is necessary to consider that a rule may include a plurality of conditions, and that logical operators (e.g. and, or, etc.) may exist between the conditions. Therefore, the matching results of the respective conditions need to be combined using boolean logic operators in the matching process to obtain the final matching result. In addition, in order to improve the matching efficiency, rules and order transaction elements can be preprocessed, common condition values are cached in advance, and repeated analysis and comparison are avoided.
Further, referring to fig. 7, in step S326, after the transaction element information meets the wind control screening condition, the method further includes:
step S327, judging whether the order information can trigger the wind control threshold;
step S328, if the order information can trigger the wind control threshold, judging that the wind control rule corresponding to the order information is not feasible;
step S329, if the order information cannot trigger the wind control threshold, determining that the wind control rule corresponding to the order information is feasible.
And judging whether the order triggers the threshold or not according to the judgment of the wind control threshold, and if so, not allowing the order to be placed.
In the wind control rule, the threshold may refer to a limit of data such as accumulated transaction amount or amount over a certain period. For example: a department or exchange can only trade 100 tens of thousands of dollars of products in one month, and if this limit is exceeded, the department or exchange's transaction rights will be suspended or cancelled. This limitation is a threshold.
For order screening, if an order involves a department or exchange, then the threshold information for that department or exchange needs to be involved in the risk assessment of the order. When the aggregate amount reaches a certain threshold, the order is rejected. The specific threshold value can be set according to actual conditions.
In the above step, it is necessary to determine whether the order triggers the wind control threshold, and if so, the order is not allowed. The specific implementation logic is as follows:
(1) Traversing all the wind control rules to find the rules related to the order.
(2) For each matched rule, threshold information and accumulated amount information thereof are acquired.
(3) And judging whether the transaction elements of the order meet the screening conditions of the rule, and if not, skipping the rule.
(4) If the screening conditions are met, the elements of interest for the rule are obtained from the order and accumulated.
(5) Checking whether the accumulated quantity exceeds the threshold value of the rule, if so, rejecting the order and returning a reject reason; otherwise, go on traversing other rules.
(6) If all rules have been traversed and no threshold for any rule has been triggered, the order is accepted and a success message is returned.
It should be noted here that, in order to avoid repetition of counting, when processing an order, the order should be first de-duplicated with the already matched rule, and only the non-matched rule should be counted. Meanwhile, in the case of performing the accumulation operation, security problems in the concurrent case should be considered, and the thread-safe data structure may be used to store the accumulated amount information of each rule.
The execution of the above step S300 may achieve the following technical effects:
(1) The wind control rules can be described by using unified grammar, so that the condition that different developers adopt different modes to realize the wind control rules is avoided, and the maintainability and expandability of the rules are improved.
(2) The AST generated by the ANTLR can conveniently analyze and process the wind control rule, and the complexity of code implementation is greatly simplified.
(3) By loading the wind control rules into the service and processing the wind control rules when the transaction user places an order, real-time risk assessment can be realized, and risk transaction can be intercepted in time.
(4) The strict order screening process can avoid malicious or wrong transactions, and ensures the safety and stability of a transaction system.
In a word, the execution of the steps can help the transaction system to carry out comprehensive, accurate and rapid risk assessment, prevent various potential risks and improve the reliability and safety of the transaction system. According to the method provided by the embodiment, the wind control rule engine is created based on the grammar analysis tool, and the threshold value, the range and the like of the rule are configured in the interface, so that the implementation of modifying codes each time is not needed, the efficiency is improved, and the risk is reduced; the visual interface is provided, so that operators and developers can intuitively know the existing wind control rules; abstract the concepts of scope and criterion, and control the action range of the wind control rule, and is more concise and clearer than a specific filter in the code.
Example 3:
referring to fig. 8, embodiment 3 of the present invention provides a method for managing and controlling wind control rules, based on embodiment 1 above, the step S100 of constructing an abstract syntax tree using a syntax parsing tool includes:
step S110, defining grammar rules of the grammar parsing tool;
step S120, generating a parser code based on the grammar rules by using the grammar parsing tool;
step S130, creating node classes in the abstract syntax tree;
step S140, defining a motormeter method corresponding to the node class and the node class;
and step S150, combining the node class and the initiator method in the parser code, and constructing the abstract syntax tree by using the syntax parsing tool.
The process of constructing the abstract syntax tree is the process of parsing the source code into the syntax tree. It involves lexical and grammatical analysis of source code, which is then converted into a tree structure using a parser. The resulting abstract syntax tree is an abstract representation for the source code, facilitating further processing and analysis.
For example, an abstract syntax tree is constructed, the steps of which can be as follows:
(1) Syntax rules defining ANTLR: first, a set of wind control rules that conform to the ANTLR grammar rules needs to be defined so that the ANTLR can correctly parse the rule text. Defining grammar rules requires compliance with the ANTLR grammar specification, for example using ": "represents a relationship between a rule name and an expression; the use of "|" indicates a relationship between a plurality of options, and so on.
(2) Using ANTLR to generate parser code: by running the ANTLR tool, a corresponding parser code may be automatically generated, which may read the rule text and convert it into an AST structure.
(3) Creating an AST node: when ANTLR parses the rule, the rule text is converted into an abstract syntax tree. Each node represents a rule element such as an operator, operand, variable name, etc. It is necessary to create corresponding AST node classes for representing different types of AST nodes and implement a series of methods for these node classes, such as an access method, a judgment method, etc.
(4) The method for realizing the initiator comprises the following steps: for an already defined AST node, a monitor method needs to be implemented, which is used to traverse the AST tree node, access different types of nodes, and perform corresponding operations. Where the visit method is used to process a single node and the visitChildren method is used to traverse all children of the node.
(5) Generating AST: in the parser code, an AST node class and a initiator method need to be combined, and a complete abstract syntax tree is constructed by using a syntax tree construction tool provided by ANTLR. Finally, the wind control rule can be judged and processed by using the generated AST.
The steps can help realize the process of converting the wind control rule text into executable and evaluable codes. In particular, the ANTLR tool can help define and parse the grammar of the wind control rules and generate corresponding parser codes, while an abstract grammar tree (AST) can help convert rule text into an easily handled, executable data structure.
Through the technologies, a self-defined wind control rule engine can be realized, and rules can be quickly written and modified to adapt to different business requirements. Meanwhile, because the abstract syntax tree has the characteristics of easy understanding and operation, various statistics and analysis operations such as calculation rule complexity, optimization rule matching and the like can be performed on AST, so that the performance and efficiency of the wind control system are further improved.
In addition, referring to fig. 9, the present embodiment further provides an air control rule management control device, including:
a construction module 10 for constructing an abstract syntax tree using a syntax parsing tool;
the loading module 20 is configured to load all wind control rules based on the abstract syntax tree, and form AST form rules corresponding to the abstract syntax tree;
the determining module 30 is configured to determine a corresponding wind control rule according to the order information, and access a node value in the abstract syntax tree of the AST form rule by using a motormeter method, so as to determine feasibility of the wind control rule corresponding to the order information.
In addition, the embodiment also provides a wind control rule management control system, which comprises a memory and a processor, wherein the memory stores a wind control rule management control program, and the processor runs the wind control rule management control program to enable the wind control rule management control system to execute the wind control rule management control method.
In addition, the embodiment also provides a computer readable storage medium, and the computer readable storage medium stores a wind control rule management control program, and when the wind control rule management control program is executed by a processor, the wind control rule management control method is implemented.
In a word, the method provided by the invention creates the wind control rule engine based on the grammar analysis tool, configures the threshold value, the range and the like of the rule in the interface, does not need to modify codes each time to realize, improves the efficiency and reduces the risk; the visual interface is provided, so that operators and developers can intuitively know the existing wind control rules; abstract the concepts of scope and criterion, and control the action range of the wind control rule, and is more concise and clearer than a specific filter in the code.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present invention. The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (10)

1. The wind control rule management control method is characterized by comprising the following steps of:
constructing an abstract syntax tree by using a syntax parsing tool;
loading all wind control rules based on the abstract syntax tree to form AST form rules corresponding to the abstract syntax tree;
and determining the corresponding wind control rule according to the order information, and accessing the node value in the abstract syntax tree of the AST form rule by utilizing a displayer method so as to determine the feasibility of the wind control rule corresponding to the order information.
2. The method of claim 1, further comprising, prior to constructing the abstract syntax tree using the syntax parsing tool:
triggering a wind control rule construction flow according to the creation instruction;
according to the wind control rule construction flow, obtaining the wind control name and category of the wind control rule;
acquiring the corresponding action range information of the wind control names and the categories, and determining corresponding wind control template information;
and acquiring corresponding wind control screening conditions and wind control thresholds based on the wind control template information to obtain the wind control rule.
3. The method of claim 2, wherein determining the corresponding wind control rule according to the order information, and accessing the node value in the abstract syntax tree of the AST form rule by using a monitor method, so as to determine the feasibility of the wind control rule corresponding to the order information, comprises:
acquiring the order information to determine the corresponding wind control rule;
traversing the AST form rule, and accessing the node value of each word sequence in the AST form rule by using a monitor method to return a result to determine the feasibility of the wind control rule corresponding to the order information.
4. The method of claim 3, wherein said using a monitor method to access the node value of each word sequence in the AST form rule to return a result to determine the feasibility of the wind control rule corresponding to the order information comprises:
acquiring attribution information corresponding to the order information;
judging whether the order information belongs to the action range information according to the attribution information;
if the order information belongs to the action range information, determining that the order information belongs to a department and/or a trading desk in the action range information, and determining the feasibility of the wind control rule corresponding to the order information based on the returned result.
5. The method of claim 4, wherein after determining that the order information belongs to the department and/or the trading desk within the scope information, further comprising:
acquiring transaction element information corresponding to the order information;
judging whether the transaction element information accords with wind control screening conditions or not;
and if the transaction element information accords with the wind control screening condition, determining the feasibility of the wind control rule corresponding to the order information based on the return result.
6. The method for managing and controlling wind control rules according to claim 5, wherein after the transaction element information meets the wind control screening condition, further comprising:
judging whether the order information can trigger the wind control threshold value or not;
if the order information can trigger the wind control threshold value, judging that a wind control rule corresponding to the order information is not feasible;
if the order information cannot trigger the wind control threshold, judging that the wind control rule corresponding to the order information is feasible.
7. The method of claim 1, wherein constructing an abstract syntax tree using a syntax parsing tool comprises:
defining grammar rules of the grammar parsing tool;
generating parser code based on the grammar rules using the grammar parsing tool;
creating node classes in the abstract syntax tree;
defining a displayer method corresponding to the node class and the node class;
in the parser code, the node class and the initiator method are combined, and the abstract syntax tree is constructed by using the syntax parsing tool.
8. An air control rule management control device, comprising:
the construction module is used for constructing an abstract syntax tree by using a syntax parsing tool;
the loading module is used for loading all wind control rules based on the abstract syntax tree to form AST form rules corresponding to the abstract syntax tree;
the determining module is used for determining the corresponding wind control rule according to the order information, and accessing the node value in the abstract syntax tree of the AST form rule by utilizing a displayer method so as to determine the feasibility of the wind control rule corresponding to the order information.
9. An air control rule management control system, comprising a memory and a processor, wherein the memory stores an air control rule management control program, and the processor runs the air control rule management control program to cause the air control rule management control system to execute the air control rule management control method according to any one of claims 1 to 7.
10. A computer readable storage medium, wherein a wind control rule management control program is stored on the computer readable storage medium, and when the wind control rule management control program is executed by a processor, the wind control rule management control method according to any one of claims 1 to 7 is implemented.
CN202310657726.1A 2023-06-05 2023-06-05 Wind control rule management control method, device and system and storage medium Pending CN116611926A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310657726.1A CN116611926A (en) 2023-06-05 2023-06-05 Wind control rule management control method, device and system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310657726.1A CN116611926A (en) 2023-06-05 2023-06-05 Wind control rule management control method, device and system and storage medium

Publications (1)

Publication Number Publication Date
CN116611926A true CN116611926A (en) 2023-08-18

Family

ID=87685278

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310657726.1A Pending CN116611926A (en) 2023-06-05 2023-06-05 Wind control rule management control method, device and system and storage medium

Country Status (1)

Country Link
CN (1) CN116611926A (en)

Similar Documents

Publication Publication Date Title
CN107704265B (en) Configurable rule generation method for service flow
US10872067B2 (en) Creating data in a data store using a dynamic ontology
CN112394922B (en) Decision configuration method, business decision method and decision engine system
US9864586B2 (en) Code quality improvement
CN107644323B (en) Intelligent auditing system for business flow
US20090234791A1 (en) Systems and Methods for Automated Interpretation of Analytic Procedures
CN110502227B (en) Code complement method and device, storage medium and electronic equipment
CN110688307B (en) JavaScript code detection method, device, equipment and storage medium
US20110202496A1 (en) Method, apparatus or software for construction of rules for use in a complex event processing system
CN113050928A (en) Method, system, equipment and medium for event extension in workflow
US20230072988A1 (en) System and a method for automatic generation of smart contracts across blockchain platforms
CN111258562A (en) Java code quality inspection method, device, equipment and storage medium
CN116611926A (en) Wind control rule management control method, device and system and storage medium
CN115145584A (en) Parser generation method, data processing method, medium, and device
US10719424B1 (en) Compositional string analysis
CN110928535A (en) Derivative variable deployment method, device, equipment and readable storage medium
CN113159951B (en) Financial data clearing method, device, equipment and storage medium
US11803565B2 (en) System and method for verifying software data lineage
CA2566025C (en) Type validation for applications incorporating a weakly-typed language
US10733192B1 (en) Expression evaluation infrastructure
CN117171189A (en) Data processing method, device and equipment
CN115545934A (en) Data processing method and device
CN116993510A (en) Natural language-based financial product online method, device, equipment and medium
CN116755669A (en) Low code development method and tool based on DSL language operation model
CN116755709A (en) Data processing method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination