M. Qwdr
M. Qwdr

Reputation: 1

Quickfixn Fix 4.2 How to Send & Receive messages to different TargetCompID in same session

How to send & receive Fix messages to different TargetCompID in same session

public void ToAdmin(Message message, SessionID sessionID)
{
if ( (message.ToString().IndexOf("35=D") > 0) || (message.ToString().IndexOf("35=G") > 0) || (message.ToString().IndexOf("35=F") > 0))
{            message.Header.SetField(new TargetCompID("1"));
}
}

9:56:38 ToApp: 8=FIX.4.2�9=261�35=D�34=63�49=555�50=BBBBBB�52=20180918-06:56:38�56=0�128=1�129=AAAAAA�1=555-----126�11=1�21=1�22=4�38=2500�40=2�44=0.03�47=C�48=JO3109211016�54=2�55=JO3109211016�58=Testing Fix Connec�59=1�60=20180918-09:56:38.579�109=126�110=50�111=100�9596=2�9947=55500350�10=140� 9:56:38 Exchange: 8=FIX.4.2�9=115�35=3�34=73�49=0�50=AAAAAA�52=20180918-09:56:38�56=555�45=63�58=cannot process order: TargetCompID is invalid�372=D�10=067�

Upvotes: 0

Views: 671

Answers (1)

Pavel
Pavel

Reputation: 113

TargetCompID is a part of Session's identifier, see http://quickfixn.org/tutorial/configuration.html:

A FIX session is defined in QuickFix/N as a unique combination of a BeginString (the FIX version number), a SenderCompID (your ID), and a TargetCompID (the ID of your counterparty).

So it seems incorrect to try to send messages to different TargetCompID within the same session; you need to create a separate session for each TargetCompID.

Simplest is defining sessions in configuration file (see the link above); alternatively you can create them dynamically - see http://lists.quickfixn.com/pipermail/quickfixn-quickfixn.com/2016q1/000277.html

Upvotes: 2

Related Questions