A FinWatch rule is a self-contained unit of logic defined in a singleDocumentation Index
Fetch the complete documentation index at: https://docs.finwatch.finance/llms.txt
Use this file to discover all available pages before exploring further.
.ws file. It evaluates incoming transaction data against a set of conditions and, if those conditions are met, produces a verdict. A verdict is an actionable decision about the transaction’s risk.
Every rule is composed of four structural components: rule, description, when, and then.
1.1 The Complete Structure
1.2 The rule Block
Purpose: The top-level declaration that names the rule and acts as the container for all its logic.
Syntax:
- The
rulekeyword is optional but strongly recommended for readability. The parser will accept an identifier followed by{as a valid rule start. <RuleName>is an identifier, not a string. It must start with a letter or underscore, and can contain letters, digits, and underscores.- There is one rule per
.wsfile. The parser reads a single rule from the input. - The entire body of the rule is enclosed in curly braces
{ }.
- Use
PascalCaseorPascalCase_With_Underscores. - The name should describe the fraud pattern or policy it enforces.
- Good:
HighValueTransactionCheck,SanctionedCountryCheck,BlockIfPreviousFailed - Bad:
rule1,test,myRule
1.3 The description Clause
Purpose: A human-readable explanation of the rule’s intent. This is your audit trail. When a regulator asks “why was this transaction blocked?”, the description is your first line of defense.
Syntax:
- The value must be a double-quoted string.
- It is optional in the parser, but mandatory in practice. A rule without a description is a rule that will be misunderstood.
- Write for a non-technical audience: compliance officers, auditors, and future teammates.
1.4 The when Clause
Purpose: The logical heart of the rule. It defines the conditions that must evaluate to true for the rule to fire.
Syntax:
- Contains one or more conditional expressions.
- Multiple conditions are joined by
andororlogical operators. - If the entire
whenclause evaluates totrue, thethenclause executes. - If it evaluates to
false, the rule silently passes — no verdict is produced. - A rule MUST have a
whenclause. The parser will reject a rule without one.
1.5 The then Clause
Purpose: Defines the action taken when the when clause is satisfied.
Syntax:
- A rule MUST have a
thenclause. The parser will reject a rule without one. scoreandreasonare optional. If omitted,scoredefaults to0.0andreasondefaults to"No reason provided".scoreandreasoncan appear in any order after the verdict.
.png?fit=max&auto=format&n=0JF6z69u57hmqsWm&q=85&s=531373acedba0eb783b669f6d558dfd8)