FPL FAST Tech Summit London January FAST Technical Crash course public CFASTSerdes() { } /// /// Gets the presence map for a tag. /// /// CODEC being used for the serialisation /// Tag /// Presence map public override uint get_map(CCodec Codec, uint tag) { int pos = (int) (CCodec.get_tag_slot(tag) + Codec.Config.pmap_offset); Debug.Assert(pos <= CCodec.MAX_TAG); if (pos >= Codec.map_size) return 0; if ((Codec.map_data [pos / 7] & (0x40 >> pos % 7)) != 0) return 1; else return 0; }
How does FAST work? Technical Crash Course Kevin Houstoun Global Message Consultant HSBC Without code Co Chair Global FIX Technical Committee
FPL FAST Tech Summit London January Agenda FAST Vocabulary FAST Transfer Encoding Fields SBIT Details Messages FAST Field Encoding FAST Templates FAST Field Data Types An Example
FPL FAST Tech Summit London January FAST Protocol Characteristics 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 Extensible
FPL FAST Tech Summit London January FAST Protocol Layers
FPL FAST Tech Summit London January FAST Vocabulary (1) 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.
FPL FAST Tech Summit London January FAST Vocabulary (2) 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 FAST Tech Summit London January FAST Transfer Encoding – Fields 7 bits 14 bits 21 bits nn bits
FPL FAST Tech Summit London January FAST Transfer Encoding – SBIT Details 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 FAST Tech Summit London January FAST Transfer Encoding – Messages The tail of a pmap may be compressed The number of fields in a message depends on the pmap content A message may be as short as one byte (an empty pmap)
FPL FAST Tech Summit London January FAST Field Data Types Unsigned Integer Signed Integer Scaled Number ASCII String Bit Vector The FAST transport representation supports unlimited size fields. Implementations will likely limit the supported size to match the native data representation in applications.
FPL FAST Tech Summit London January Unsigned Integer Transfer Representation Value(hex)Seven Data Bits per Byte (bin)Len F FFF FFFFF FFFFFFF FFFFFFFF
FPL FAST Tech Summit London January Signed Integer Transfer Representation Value(hex)Seven Data Bits per Byte (bin)Len F FFF FFFFF FFFFFF FFFFFFF FFFFFFFF FFFFFFC FFFFE FFF F
FPL FAST Tech Summit London January Scaled Number Transfer Representation A scaled number is represented using an exponent and a mantissa number = mantissa * 10 ^ exponent The mantissa and exponent are represented as signed integers A base 10 exponent is used to provide exact decimal representation Examples MantissaExponentValue 0-1*10^0 = *10^-2 = *10^4 = 10000
FPL FAST Tech Summit London January A Transfer Encoding Example BeginStr SeqNum SenderID SendingTime Price Symbol 8=FIX.4.4|34=10000|49=CLIENT1|52= :06:58.100|44=1200|55=FOO1| 8=FIX.4.4|34=10001|49=CLIENT1|52= :06:58.200|44=1210|55=FOO1| 8=FIX.4.4|34=10002|49=CLIENT1|52= :06:58.300|44=1190|55=BAR2| Original size 71 bytes FIX.4.4|10000|CLIENT1| :06:58.100|1200|FOO1| FIX.4.4|10001|CLIENT1| :06:58.200|1210|FOO1| FIX.4.4|10002|CLIENT1| :06:58.300|1190|BAR2| FIX.4.4nnCLIENT :06:58.100nnFOO1 FIX.4.4nnCLIENT :06:58.200nnFOO1 FIX.4.4nnCLIENT :06:58.300nnBAR2 Implicit Tagging 54 bytes (-24%) SBIT Encoding 48 bytes (-33%) Binary Encoding 43 bytes (-39%) FIX CLIENT :06: FOO1 FIX CLIENT :06: FOO1 FIX CLIENT :06: BAR2
FPL FAST Tech Summit London January 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 FAST Tech Summit London January A Field Encoding Example BeginStr SeqNum SenderID SendingTime Price Symbol 8=FIX.4.4|34=10000|49=CLIENT1|52= :06:58.100|44=1200|55=FOO1| 8=FIX.4.4|34=10001|49=CLIENT1|52= :06:58.200|44=1210|55=FOO1| 8=FIX.4.4|34=10002|49=CLIENT1|52= :06:58.300|44=1190|55=BAR2| Original size 71 bytes 10000|CLIENT1| :06:58.100|1200|FOO1| 1|200|10|FOO1| 2|300|-20|BAR2| Field Encoding First message = 46 bytes (-35%) Subsequent messages = 14 bytes (-80%) Default Copy Or Constant Increment Delta x2
FPL FAST Tech Summit London January Compact Notation 8s!FIX.4.4|9u|35s!X|49s=|34u+1|268u Template Entry FIX Field NameField Encode Operation Data TypeDescription of Operation 8s!FIX4.4BeginStringDefault ValueStringDefault BeginString to the string value of “FIX4.4” 9uBodyLengthNoneUnsigned integerAlways explicitly specify the value of BodyLength 35s!XMessageTypeDefault ValuestringDefault MessageType to the string value of “X” 49s=SenderCompIDCopy CodeStringCopy SenderCompID from the prior occurrence 34u+1SequenceNumberIncrementUnsigned integerIncrement SequenceNumber by +1 from the prior occurrence 268uNoMDEntriesNoneUnsigned integerAlways explicitly specify the value of NoMDEntries 279u=MDUpdateActionCopy CodeUnsigned IntegerCopy MDUpdateAction from the prior occurrence 269s=MDEntryTypeCopyCodeStringCopy MDEntryType from the prior occurrence 55s=SymbolCopyCodeStringCopy Symbol from the prior occurrence 167s=SecurityTypeCopyCodeStringCopy SecurityType from the prior occurrence 270F-MDEntryPriceDelta ValueScaled NumberCalculate the difference from the prior occurrence of MDEntryPrice 271F-MDEntrySizeDelta ValueScaled NumberCalculate the difference from the prior occurrence of MDEntryPrice 346u-NumberOfOrdersDelta ValueUnsigned integerCalculate the difference from the prior occurrence of NumberOfOrders 276s=QuoteConditionCopyCodeStringCopy QuoteCondition from the prior occurrence 277s=TradeConditionCopyCodeStringCopy TradeCondition from the prior occurrence
FPL FAST Tech Summit London January Template Exchange Basic Methods for Template Exchange Out-of-band Basic text file that may be downloaded from a website or ed from the sender to receiver Side-band Templates are transmitted on a continual basis or in response to request Templates are best represented using clear text In-band Templates are transmitted as part of the primary data feed and the receiver must pick them out of the feed
FPL FAST Tech Summit London January Summary FAST Vocabulary FAST Transfer Encoding Fields SBIT Details Messages FAST Field Encoding FAST Templates FAST Field Data Types An Example