fast-protocol is a javascript/node.js module providing encoder/decoder functions for FAST -> 'FIX Adapted for Streaming' protocol version 1.1.
Currently the module is still in development, see known limitations below.
npm install fast-protocol
var fastStream = require('fast-protocol')
The following example shows simple encoding usage:
// load fast stream module
var FastStream = require('fast-protocol')
// create encoder using FAST template definition from file
var encoder = new FastStream.Encoder('emdi-7.0.xml')
// encode message
var buffer = encoder.encode('RDPacketHeader', { SenderCompID: 1,
PacketSeqNum: [ 0, 8, 58, 9 ],
SendingTime: [ 21, 105, 89, 139, 55, 77, 80, 126 ] })
// process buffer
...
// load fast stream module
var FastStream = require('fast-protocol')
// create message decoder
var decoder = new FastStream.Decoder('emdi-7.0.xml')
// read binary buffer - user specific function
var buffer = readBuffer()
// decode buffer content
decoder.decode(buffer, function(msg, name) {
console.log(name, JSON.stringify(msg, null, 2))
})
You can also provide a javascript object with message specific callback functions, like this example:
// load fast stream module
var FastStream = require('fast-protocol')
// create message decoder
var decoder = new FastStream.Decoder('emdi-7.0.xml')
// read binary buffer - user specific function
var buffer = readBuffer()
// decode buffer content
decoder.decode(buffer, {
RDPacketHeader: function(msg) {
// process RDPacketHeader
console.log('PacketHeader', JSON.stringify(msg, null, 2))
},
ProductSnapshot: function(msg) {
// process ProductSnapshot
console.log('ProductSnapshot', JSON.stringify(msg, null, 2))
}
})
Decode/Encode tests have been run using Xetra T7 EMDI market data of 03.01.2019; market data of the entire day has been decoded/encoded correctly - 100 % conformity achieved.
t.b.d.
Everyone is welcome!