0.0.6 • Published 12 years ago

fix v0.0.6

Weekly downloads
3,233
License
-
Repository
github
Last release
12 years ago

An implementation of the FIX protocol (Financial Information Exchange).

Currently the implementation is pre-beta.

New development

New development is being done on https://github.com/falconair/fix.js. This codebase turned out to be over-engineered. fix.js is much simpler, but its infrastructure is not as developed (package file, 'npm install ...' system, tests, etc.)

Some code from fix.js (similar to this project) is also driving a web app to parse fix protocol messages at http://fixparser.targetcompid.com

Install

npm install nodefix

Test {Server,Client}

You can run a test server:

then a test client, too:

Both programs should start communicating with each other. Wait a few seconds to see heart-beat messages fly by.

API

###Server:

var fix = require('fix');

var opt = {};
var server = fix.createServer(opt, function(session){

    session.on("logon", function(sender, target){ console.log("EVENT logon: "+ sender + ", " + target); });
    session.on("incomingmsg", function(sender,target,msg){ console.log("Server incomingmsg: "+ JSON.stringify(msg)); });
    session.on("outgoingmsg", function(sender,target,msg){ console.log("Server outgoingmsg: "+ JSON.stringify(msg)); });

});
server.listen(1234, "localhost", function(){});

Server events:

Server methods:

###Client:

var fix = require('fix');

var opt = {};
var client = fix.createClient("FIX.4.2", "initiator", "acceptor",opt);
client.connectAndLogon(1234,"localhost");

client.on("connect", function(){ console.log("EVENT connect"); });
client.on("end", function(){ console.log("EVENT end"); });
client.on("logon", function(sender, target){ console.log("EVENT logon: "+ sender + ", " + target); });
client.on("logoff", function(sender, target){ console.log("EVENT logoff: "+ sender + ", " + target); });
client.on("incomingmsg", function(sender,target,msg){ console.log("EVENT incomingmsg: "+ JSON.stringify(msg)); });
client.on("outgoingmsg", function(sender,target,msg){ console.log("EVENT outgoingmsg: "+ JSON.stringify(msg)); });

Client events:

Client methods:

###Common: Events commons to servers and clients:

Not yet supported

  • Groups
  • Encryption

Known errors

  • Make sure ./traffic directory exists

License

Copyright (C) 2011 by Shahbaz Chaudhary

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.