Skip to content

Vortex

Vetting Rules are described with a simple text-based language.

The basic form of a rule is result if condition, such as:

fail if order.side is Bid and order.value > balance.amount

Rules can be placed inside blocks, so they are only evaluated if a condition is met, such as:

run if order.side is Bid
{
fail if order.value > balance.amount
}

Rules can provide a result code, allowing more visibility of which vetting rule was matched.

fail with InsufficientShares if order.side is Ask and order.quantity > holding.shares

Rules can be disabled, or documentation recorded, by using the # symbol

# This is not a rule, just a comment
fail if order.value > balance.amount # Comments can go after rules
# The following rule will not be evaluated
# fail with DisabledRule if a = b

Rules are evaluated one by one, from start to finish. Evaluation starts with an intermediate result of pass.

When the condition for a Rule is met, the result is applied to the intermediate result in the following manner:

  • pass leaves the result unchanged.
  • auth replaces pass.
  • fail replaces pass or auth.

When all rules are evaluated, vetting supplies the final result, along with the result codes from all matching rules.

A condition consists of one or more comparisons to perform that, when true, cause a rule to match.

Binary conditions are operations between two values, such as equals =, greater than > or less than <.

The Vetting Engine supports the following operators:

OperatorDescriptionExample
=Equalsorder.side = 'Buy'
isEquals (shorthand)order.side is Buy
<> or !=Not Equalbalance.currency <> 'AUD'
is notNot Equal (shorthand)balance.currency is not AUD
>Greater Thanorder.value > 10000
>=Greater Than or Equalorder.value >= 10000
<Less Thanorder.value < 10000
<=Less Than or Equalorder.value <= 10000

There are also a set of operators with special requirements:

OperatorDescriptionExample
hasDoes a property existholding has quantity
missingIs a property missingholding missing quantity
inIs the value one of a list, or part of a stringorder.type in ['Limit', 'MarketToLimit']
not inIs the value not one of a list, or not part of a string'I' not in symbol.attributes.Flags

Unary conditions are operations performed on a single value, such as not.

The Vetting Engine supports the following operators:

OperatorDescriptionExample
notNotnot (order.side = 'Buy' and order.value > 100)

Conditions can be combined using boolean operators such as and.

fail if order.side is Bid and order.value > balance.amount

The Vetting Engine supports the following operators:

OperatorDescriptionExample
andMatch if both sides matchorder.value > 100 and order.value < 1000
orMatch if either side matchesorder.value > 100 or balance.currency is AUD
xorMatch if only one side matchesbalance.amount > 1000 xor balance.currency is AUD

Conditions can also be organised using parenthesis.

fail if (order.side is Bid and order.value > 100) or (order.side is Ask and order.quantity > 200)

There are two types of values used by the Vetting Engine: pre-defined values, and vetting properties.

Conditions often have pre-defined values that are part of the rules themselves.

Numbers are represented in-text, both plain integers and fractional values: 1234 or 999.0001.

Text-based values, such as the order side or type, can be represented within single-quotes: order.type = 'Limit'.

Vetting also provides a short-hand for text values with the is and is not operators: order.type is Limit.

Values that can either be true or false are represented simply as true or false: security.isindex = true

Properties are values provided by the order management and market data systems to compare against.

Each property has a name, such as balance.currency, details.side.

Properties are case-sensitive. For example: balance.Currency is an invalid property.

The Vetting Engine allows you to perform calculations with both pre-defined values and properties, such as 3 / 5, order.price * order.quantity * 10.

The Vetting Engine supports the following operators:

OperatorDescriptionExample
+Additionorder.value + balance.amount
-Subtractionbalance.amount - order.value
*Multiplicationdetails.quantity * details.limit
/Divisionorder.value / details.quantity
%Modulus (Remainder)details.quantity % 100
^Exponentdetails.quantity * 10 ^ 4
-Negate-order.value

Operators obey the normal order of precedence: Parenthesis, Exponent, Division/Modulus, Multiplication, Addition, then Subtraction/Negation.