3

I want to use FIXAPI for one of my application. I am trying connect "LOGON" api. But i am not getting any error or any Response. While i was tried with "b2bits simulator", it works. But Using any library, it does not give me any error or reponse. I am using "fixparser" library (NodeJS npm library) to call the api.

Any help would be appreciated.

Thanks.

calling fixparser with different versions. and also tried different library (node-quickfix)

var fixparser = require("fixparser");
const fixParser = new FIXParser();

fixParser.connect({
host: HOST,
port: PORT,
protocol: 'tcp',
sender: SENDER,
target: TARGET,
fixVersion: VERSION
});
// Sendlogon function
function sendLogon() {
const logon = fixParser.createMessage(
    new Field(Fields.MsgType, Messages.Logon),
    new Field(Fields.MsgSeqNum, fixParser.getNextTargetMsgSeqNum()),
    new Field(Fields.SenderCompID, SENDER),
    new Field(Fields.SendingTime, fixParser.getTimestamp()),
    new Field(Fields.TargetCompID, TARGET),
    new Field(Fields.ResetSeqNumFlag, 'Y'),
    new Field(Fields.EncryptMethod, EncryptMethod.None),
    new Field(Fields.HeartBtInt, 10)
);
const messages = fixParser.parse(logon.encode());

fixParser.send(logon);
}
// Open connection
fixParser.on('open', async (s, se) => {
    console.log("Started....");    
    sendLogon();
});
// Retrive response
fixParser.on('message', (message) => {
// Received FIX message
// console.log("message",message);
console.log('received message', message.description, message.string);
});
// Close connection
fixParser.on('close', () => {
console.log("closed");
});

I want to get response and error(if any)

1 Answers1

1

Looks like you are trying to connect to Stock Exchange api. So according to their docs: first message sent by client have to be a LOGON message, but FixParser after opening sockets sends heartbeat instead, and api closes connection after unexpected message.

SoleSS
  • 13
  • 4