npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-quickfix-wrap

v2.0.16

Published

This is a wrapper for the Quickfix C++ library to be used within node.js applications

Downloads

7

Readme

node-quickfix

This is a node.js wrapper of the popular QuickFIX library. Information about QuickFIX can be found at http://quickfixengine.org/. FIX is a standardized messaging protocol used for electronic communication of financial information. More information about FIX can be found at http://www.fixprotocol.org/

###Installing######

  1. Download quickfix tar here: http://www.quickfixengine.org/
  2. Check required dependencies: http://www.quickfixengine.org/quickfix/doc/html/dependencies.html
  • On Ubuntu 14.04 LTS (Trusty Tahr) zlib1g-dev is required.
  1. Install via the following instructions: http://www.quickfixengine.org/quickfix/doc/html/building.html
  2. After installing copy "config.h" from the install directory to your include directory (usually /usr/local/include/quickfix)
  3. Include this module in your package.json file.

###Features######

This module currently supports creating an Acceptor, an Initiator, and retrieving individual Sessions. Examples can be found in the examples directory of this project.

####Configuration######

Sessions can be configured through a properties file or directly with a String (which can be built from a JSON variable). For example, if your properties file has the following:

[DEFAULT]
ReconnectInterval=60
SocketAcceptPort=3223
PersistMessages=Y
FileStorePath=./data
FileLogPath=./log
HttpAcceptPort=9011

[SESSION]
ConnectionType=acceptor
SenderCompID=ELECTRONIFIE
TargetCompID=NODEQUICKFIX
BeginString=FIX.4.4
StartTime=00:00:00
EndTime=23:59:59
HeartBtInt=30
UseDataDictionary=Y
DataDictionary=./fix_spec/FIX44.xml
RefreshOnLogon=Y

You can pass a String in to the options of your acceptor/initiator:

var quickfix = require('node-quickfix');

var fixAcceptor = quickfix.acceptor({
  settings: "[DEFAULT]\n
  	ReconnectInterval=60\n
  	RefreshOnLogon=Y\n
  	SendRedundantResendRequests=Y\n
  	PersistMessages=Y\n
  	FileStorePath=./data/1\n
  	FileLogPath=./log/1\n
  	HttpAcceptPort=9011\n\n
  	[SESSION]\n
  	ConnectionType=acceptor\n
  	SenderCompID=ELECTRONIFIE\n
  	TargetCompID=NODEQUICKFIX\n
  	BeginString=FIX.4.4\n
  	StartTime=00:00:00\n
  	EndTime=23:59:59\n
  	HeartBtInt=30\n
  	SocketAcceptPort=3223\n
  	UseDataDictionary=Y\n
  	DataDictionary=./fix_spec/FIX44.xml",
  logonProvider: logonProvider,
  storeFactory: "file"
});

node-quickfix also has database support for quickfix. Provided you have the correct database installed, and have compiled quickfix with database support as described in http://www.quickfixengine.org/quickfix/doc/html/building.html , then using the database is as simple as updating your properties and then creating an acceptor with the correct storeFactory (file, postgresql, mysql, odbc). node-quickfix will use file storage by default.

[DEFAULT]
ReconnectInterval=60
SocketAcceptPort=3223
PersistMessages=Y
PostgreSQLStoreDatabase=quickfix
PostgreSQLStoreUser=postgres
PostgreSQLStorePassword=postgres
PostgreSQLStoreHost=localhost
PostgreSQLStorePort=5432
PostgreSQLStoreUseConnectionPool=Y
PostgreSQLLogDatabase=quickfix
PostgreSQLLogUser=postgres
PostgreSQLLogPassword=postgres
PostgreSQLLogHost=localhost
PostgreSQLLogPort=5432
PostgreSQLLogUseConnectionPool=Y
HttpAcceptPort=9011
var fixAcceptor = quickfix.acceptor({
  propertiesFile: './acceptor.properties',
  logonProvider: logonProvider,
  storeFactory: 'postgresql'
});

####Logon Handling#######

You can create a custom logon handler in node-quickfix by creating a logon provider and then constructing your acceptor or initiator with it. You can also pass credentials to the constructor that will be used to populate field 553 and 554 of your logon messages.

var quickfix = require('node-quickfix');

var logonProvider = quickfix.logonProvider(function(logonResponse, msg, sessionId) {
	if(msg.tags[553] == 'USERNAME' && msg.tags[554] == 'PASSWORD') {
		logonResponse.done(true); //successful logon
	} else {
		logonResponse.done(false); //reject logon
	}
});

var fixAcceptor = quickfix.acceptor({
  "logonProvider": logonProvider,
  propertiesFile: "./acceptor.properties"
});
var fixClient = quickfix.initiator({
  credentials: {
    username: "USERNAME",
    password: "PASSWORD"
  },
  propertiesFile: "./initiator.properties"
});

####Message format######

message = {
    header: {
      8: 'FIX.4.4',
      35: type,
      49: senderId,
      56: targetId
    },
    tags: {
        tag1: value1,
        tag2: value2
    },
    groups:[{
        'index': field for NoOfEntries,
        'delim': first tag in group,
        'entries': [{tag1: value1, tag2: value2}, {tag1: value1, tag2: value2}]
    }, ...]
  }

####Acceptor API###### start(callback) //start acceptor

send(msg, callback) //send json messages

sendRaw(msg, callback) //send FIX message string

stop(callback) //stop acceptor

getSessions() //get configured sessions

getSession(sessionId) //get session by session ID

Acceptors and initiators inherit from EventEmitter and so the following events can be listened for on acceptors/initiators with fixAcceptor.on(eventName, callback); Valid eventNames and the callback arguments are:

onCreate: sessionID
onLogon: sessionID
onLogout: sessionID
onLogonAttempt:  message, sessionID
toAdmin: message, sessionID
fromAdmin: message, sessionID
fromApp:  message, sessionID

####Initiator API###### start(callback) //start acceptor

send(msg, callback) //send json messages

sendRaw(msg, callback) //send FIX message string

stop(callback) //stop acceptor

getSessions() //get configured sessions

getSession(sessionId) //get session by session ID

isLoggedOn() //is initiator is currently connected to a session

####Session API###### disconnect(callback) //disconnect a session

getSessionID() //get session id for a session

isEnabled() //is the session enabled

isLoggedOn() //is the session currently logged on

logon(callback) //log the session on

logout(callback) //log the session out

refresh(callback) //refresh session state from the message store

reset(callback) //reset session sequence numbers

getters/setters for session sequence numbers:

getSenderSeqNum()
setSenderSeqNum(num)
getTargetSeqNum()
setSenderSeqNum(num)