bradybd / fixparser

FIX5.0SP2 parser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fixparser

This is the ECMAScript framework for working FIX protocol messages. Compliant with FIX 5.0 SP2.

The Financial Information eXchange (FIX) protocol is an electronic communications protocol initiated in 1992 for international real-time exchange of information related to the securities transactions and markets.

Build Status NPM Version Code Climate Test Coverage

Quick start

Clone the repo, git clone git://github.com/logotype/fixparser.git.

Create an instance of the FIXParser class:

import {FIXParser} from '../src/FIXParser.js';
var fixParser = new FIXParser(),
    parsedMessage = fixParser.parse('8=FIX.4.1�9=61�35=A�34=1�49=EXEC�52=20121105-23:24:06�56=BANZAI�98=0�108=30�10=003�8=FIX.4.1�9=61�35=A�34=1�49=BANZAI�52=20121105-23:24:06�56=EXEC�98=0�108=30�10=003�8=FIX.4.1�9=49�35=0�34=2�49=BANZAI�52=20121105-23:24:37�56=EXEC�10=228�8=FIX.4.1�9=49�35=0�34=2�49=EXEC�52=20121105-23:24:37�56=BANZAI�10=228�8=FIX.4.1�9=103�35=D�34=3�49=BANZAI�52=20121105-23:24:42�56=EXEC�11=1352157882577�21=1�38=10000�40=1�54=1�55=MSFT�59=0�10=062�8=FIX.4.1�9=139�35=8�34=3�49=EXEC�52=20121105-23:24:42�56=BANZAI�6=0�11=1352157882577�14=0�17=1�20=0�31=0�32=0�37=1�38=10000�39=0�54=1�55=MSFT�150=2�151=0�10=059�8=FIX.4.1�9=153�35=8�34=4�49=EXEC�52=20121105-23:24:42�56=BANZAI�6=12.3�11=1352157882577�14=10000�17=2�20=0�31=12.3�32=10000�37=2�38=10000�39=2�54=1�55=MSFT�150=2�151=0�10=230�8=FIX.4.1�9=103�35=D�34=4�49=BANZAI�52=20121105-23:24:55�56=EXEC�11=1352157895032�21=1�38=10000�40=1�54=1�55=ORCL�59=0�10=047�8=FIX.4.1�9=139�35=8�34=5�49=EXEC�52=20121105-23:24:55�56=BANZAI�6=0�11=1352157895032�14=0�17=3�20=0�31=0�32=0�37=3�38=10000�39=0�54=1�55=ORCL�150=2�151=0�10=049�8=FIX.4.1�9=153�35=8�34=6�49=EXEC�52=20121105-23:24:55�56=BANZAI�6=12.3�11=1352157895032�14=10000�17=4�20=0�31=12.3�32=10000�37=4�38=10000�39=2�54=1�55=ORCL�150=2�151=0�10=220�8=FIX.4.1�9=108�35=D�34=5�49=BANZAI�52=20121105-23:25:12�56=EXEC�11=1352157912357�21=1�38=10000�40=2�44=10�54=1�55=SPY�59=0�10=003�8=FIX.4.1�9=138�35=8�34=7�49=EXEC�52=20121105-23:25:12�56=BANZAI�6=0�11=1352157912357�14=0�17=5�20=0�31=0�32=0�37=5�38=10000�39=0�54=1�55=SPY�150=2�151=0�10=252�8=FIX.4.1�9=104�35=F�34=6�49=BANZAI�52=20121105-23:25:16�56=EXEC�11=1352157916437�38=10000�41=1352157912357�54=1�55=SPY�10=198�8=FIX.4.1�9=82�35=3�34=8�49=EXEC�52=20121105-23:25:16�56=BANZAI�45=6�58=Unsupported message type�10=000�8=FIX.4.1�9=104�35=F�34=7�49=BANZAI�52=20121105-23:25:25�56=EXEC�11=1352157925309�38=10000�41=1352157912357�54=1�55=SPY�10=197�8=FIX.4.1�9=82�35=3�34=9�49=EXEC�52=20121105-23:25:25�56=BANZAI�45=7�58=Unsupported message type�10=002�');
console.log(parsedMessage);

Features

  • Modern, written in ES6/ES2015
  • Clean, lightweight and documented code
  • Supports both browser and node.js/iojs

Message format

The general format of a FIX message is a standard header followed by the message body fields and terminated with a standard trailer.

Each message is constructed of a stream of = fields with a field delimiter between fields in the stream. Tags are of data type TagNum. All tags must have a value specified. Optional fields without values should simply not be specified in the FIX message. A Reject message is the appropriate response to a tag with no value. Except where noted, fields within a message can be defined in any sequence (Relative position of a field within a message is inconsequential.) The exceptions to this rule are:

  • General message format is composed of the standard header followed by the body followed by the standard trailer.
  • The first three fields in the standard header are BeginString (tag #8) followed by BodyLength (tag #9) followed by MsgType (tag #35).
  • The last field in the standard trailer is the CheckSum (tag #10).
  • Fields within repeating data groups must be specified in the order that the fields are specified in the message definition within the FIX specification document. The NoXXX field where XXX is the field being counted specifies the number of repeating group instances that must immediately precede the repeating group contents.
  • A tag number (field) should only appear in a message once. If it appears more than once in the message it should be considered an error with the specification document. The error should be pointed out to the FIX Global Technical Committee.

In addition, certain fields of the data type MultipleCharValue can contain multiple individual values separated by a space within the "value" portion of that field followed by a single "SOH" character (e.g. "18=2 9 C" represents 3 individual values: '2', '9', and 'C'). Fields of the data type MultipleStringValue can contain multiple values that consists of string values separated by a space within the "value" portion of that field followed by a single "SOH" character (e.g. "277=AA I AJ" represents 3 values: 'AA', 'I', 'AJ').

It is also possible for a field to be contained in both the clear text portion and the encrypted data sections of the same message. This is normally used for validation and verification. For example, sending the SenderCompID in the encrypted data section can be used as a rudimentary validation technique. In the cases where the clear text data differs from the encrypted data, the encrypted data should be considered more reliable. (A security warning should be generated).

Authors

Victor Norgren

Copyright and license

Copyright © 2015 logotype

Author: Victor Norgren

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

FIX5.0SP2 parser.


Languages

Language:JavaScript 100.0%