Apama Capital Markets Foundation Documentation : Capital Markets Foundation : Order Management : Risk Firewall : Setting up risk firewall evaluation rules : Examples of slice filters for rule class instances
Examples of slice filters for rule class instances
By default, a slice parameter is a wildcard that matches any value. You can specify a single value or a sequence of values for any number of slice parameters for each rule class instance.
Suppose you set one slice parameter for a rule class instance. The risk firewall evaluates each order that contains at least one value that you specified in that slice parameter. In other words, an order with any one of the values specified in the sequence causes the order to be evaluated by that rule class instance. For example, for a particular rule class instance, you set the SLICE_SYMBOL parameter to a sequence that contains "A", "B" and "C". That rule class instance evaluates an order if its symbol is A or B or C.
Now suppose you set more that one slice parameter for a rule class instance. The risk firewall evaluates an order only when there is a match for each slice parameter. That is, the risk firewall applies AND logic when you specify more than one slice parameter. For example, suppose you set the following slice parameters:
SLICE_SYMBOL is ("A", "B", "C")
SLICE_SERVICEID is ("1", "2", "3")
SLICE_TRADERID is ("TM", "TN", "TO")
For this rule class instance to evaluate an order, the order's symbol must be A or B or C, and the order's service Id must be 1 or 2 or 3, and the order's trader Id must be TM or TN or TO.
If you do not specify a particular slice parameter for a rule class instance it has the effect of a wildcard. For example, suppose you do not specify the SLICE_TRADERID parameter but for the SLICE_SYMBOL parameter you specify a sequence that contains "EUR/USD". This causes the rule class to match against orders for "EUR/USD" for any trader. In addition, because the client credit limit and position limit rule classes calculate cumulative values, instances of those rule classes will calculate a cumulative value/position for all traders. Note that specifying an empty sequence has the same effect as not defining the particular parameter.
Suppose you set the SLICE_SYMBOL parameter to ("A", "B") for an instance of the position limit default rule class. This rule class instance tracks the combined position for both A and B. If you want to track A orders against the A position, and you also want to track B orders against the B position, then you must add two rule class instances — one rule class instance would have A as the value of the SLICE_SYMBOL parameter and the other rule class instance would have B as the value of the SLICE_SYMBOL parameter.
The following table provides examples of slice filters you might specify along with their results.
Slice Filter
Matches Orders With
SLICE_SYMBOL="SOW"
Symbol value of SOW regardless of which adapter the order is going to. That is, the values of the service Id and market Id do not matter.
For a position limit rule class instance, the open and pending positions would be the total of all orders for SOW on all adapters.
SLICE_SYMBOL="SOW"
SLICE_SERVICEID="MyService"
Symbol value of SOW that are going to the adapter identified by the MyService Id.
For example, for an the order price limit rule instance, this filter ensures that no trader sends an order to the MyService adapter with a price that is above a specified amount for the specified symbol.
SLICE_SERVICEID="MyService"
Service Id of MyService.
For a position limit rule class instance, the open and pending positions would be the total of all orders that are going to the adapter identified by the MyService Id, regardless of the symbol or any other information in the order.
Suppose you want to limit the maximum position for each symbol that is traded on a particular service. This requires a different rule class instance for each symbol. The slice filter for each rule class instance would specify a particular, different symbol and the service Id.
In the case of the client credit limit rule class, you might be trading foreign exchange currencies or assets over different traded currencies, where calculating a cumulative cash position does not make sense if the traded currencies are different. For example, you do not want to add USD to Yen totals without first converting them to a normalized currency.
Most of the default rule classes are per-order checks. Consequently, defining groups is usually what you want to do.
Suppose you want to check that the currency is one of GBP, EUR or USD, and you also want to check that another parameter exists (for example, a client reference). This other parameter does not need to have a specific value, that is, you want to specify it as a wildcard. The following code accomplishes this:
dictionary< string, sequence<string> > sliceEPs
:= new dictionary< string, sequence<string> >;
sliceEPs.getOrAddDefault( "Currency" ).append( "GBP" );
sliceEPs.getOrAddDefault( "Currency" ).append( "EUR" );
sliceEPs.getOrAddDefault( "Currency" ).append( "USD" );
sliceEPs.getOrAddDefault( "ClientRef" ).append( "" ); // Wildcard client ref
 
com.apama.utils.Params params := new com.apama.utils.Params;
params.addParam( com.apama.firewall.Consts.SLICE_EXTRAPARAM,
sliceEPs.toString() );
rfwIface.addRuleInstance( "MyRuleClass", params );
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback