5

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)

4
  • How are you calling the sendLogon() method? You have to keep the process open so the listeners you have registered, get chance to be called. Commented Aug 14, 2019 at 10:45
  • Thanks for the reply. I am calling it using "fixparser" library. Can you please brief it, by means of "Keep the process open" ? Commented Aug 16, 2019 at 3:51
  • I mean how you are running this file? node <filename>.js? or you are using this file in other files? Commented Aug 18, 2019 at 4:46
  • node app.js. I have put all code together in one file Commented Aug 19, 2019 at 5:07

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.