Topics
Replies
abierbrauer
04 Jul 2019, 14:44
Hi again,
yeah you're right and I had it this way. Corrected it again and run into the same problem in another currency.
GBPAUD to EURUSD
I was thinking I simply had to use EURGBP to do the translation, but no AUDUSD is used to convert it to USD. That's my problem! I need to use ProtoOASymbolsForConversionReq to receive the complete convertion chain.
But thanks so far! At least, I'm not stuck anymore and can continue ;)
@abierbrauer
abierbrauer
07 Feb 2019, 11:46
Sure, here we go:
Host: live.ctraderapi.com
Port: 5035
OpenAPI V2
and I'm using the generated protobuf messages from Open-API-2.0-.Net-Sample.
The accounts are demo accounts on the live system.
@abierbrauer
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, 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
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
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
received message Logout 8=FIX.4.4|9=159|35=5|34=1|49=cServer|52=20190129-08:22:29.192|56=broker.3210745|57=QUOTE|58=Tried to send a reject while not logged on: SendingTime accuracy problem (field 0)|10=255|
@abierbrauer
abierbrauer
04 Jul 2019, 15:47
Hello again ;)
So, I've fetched the convertion chain via the open api.
But is it really true, that if you want to convert GBPUSD to EURUSD you will have to use AUDCAD in the convertion chain ?
Regards, Alex
@abierbrauer