Login Page - Create Account

Support Board


Date/Time: Fri, 22 Nov 2024 16:35:06 +0000



DTC Protocol - LOGON_REQUEST

View Count: 227

[2024-10-04 13:39:59]
stefkovic.m28 - Posts: 17
Hello,

I have created a script for automatic trading using DTC protocol in Sierra Charts.
I have active connection to DTC, but when I call command LOGON_RESPONSE, I can´t get answer from DTC after a few seconds.

Attached screen from Sierra shows my DTC settings, if there is something wrong.
Both methods for Logon, also with Account / without Account I have also used, but there is no answer from DTC.
You can find MessageLogs attached.

JSON formated script looks like (account & passwork in this case with xxx):

{

"MessageType": "LogonRequest",

"Username": "xxx",

"Password": "xxx",

"ProtocolVersion": 8,

"HeartbeatIntervalInSeconds": 20,

"ClientName": "OL Client",

"TradeMode": 0

}


After that I can get only this answer:

{

"Type": 3,

"NumDroppedMessages": 0,

"CurrentDateTime": 1728023496,

"SecondsSinceLastReceivedHeartbeat": 0,

"NumberOfOutstandingSentBuffers": 0,

"PendingTransmissionDelayInMilliseconds": 0,

"CurrentSendBufferSizeInBytes": 0,

"SendingDateTimeMicroseconds": 1728023496476945,

"DataCompressionRatio": 0,

"TotalUncompressedBytes": 0,

"TotalCompressionTime": 0,

"NumberOfCompressions": 0,

"SourceIPAddress": 2130706433,

"MaximumSendBufferSizeInBytes": 0,

"MaximumSendBufferSizeInBytesDateTime": 0

}

Can you please help me with this? Is there mistake in syntax or someting other in general settings?
many thanks

regards, Milan
imageimage001.png / V - Attached On 2024-10-04 13:27:06 UTC - Size: 92.52 KB - 26 views
attachmentLOG-NO-PSW.txt - Attached On 2024-10-04 13:28:19 UTC - Size: 1.41 KB - 48 views
attachmentLOG-WITH-PSW.txt - Attached On 2024-10-04 13:28:23 UTC - Size: 1.43 KB - 44 views
[2024-10-04 14:24:32]
Sierra_Chart Engineering - Posts: 17143
So you are connecting to the DTC protocol server in Sierra Chart? If so, you would not use Logon Response. As a client you would use a logon request. And once you send a logon request you get a logon response from the server.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2024-10-04 14:25:08
[2024-10-04 19:10:20]
stefkovic.m28 - Posts: 17
Hello,

yes, exactly, I am connecting to the DTC protocol server in Sierra Chart. After I have sent a logon request with my credentials like:

JSON data: {"MessageType": "LogonRequest","Username": "","Password": "","ProtocolVersion": 8,"HeartbeatIntervalInSeconds": 20,"ClientName": "OL Client", "TradeMode": 0}

I have got this message:

DTC client #4. 127.0.0.1 | No heartbeat received after 4s. Closing network socket. Bytes in receive buffer: 157
DTC client #4. 127.0.0.1 (1) | CloseSocket call.

Please see also my message logs attached.
Whats wrong in my case please?

Or is there something wrong in my syntax?

{

"MessageType": "LogonRequest",

"Username": "xxx",

"Password": "xxx",

"ProtocolVersion": 8,

"HeartbeatIntervalInSeconds": 20,

"ClientName": "OL Client",

"TradeMode": 0

}

Thanks
[2024-10-07 14:49:26]
User388741 - Posts: 9
Are you sending \0 after each message?
For my logon request all I send it Type, ProtocolVersion and HeartbeatIntervalInSeconds.
You shouldn't need a username and password if you're talking to Sierra's built-in DTC server.
Date Time Of Last Edit: 2024-10-07 14:50:48
[2024-10-07 15:21:43]
stefkovic.m28 - Posts: 17
Hello, thanks for your answer, have you also seen my message logs?

Is the syntax in JSON correct for DTC server, I have no response from server and connection will be closed.
[2024-10-07 15:30:44]
User388741 - Posts: 9
I assume you have either set the DTC server to JSON or are doing the REQUEST_ENCODING exchange when you connect, otherwise DTC won't parse your JSON messages.
Make sure you enable JSON logging in the DTC server settings to see if Sierra actually parses anything.

Also, while the syntax is correct, the message body isn't.
"MessageType" key needs to be called "Type" and the value needs to be an int.

Try sending just this:
{
"Type": 1,
"ProtocolVersion": 8,
"HeartbeatIntervalInSeconds": 20
}
[2024-10-07 17:32:15]
stefkovic.m28 - Posts: 17
Hello,

many thanks, I have tried your code, but I have not heartbeat again and server has closed my connection.
I have added here my message log and Sierra settings for DTC protocol.

Do you see there please something, what´s wrong on my side?

thanks
image1.JPG / V - Attached On 2024-10-07 17:32:02 UTC - Size: 239.33 KB - 32 views
image2.JPG / V - Attached On 2024-10-07 17:32:06 UTC - Size: 129.88 KB - 27 views
[2024-10-07 18:23:17]
User388741 - Posts: 9
MessageType in heartbeat is an invalid key. All messages need to have a "Type" key with an int. You can look up the mapping here: https://www.sierrachart.com/DTC_Files/DTCProtocol.h
Also, doesn't look like you're sending the \0 byte after each message. You need to do this. DTC will also respond with a \0 delimiter between messages, you need to handle those.
[2024-10-07 18:30:45]
User388741 - Posts: 9
I also don't know what 'TradeMode' is supposed to be in your LOGON_REQUEST message, that doesn't exist anywhere in the spec.
[2024-10-07 20:06:03]
stefkovic.m28 - Posts: 17
Many thanks, I have found it finally, it was the delimiter.
Now I have to try execution commands, sucessfully connection I already have.

thanks

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account