FIX 5.0: Type "Pattern"


#1

Page 18 of FIX 5.0 SP2 specification mention the type “Pattern”.
However, this section is very obscure (in my opinion). May you give a example of use type “Pattern”?


#2

We added Pattern borrowing the XML Schema Pattern definition grammar as a concept for specifying patterns for strings or value ranges for integers.

There is a Pattern base type defined in the FIX Datatypes section. The Pattern expression provides us the capability to specify a string pattern. However there are no fields in FIX that use the Pattern as a type. The only use thus far is to support a concept of a union datatype. Before explaining Union Datatype, let’s look at a concrete example.

The FIX Datatype of Tenor supports formatting of the tenor:
Dx = tenor expression for “days”, e.g. “D5”, where “x” is any integer > 0
Mx = tenor expression for “months”, e.g. “M3”, where “x” is any integer > 0
Wx = tenor expression for “weeks”, e.g. “W13”, where “x” is any integer > 0
Yx = tenor expression for “years”, e.g. “Y1”, where “x” is any integer > 0

For tag=value - this is probably not all the usable but for FIXML we can use the xs:pattern type as follows:
<xs:restriction base=“xs:string”>
<xs:pattern value=“DMWY+”/>
</xs:restriction>

Now back to Union Datatype. The original tenor datatype of String was defined for the following values:

0 = Regular / FX Spot settlement (T+1 or T+2 depending on currency)
1 = Cash (TOD / T+0)
2 = Next Day (TOM / T+1)
3 = T+2
4 = T+3
5 = T+4
6 = Future
7 = When And If Issued
8 = Sellers Option
9 = T+5
B = Broken date - for FX expressing non-standard tenor, SettlDate (64) must be specified
C = FX Spot Next settlement (Spot+1, aka next day)

So we came up with the concept of Union Datatype which permits the use of two datatypes for a field - a value is valid if it complies with either the datatype of the field or the union datatype.

The Pattern is used with four types now:
Tenor
Reserved100Plus
Reserved400Plus
Reserved1000Plus

The ReservedPlus fields were union datatypes that addressed the need for fields that have enumerated values that can also have user defined values. In these cases the Reserved100Plus added to Integer data type. In the case of the ReservedPlus this actually maps to a MinInclusive value:
<xs:restriction base=“xs:integer”>
<xs:minInclusive value=“100”/>
</xs:restriction>

Yes - confusing. I would like to be able to blame this on someone else, but I put this together to support FIXML to use the FIXML Schema to actually validate the values to the definition of the datatype.

At the time, we didn’t anticipate additional encodings and the FIX tagvalue and FIXML encodings are coupled and intermixed with the basic and unified repositories. We have tried to address this in Orchestra as we now have multiple encodings of FIX and have learned a bit more about better design practices over the years.