BLLanguageExtension Handler
Message transformation configuration is an XML file with rules for FIX tag/value manipulations. The root element is <Mapping> element. It encloses all other elements in configuration file.
<Rule> elements
Every rule contains conditions and actions. Conditions are used for rule triggering and actions describe the rule behavior. There is only one attribute (mandatory) - the "Name" attribute. It is unique within current XML configuration file.
Example:
<Rule Name="SimpleRule"> <Condition> <Inclusion> <FieldEqualsTo Field = "35"> <Val>D</Val> <Val>G</Val> <Val>F</Val> </FieldEqualsTo> </Inclusion> <Exclusion/> </Condition> <ActionIfTrue> <TryCopyField SourceField ="11" TargetField ="95011" /> </ActionIfTrue> <ActionIfFalse> <StopProcessing/> </ActionIfFalse> </Rule>
Conditions are within <Condition> element and Actions are within <ActionIf> tags in the example. Rules with no Actions (<ActionIfTrue>, <ActionIfFalse>) elements are ignored during rules execution. Rules with no <Condition> element are applied for all FIX messages unconditionally.
<ActionIfTrue>, <ActionIfFalse> elements
There are two optional action blocks – ActionIfTrue and ActionIfFalse. Success actions will be executed one-by-one once rule’s conditions evaluated as true. Otherwise, ActionIfFalse actions sequence will be executed.
<Condition> elements
Conditions are used for rule triggering. <Condition> element can consist of two elements - <Inclusions> and <Exclusions> (both are mandatory). Check's value for <Inclusions> tag is calculated as is. Check's value for <Exclusions> tag is inverted (logical NOT) after calculation. There is only one attribute ("Name", optional) in this element. It is unique within current XML configuration file.
Here are two examples:
<Condition Name="IsOrderFlow"> <Inclusion> <FieldEqualsTo Field="35"> <Val>D</Val> <Val>G</Val> <Val>F</Val> <Val>8</Val> <Val>9</Val> </FieldEqualsTo> </Inclusion> <Exclusion/> </Condition> | There is only one concrete check in the example - the FieldEqualsTo check. The condition is evaluated as true in case of 35th tag in a message is equal to one of D, G, F, 8, 9 value only.
|
<Condition Name="NotIsOrderFlow"> <Inclusion/> <Exclusion> <FieldEqualsTo Field="35"> <Val>D</Val> <Val>G</Val> <Val>F</Val> <Val>8</Val> <Val>9</Val> </ FieldEqualsTo> </Exclusion> </Condition>
| In the example the condition is evaluated as true in case of 35th tag in a message is not equal to one of D, G, F, 8, 9 value only.
|
<FieldEqualsTo> check
<FieldEqualsTo Field="35"> <Val>D</Val> <Val>G</Val> <Val>F</Val> </FieldEqualsTo> | There is an attribute (mandatory) in the check - "Field". <FieldEqualsTo> element checks if tag is equal to the value from given <Val> list. |
<MsgType> check
<MsgType> <Val>D</Val> <Val>G</Val> <Val>F</Val> </MsgType> | <MsgType> element checks if MsgType (35) of current FIX message is equal to one of the value from given <Val> list. Actually it does the same as FieldEqualsTo check but a bit faster.
|
<FieldExists> check
<FieldExists> <Val>20109</Val> <Val>20049</Val> </FieldExists> | <FieldExists> element checks given fields presence in message and results in true if at least one field is present. |
<FieldExists Field="20109" /> | Slightly different syntax with the Field attribute.
|
<FieldContains> check
<FieldContains Field="18"> <Val>R</Val> <Val>T</Val> </FieldContains> | <FieldContains> element checks if multi string value in the given field contains one of the value from given <Val> list. |
<FieldContains Field="18" Delimiter="|"> <Val>R</Val> <Val>T</Val> </FieldContains> | The “Delimiter” attribute contains the delimiter used in multi value string. It is optional; default value is space.
|
<FieldIsGreaterThan> check
<FieldIsGreaterThan Field="44" Value="100"/> | <FieldIsGreaterThan> checks if given field greater than “Value”. Absence of the tag defined by “Field” cause fail. |
<FieldIsLessThan> check
<FieldIsLessThan Field="44" Value="100"/> | <FieldIsLessThan> checks if given field less than “Value”. Absence of the tag defined by “Field” cause fail. |
<FieldBeginsWith> check
<FieldBeginsWith Field="6780" StartPos="6" CaseSensitive= "true"> <Val>L</Val> <Val>N</Val> <Val>BC</Val> </FieldBeginsWith> | <FieldBeginsWith> checks if “Field” begins with one of the substring from given list. “Field” and “StartPos” attributes are mandatory. The “StartPos” attribute refers to symbols within a string from 0. Default value for “CaseSensetive” attribute is “true”. The attribute is optional. |
<FieldLengthGreaterOrEqual> check
<FieldLengthGreaterOrEqual Field="6780" Length="7"/> | <FieldLengthGreaterOrEqual> checks if the length of the “Field” tag is greater or equal to the “Length” attribute. Both attributes are mandatory. |
<FieldIsToday> check
<FieldIsToday Field="42" /> | <FieldIsToday> checks if “Field” contains date/time value in UTC and equals to Today.
|
<FieldCheckBits> check
<FieldCheckBits Field="5047" Value="0x02000000" /> | <FieldCheckBits> treats the Field as integer and checks if it contains the HEX value defined by the “Value” attribute. Bitwise AND operation is used within the check. |
<Actions> elements
<RemoveField Field="19" Order="10"/> | Every action element can contain the “Order” attribute. Order is an integer value that defines a sequence of actions within a current rule. |
<TryCopyField> action
<TryCopyField SourceField = "85005" TargetField = "95005" /> | There are two (mandatory) attributes: “SourceField” and “TargetField”. The action tries to copy tags within current FIX message. Absence of the tag defined by “SourceField” does not cause fail, the action is just ignored. |
<TryCopyField SourceField ="85005" TargetField ="95005" DefaultValue = "NONE"/> | It is possible to use default value for missed tags. Use optional attribute “DefaultValue” for this case. |
The “Method” attribute contains the method name that uses for conversion during copying. The “UTCToLocalTime” means that the conversation from UTC time to LocalDate will be performed. | |
The “Trim” method trims spaces and tabs from SourceField and copies the resulted value into TargetField. |
<CopyField> action
<RemoveField Field="19" Order="10"/> | Every action element can contain the “Order” attribute. Order is an integer value that defines a sequence of actions within a current rule. |