Problem with logon message - TargetSubID suddenly needed
Problem with logon message - TargetSubID suddenly needed
29 Jan 2019, 00:21
Hey there,
I'm connecting via nodejs & FIXParser to the FIX-Server h47.p.ctrader.com. My problem is, that I'm receiving
a strange error:
58=TargetSubID is assigned with the unexpected value '', expected 'QUOTE'
I've checked the FIX documentation @ https://help.ctrader.com/fix/model and also the C# example codes. I cannot see a difference between my sent logon message and the ones in the example. Maybe anyone of you guys have a clue what's going wrong? The only thing I can see is the timestamp which gets send -1 hour of my local time.
sending message Logon 8=FIX.4.4|9=124|35=A|34=1|49=broker.3210745|52=20190128-22:11:52.295|50=QUOTE|56=cServer|141=Y|98=0|553=3210745|554=PASSWORTCHANGED|108=30|10=246| [1548713512628] FIXClient received message Logout received message Logout 8=FIX.4.4|9=147|35=5|34=1|49=cServer|52=20190128-22:11:53.268|56=broker.3210745|57=QUOTE|58=TargetSubID is assigned with the unexpected value '', expected 'QUOTE'|10=071|
Regards
Replies
PanagiotisCharalampous
29 Jan 2019, 11:27
Hi abierbrauer,
Thanks for posting in our forum. Tag 57 is missing from your message. You can check our Rules of Engagement here. The message on the documentation will be updated.
Best Regards,
Panagiotis
@PanagiotisCharalampous
abierbrauer
29 Jan 2019, 12:15
( Updated at: 21 Dec 2023, 09:21 )
Thanks for the info regarding the pdf. I've changed my code to send it like specified in the pdf documentation.
8=FIX.4.4|9=131|35=A|34=1|49=ctrader.3210745|50=QUOTE|57=QUOTE|52=20190129-10:06:21.445|56=CSERVER|98=0|108=30|553=3210745|554=PWD|141=Y|10=039|
Now, I'm not getting an error message but just getting disconnected. Regarding to the doc, I would get a message with invalid fields if there are some missing or wrong. I'm connecting btw to port 5201 of h47.p.ctrader.com.
What message would I get if the credentials are wrong?
@abierbrauer
PanagiotisCharalampous
29 Jan 2019, 12:32
Hi abierbrauer,
When credentials are wrong, you will receive no response. To stay connected, you need to send heartbeats every x seconds as defined by tag 108.
Best Regards,
Panagiotis
@PanagiotisCharalampous
abierbrauer
29 Jan 2019, 14:30
Hello Panagiotis,
first of all thanks for you help. I know that I have to send the heartbeats, but I cannot send them because directly after sending the logon message, the connection gets closed.
I orderd the tags and still the same results. The credentials I'm using are
From the cTrader software --------------------------------------- Host name: h47.p.ctrader.com (Current IP address 212.83.157.16 can be changed without notice) Port: 5211 (SSL), 5201 (Plain text) Password: ***** (a/c 3210745 password) SenderCompID: ctrader.3210745 TargetCompID: cServer SenderSubID: QUOTE ------------------- In the code Username: 3210745 Passwort: the main password of the account, no api_token or something else just for reference the logon message: Logon 8=FIX.4.4|9=125|35=A|49=ctrader.3210745|56=CSERVER|34=1|52=20190129-12:26:40.325|57=QUOTE|50=QUOTE|98=0|108=30|553=3210745|554=PWDCHANGED|10=255|
What other problems could occur due to failed login? 'The logon message seems to be ok, so it could be only the account itself?
@abierbrauer
PanagiotisCharalampous
29 Jan 2019, 14:37
Hi abierbrauer,
Do you receive any message at all after logon message? If yes, can you post it? If not, then probably your credentials are wrong. Try resetting your password via FIX API section in Settings and try again.
Best Regards,
Panagiotis
@PanagiotisCharalampous
abierbrauer
29 Jan 2019, 14:44
Thank you man!! I didn't notice the change password button in the FIX API dialog! Now after changing the password I'm getting a logon message back and it's successfull! ;)
Thanks again Panagiotis
For people who want to use nodejs, here's some example code for login via nodejs and fixparser:
import FIXParser, { Field, Fields, Messages, Side, OrderTypes, HandlInst, TimeInForce, EncryptMethod } from 'fixparser'; const fixParser = new FIXParser(); const SENDER = 'cTrader.ID'; const USERNAME = 'USERNAME'; const TARGET = 'CSERVER'; const PASSWORD = 'YUR_PASSWORD'; function sendLogon() { const logon = fixParser.createMessage( new Field(8,'FIX.4.4'), // 8 BeginString new Field(Fields.MsgType, Messages.Logon), // 35 MsgType new Field(Fields.SenderCompID, SENDER), // 49 SenderCompID new Field(Fields.TargetCompID, TARGET), // 56 TargetCompID new Field(Fields.MsgSeqNum, fixParser.getNextTargetMsgSeqNum()), // 34 MsgSeqNum new Field(Fields.SendingTime, fixParser.getTimestamp()), // 52 SendingTime new Field(Fields.TargetSubID,'QUOTE'), // 57 new Field(Fields.SenderSubID,'QUOTE'), // 50 SenderSubID new Field(Fields.EncryptMethod, EncryptMethod.None), // 98 EncryptMethod new Field(Fields.HeartBtInt, 30), // 108 HeartBtInt new Field(Fields.Username, USERNAME), // 553 Username new Field(Fields.Password, PASSWORD), // 554 Password new Field(Fields.ResetSeqNumFlag, 'Y') ); const messages = fixParser.parse(logon.encode()); console.log('sending message', messages[0].description, messages[0].string.replace(/\x01/g, '|')); fixParser.send(logon); } fixParser.connect({ host: 'h47.p.ctrader.com', port: 5201, protocol: 'tcp', sender: SENDER, target: TARGET, fixVersion: 'FIX.4.4' }); fixParser.on('open', () => { console.log('Open'); sendLogon(); }); fixParser.on('message', (message) => { console.log('received message', message.description, message.string.replace(/\x01/g, '|')); }); fixParser.on('error', (error) => { console.log('received error', error); }); fixParser.on('close', () => { console.log('Disconnected'); });
@abierbrauer
abierbrauer
29 Jan 2019, 10:25
small update, the timestamp is not the problem. When I'm setting in to my local time, I'm getting a time error. So the previous values I've send as timestamp are correct
@abierbrauer