420 likes | 642 Views
The FAST Protocol SM Optimising the Communication of Financial Information. Background. Increased market data volumes High bandwidth and processing costs Classic FIX Widespread adoption Inadequate performance for Market data Quote driven markets Proprietary Alternatives
E N D
The FAST ProtocolSMOptimising the Communication of Financial Information
Background • Increased market data volumes • High bandwidth and processing costs • Classic FIX • Widespread adoption • Inadequate performance for • Market data • Quote driven markets • Proprietary Alternatives • Complicates integration (many different interfaces) • No cost sharing of development and maintenance • Limited adoption FPL Latin America Electronic Trading Conference 2008
FAST ProtocolFactors that Influenced the Design • Efficiency • Compression Ratio • Resource Consumption (CPU, memory) • Ease of Use (Conceptual, Implementation, Operation) • Costs • Implementation • Validation • Deployment • Operation • Maintenance • Proof of Concept • CME • Archipelago • ISE • Microsoft • Singapore Exchange • London Stock Exchange FPL Latin America Electronic Trading Conference 2008
FAST ProtocolCharacteristics • Basic Feature Set • Optimized for message streams • Content aware (requires knowledge about message structure) • Byte-oriented binary representation • Variable-length fields • Each message contains one or more fields • A presence map enables efficient use of default values • Several ways of deriving default values • Empirically validated • Very fast processing (encoding / decoding) • High compression ratios on tested exchange feeds • Simple implementation FPL Latin America Electronic Trading Conference 2008
FAST Protocol Layers FPL Latin America Electronic Trading Conference 2008
FAST Vocabulary • A data stream consists of a sequence of messages. • A message consists of a sequence of one or more fields. • A field consists of a sequence of one or more bytes. • Wire format refers to the byte representation that is used to transfer data on the wire. • Encoding is the process of translating to wire format. • Decoding is the process of translating from wire format. • A CODEC (enCOder/DECoder) provides support for encoding or decoding a stream of messages. • A byte consists of seven data bits and a stop bit (the ‘SBIT’) that when set indicates the byte is the last byte of a field. • A presence map (‘PMAP’) is a field that is interpreted as a vector of bits, one bit (‘PBIT’) for each field in a message. • A field operator enables previous values to be reused. FPL Latin America Electronic Trading Conference 2008
FAST Transfer Encoding – Fields 7 bits 14 bits 21 bits nn bits • FAST Transfer Encoding - SBIT Detail • SBIT coding provides space efficient delimitation of fields • More compact than byte delimiter for fields shorter than 7 bytes • Empirical data shows average FAST field sizes of ~2 bytes • ~33% more compact than a byte delimiter at 2 bytes • Serialization of SBIT format is simple and efficient • There are exceptional cases when SBIT coding is suboptimal • Byte vector can be used for these cases FPL Latin America Electronic Trading Conference 2008
FAST Transfer Encoding – Messages The number of fields in a message depends on the pmap content The tail of a pmap may be compressed A message may be as short as one byte (an empty pmap) FPL Latin America Electronic Trading Conference 2008
FAST Field Data Types • Unsigned Integer • Signed Integer • Decimal (aka Composite Scaled Number) • ASCII Character String • UNICODE Character String • Bit Vector • Byte Vector • Additional FAST 1.0 Data types that were dreprecated • Unsigned Integer without Null • Signed Integer without Null • Scaled Number The FAST transport representation supports unlimited size fields. Implementations will likely limit the supported size to match the native data representation in applications. FPL Latin America Electronic Trading Conference 2008
Some helpful refreshers • Some important values to remember • 0x80 = 128 decimal = b‘10000000’ • 0x80 is an Octet value of 0x00 with the SBIT (Stop Bit) set • 0x7f = 127 decimal = b’01111111’ • Operations • & bitwise AND operation • 0x00 & 0x80 => 0x00 • 0x7f & 0x80 => 0x00 • | bitwise OR operation • 0x00 | 0x80 => 0x80 • 0x7f | 0x80 => 0xff FPL Latin America Electronic Trading Conference 2008
For FAST the fundamental data type is the bit • SBIT – Stop Bit is the high order bit in the byte set to b’1’ (8th byte) Bit 7 to indicate the end of a field, b’0’ otherwise • DBITS – Bits 6 through 0 contain data FPL Latin America Electronic Trading Conference 2008
Integer Data Types FPL Latin America Electronic Trading Conference 2008
Unsigned Integer Without Null Support Data Type • Transfer from low order to high order 7 bits at a time • Set the Stop Bit in the low order byte FPL Latin America Electronic Trading Conference 2008
Unsigned Integer Without Null Transfer Encoding FPL Latin America Electronic Trading Conference 2008
Unsigned Integer • The number is incremented by 1 in the transfer process to account for the NULL value being supported • Why is the NULL value 0x00 encoded as 0x80? FPL Latin America Electronic Trading Conference 2008
Signed Integer Data Type • Two’s Complement Arithmetic • When the 7 bit value is converted to a 32 bit value the first data bit is taken as a sign bit and is copied to the 25 high end bits of the 32 bit value yielding 0xffffffff (which corresponds to -110 in 2’s complement representation). • The most significant data bit of the first byte encoded is the sign FPL Latin America Electronic Trading Conference 2008
Signed Integer Transfer Encoding for Positive Values FPL Latin America Electronic Trading Conference 2008
Signed Integer Transfer Encoding for negative values FPL Latin America Electronic Trading Conference 2008
Signed Integer with Null Support • Still Two’s Complement Arithmetic – does not change for negative numbers • Plus, just like with the Unsigned Integer with Null Support Data Type, we get to increment positive values by 1 • PLUS ONE ENCODING • Good thing we have computers to do this stuff for us FPL Latin America Electronic Trading Conference 2008
FAST Scaled Number (decimal) Data Type • Base-10 • Single field • Requires one field in the PMAP • First byte is interpreted as a Signed Integer specifying the Exponent • Remaining bytes are treated as a Signed Integer representing the Mantissa • Provides exact decimal representation X Obsolete Mantissa X 10Exponent FPL Latin America Electronic Trading Conference 2008
FAST Decimal Datatypeaka Composite Scaled Number Data Type • Base-10 • Consists of two fields • Requires two places in a PMAP if field encoded • Exponent maximum is -63 to +63 Mantissa X 10Exponent FPL Latin America Electronic Trading Conference 2008
FAST ASCII String Data Type • 7 Bit ASCII Character Set Supported • Last Byte in string has the Stop Bit set 0x54 0x68 0x61 0x6e 0x6b 0x20 0x59 0x6f 0x75 0x20 0x42 0x4d 0x46 0xa1 What is the decoded string in ASCII? FPL Latin America Electronic Trading Conference 2008
What is in the String? 0x54 0x68 0x61 0x6e 0x6b 0x20 0x59 0x6f 0x75 0x20 0x42 0x4d 0x46 0xa1 Thank You BMF! FPL Latin America Electronic Trading Conference 2008
UnicodeString DatatypeByte Vector Data Type • Length specified as a FAST Unsigned Integer Value • Length number of Octets follow • Full 8 bit values 0x00 – 0xff • A NULL Byte Vector is represented by setting the length to Null • Can be used for non-ASCII character sets FPL Latin America Electronic Trading Conference 2008
Bit Vector Data Type • Series of zero or more continuation bytes followed by one stop byte • There is no NULL value defined for this type FPL Latin America Electronic Trading Conference 2008
Greg A Transfer Encoding Example BeginStr SeqNum SenderID SendingTime Price Symbol 8=FIX.4.4|34=10000|49=CLIENT1|52=20060126-13:06:58.100|44=1200|55=FOO1| 8=FIX.4.4|34=10001|49=CLIENT1|52=20060126-13:06:58.200|44=1210|55=FOO1| 8=FIX.4.4|34=10002|49=CLIENT1|52=20060126-13:06:58.300|44=1190|55=BAR2| Original size 71 bytes FIX.4.4|10000|CLIENT1|20060126-13:06:58.100|1200|FOO1| FIX.4.4|10001|CLIENT1|20060126-13:06:58.200|1210|FOO1| FIX.4.4|10002|CLIENT1|20060126-13:06:58.300|1190|BAR2| Implicit Tagging 54 bytes (-24%) FIX.4.410000CLIENT120060126-13:06:58.1001200FOO1 FIX.4.410001CLIENT120060126-13:06:58.2001210FOO1 FIX.4.410002CLIENT120060126-13:06:58.3001190BAR2 SBIT Encoding 48 bytes (-33%) FIX.4.4nnCLIENT120060126-13:06:58.100nnFOO1 FIX.4.4nnCLIENT120060126-13:06:58.200nnFOO1 FIX.4.4nnCLIENT120060126-13:06:58.300nnBAR2 SBIT+Binary Encoding 43 bytes (-39%) FPL Latin America Electronic Trading Conference 2008
Affinity Predictability Beyond Transfer Encoding Further compaction requires information about data affinity and predictability. BeginStr SeqNum SenderID SendingTime Price Symbol 8=FIX.4.4|34=10000|49=CLIENT1|52=20060126-13:06:58.100|44=1200|55=FOO1 8=FIX.4.4|34=10001|49=CLIENT1|52=20060126-13:06:58.200|44=1210|55=FOO1 8=FIX.4.4|34=10002|49=CLIENT1|52=20060126-13:06:58.300|44=1190|55=BAR2 Field Encoding ... FPL Latin America Electronic Trading Conference 2008
Templates • A template specifies how to encode an application message into the transfer encoding • A template conveys • Message Structure • Data Types • Field Operators FPL Latin America Electronic Trading Conference 2008
Field Operators Structure Data Types Template Overview <template name="ExampleOrder"> <messageRef name="NewOrderSingle"/> <string name="BeginStr"> <constant value="FIX.4.4"/> </string> <u32 name="SeqNum"> <increment/> </u32> <string name="SenderID"> <copy/> </string> <string name="SendingTime"> <delta/> </string> <decimal name="Price"> <delta/> </decimal> <string name="Symbol"> <copy/> </string></template> FPL Latin America Electronic Trading Conference 2008
Characteristics of FAST Templates • Semantics are formally and unambiguously defined • Enables consistent behavior and interoperability among implementations • Concrete Syntax • Default format for authoring, storing and interchanging templates • Human and machine readable • XML Syntax • Supports evolution of the template specification • Extensible – enables inclusion of custom data in templates • Widespread knowledge and good tool support • Alternative concrete representations • Hard coded in encoder and/or decoder • FAST encoded as specified by the Session Control Protocol (SCP) FPL Latin America Electronic Trading Conference 2008
The Transfer Encoding Example Revisited BeginStr SeqNum SenderID SendingTime Price Symbol 8=FIX.4.4|34=10000|49=CLIENT1|52=20060126-13:06:58.100|44=1200|55=FOO1| 8=FIX.4.4|34=10001|49=CLIENT1|52=20060126-13:06:58.200|44=1210|55=FOO1| 8=FIX.4.4|34=10002|49=CLIENT1|52=20060126-13:06:58.300|44=1190|55=BAR2| Original size 71 bytes FIX.4.4|10000|CLIENT1|20060126-13:06:58.100|1200|FOO1| FIX.4.4|10001|CLIENT1|20060126-13:06:58.200|1210|FOO1| FIX.4.4|10002|CLIENT1|20060126-13:06:58.300|1190|BAR2| Implicit Tagging 54 bytes (-24%) FIX.4.410000CLIENT120060126-13:06:58.1001200FOO1 FIX.4.410001CLIENT120060126-13:06:58.2001210FOO1 FIX.4.410002CLIENT120060126-13:06:58.3001190BAR2 SBIT Encoding 48 bytes (-33%) FIX.4.4nnCLIENT120060126-13:06:58.100nnFOO1 FIX.4.4nnCLIENT120060126-13:06:58.200nnFOO1 FIX.4.4nnCLIENT120060126-13:06:58.300nnBAR2 Binary Encoding 43 bytes (-39%) FPL Latin America Electronic Trading Conference 2008
Data Types • Strings, Integer and Decimal numbers, Boolean, Byte Vector • Restricted types for numbers – 8-bit up to 64-bit sizes <templatename="ExampleOrder"><messageRefname="NewOrderSingle"/> <string name="BeginStr"/> <u32 name="SeqNum"/><stringname="SenderID"/><stringname="SendingTime"/> <decimal name="Price"/><stringname="Symbol"/></template> BeginStr SeqNum SenderID SendingTime Price Symbol Sz 8=FIX.4.4|34=10000|49=CLIENT1|52=20060126-13:06:58.100|44=1200|55=FOO1 44 8=FIX.4.4|34=10001|49=CLIENT1|52=20060126-13:06:58.200|44=1210|55=FOO1 44 8=FIX.4.4|34=10002|49=CLIENT1|52=20060126-13:06:58.300|44=1190|55=BAR2 44 Original Size: 71 bytes FPL Latin America Electronic Trading Conference 2008
Field Operators • Constant – Always the same value • Increment – Frequently previous value incremented by one • Copy – Frequently the same as the previous value • Delta – Values differ slightly • Default – Frequently a specific value FPL Latin America Electronic Trading Conference 2008
Constant Operator <templatename="ExampleOrder"><messageRefname="NewOrderSingle"/> <string name="BeginStr"> <constant value="FIX.4.4"/> </string><u32name="SeqNum"/><stringname="SenderID"/><stringname="SendingTime"/><decimalname="Price"/><stringname="Symbol"/></template> BeginStr SeqNumSenderIDSendingTimePriceSymbol Sz 8=FIX.4.4|34=10000|49=CLIENT1|52=20060126-13:06:58.100|44=1200|55=FOO1 37 8=FIX.4.4|34=10001|49=CLIENT1|52=20060126-13:06:58.200|44=1210|55=FOO1 37 8=FIX.4.4|34=10002|49=CLIENT1|52=20060126-13:06:58.300|44=1190|55=BAR2 37 Original Size: 71 bytes FPL Latin America Electronic Trading Conference 2008
Increment Operator <templatename="ExampleOrder"><messageRefname="NewOrderSingle"/><stringname="BeginStr"> <constantvalue="FIX.4.4"/> </string> <u32 name="SeqNum"> <increment/> </u32><stringname="SenderID"/><stringname="SendingTime"/><decimalname="Price"/><stringname="Symbol"/></template> BeginStr SeqNum SenderIDSendingTimePriceSymbol Sz 8=FIX.4.4|34=10000|49=CLIENT1|52=20060126-13:06:58.100|44=1200|55=FOO1 37 8=FIX.4.4|34=10001|49=CLIENT1|52=20060126-13:06:58.200|44=1210|55=FOO1 35 8=FIX.4.4|34=10002|49=CLIENT1|52=20060126-13:06:58.300|44=1190|55=BAR2 35 Original Size: 71 bytes FPL Latin America Electronic Trading Conference 2008
Copy Operator <templatename="ExampleOrder"><messageRefname="NewOrderSingle"/><stringname="BeginStr"> <constant value="FIX.4.4"/> </string><u32name="SeqNum"><increment/> </u32> <string name="SenderID"> <copy/> </string><stringname="SendingTime"/><decimalname="Price"/> <string name="Symbol"> <copy/> </string></template> BeginStrSeqNum SenderID SendingTimePrice Symbol Sz 8=FIX.4.4|34=10000|49=CLIENT1|52=20060126-13:06:58.100|44=1200|55=FOO1 37 8=FIX.4.4|34=10001|49=CLIENT1|52=20060126-13:06:58.200|44=1210|55=FOO1 24 8=FIX.4.4|34=10002|49=CLIENT1|52=20060126-13:06:58.300|44=1190|55=BAR2 28 Original Size: 71 bytes FPL Latin America Electronic Trading Conference 2008
Delta Operator <templatename="ExampleOrder"><messageRefname="NewOrderSingle"/><stringname="BeginStr"> <constantvalue="FIX.4.4"/> </string><u32name="SeqNum"><increment/> </u32> <stringname="SenderID"> <copy/> </string> <string name="SendingTime"> <delta/> </string> <decimal name="Price"> <delta/> </decimal> <stringname="Symbol"> <copy/> </string></template> BeginStrSeqNumSenderID SendingTime Price Symbol Sz 8=FIX.4.4|34=10000|49=CLIENT1|52=20060126-13:06:58.100|44=1200|55=FOO1 37 8=FIX.4.4|34=10001|49=CLIENT1|52=20060126-13:06:58.200|44=1210|55=FOO1 6 8=FIX.4.4|34=10002|49=CLIENT1|52=20060126-13:06:58.300|44=1190|55=BAR2 10 Original Size: 71 bytes FPL Latin America Electronic Trading Conference 2008
Naming • Names identify messages, templates and fields • Names of messages are typically global • Maintained by the owner of a protocol, for example FPL • Names of templates are typically local • Maintained locally by companies using or implementing FAST • Standard templates can be maintained by for example FPL • Name collision must be avoided • Templates use the same method as in Java and XML • Names belong to a namespace based on the company domain name FPL Latin America Electronic Trading Conference 2008
Naming Example <templates templateNs="http://www.example.org/ns/example" ns="http://www.fixprotocol.org/ns/fix44"> <template name="ExampleOrder"><messageRef name="NewOrderSingle"/>… </template> <templatename="ExampleTrade"> … </template> … </templates> FPL Latin America Electronic Trading Conference 2008
Additional information • Session Control Protocol Version 1.1 • More and more vended solutions • Majority of FIX engine vendors: ORC, TransactTools, NYFIX, Rapid Addition, and others • Open source solutions • http://www.openfast.org (Java only) • At least two more efforts underway FPL Latin America Electronic Trading Conference 2008
Questions? FPL Latin America Electronic Trading Conference 2008