Get Started with FIXParser

Follow this quick start guide to get started with FIXParser. Ensure that you have Node.js® and npm installed first.

1$ npm install fixparser --save

Install fixparser via NPM by running the following command in your terminal.

1import { FIXParser } from 'fixparser';
2
3const fixParser = new FIXParser();
4const fixString: string =
5    '8=FIX.4.2|9=146|35=D|34=4|49=ABC_DEFG01|52=20090323-15:40:29|56=CCG|115=XYZ|11=NF 0542/03232009|54=1|38=100|55=CVS|40=1|59=0|47=A|60=20090323-15:40:29|21=1|207=N|10=195|';
6const message = fixParser.parse(fixString);
7console.log(JSON.stringify(message, null, 4));
8console.log(message[0].getBriefDescription());

Import the library and parse a message.

1[
2    {
3        "fixVersion": "FIX.4.2",
4        "data": [
5            {
6                "tag": 8,
7                "value": "FIX.4.2",
8                "name": "BeginString",
9                "description": "Identifies beginning of new message and protocol version. ALWAYS FIRST FIELD IN MESSAGE. (Always unencrypted)",
10                "type": {
11                    "name": "String",
12                    "description": "Alpha-numeric free format strings, can include any character or punctuation except the delimiter. All String fields are case sensitive (i.e. morstatt != Morstatt).",
13                    "added": "FIX.4.2"
14                },
15                "category": null,
16                "section": null,
17                "enumeration": null,
18                "validated": false
19            },
20            // ...Continues for every field
21        ],
22        "bodyLengthValid": false,
23        "checksumValid": false,
24        "checksumValue": "139",
25        "checksumExpected": "194",
26        "bodyLengthValue": 145,
27        "bodyLengthExpected": 146
28    }
29]

This prints out a brief description of the FIX message using getBriefDescription(): "BUY 100 CVS MKT DAY". FIXParser will include the FIX specification description / enumeration / category and other data for every field in the message.

1const messageType = message.getField(Fields.MsgType);
2if( messageType ) {
3    const messageDescription = message.getEnum(messageType.tag, messageType.value)?.description;
4    console.log(messageDescription);
5}
6// NewOrderSingle
7// The new order message type is used by institutions wishing to electronically submit securities and forex orders to a broker for execution.
8// The New Order message type may also be used by institutions or retail intermediaries wishing to electronically submit Collective Investment Vehicle (CIV) orders to a broker or fund manager for execution.
9

You can further identify the type of FIX message by using the functions on the Message class, such asgetField() and getEnum().

Additional examples

Check out more examples on Gitlab.