js-fix
JS FIX codec
Last updated 3 years ago by bernardhu .
Original npm · Tarball · package.json
$ cnpm install js-fix 
SYNC missed versions from official npm registry.

js-fix is a library for encoding and decoding FIX protocol in pure JS. Currently only tested on FIX5.0 & FIX5.0SP2.

Usage

Pls see below

Init

first you need to choose which version the codec run, simply 5.0 stand for Fix5.0 protocol, and 5.0SP2 stand for Fix5.0SP2 protocol. eg: init Fix5.0SP2 var fix = require('fixjs') fix.init('5.0SP2')

Encoding

first you need to init the FIX object, like: 

var order = {};
order.msgtype = '8';
order.ClOrdID = '000001';
order.Parties = [];

var party = {};
party.PartyID = '010100000001';
party.PartyIDSource = '5';
party.PartyRole = '5';
order.Parties.push(party);

order.ExecID = '000001';
order.OrdStatus = 'N';
order.Instrument = {};
order.Instrument.SecurityID = '000776';
order.Instrument.SecurityIDSource = '102';
order.Side = '1';
order.OrderQtyData = {};
order.OrderQtyData.OrderQty = 20;
order.OrdType = '2';
order.Price=9.5;
order.TimeInForce = '0';

order.LastPx = '5.7';
order.LastQty = 10;
order.CumQty = 10;
order.LeavesQty = 10;

console.log("===================order======")
console.log(util.inspect(order, false, 6, false));
var str = fix.encode(order);
console.log("===================fix str======");
console.log(str);

Decoding

Con't to encoding, just one code line

var order2 = fix.decode(str);                      
console.log("===================decode order======"
console.log(util.inspect(order2, false, 6, false));

Installation

npm install gf-fixjs

License

MIT.

Current Tags

  • 0.0.9                                ...           latest (3 years ago)

1 Versions

  • 0.0.9                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |