Login Page - Create Account

Support Board


Date/Time: Sat, 20 Apr 2024 12:43:35 +0000



Connect to SierraChart real time data from Java program

View Count: 785

[2018-07-18 03:19:20]
Thomson - Posts: 3
Hi,

I am developing a Java program to collect the real time data from SierraChart.
I am able to Logon and send/receive the heartbeat message to/from the server by using JSON continuously.
However, when I send the Market Data Request, the server has no response and does not send the SNAPSHOT/Data data as expected.

Below is the Server log:
==========================================================================================================================
DTC Protocol server | Incoming connection from 127.0.0.1. | 2018-07-18 10:56:18
DTCServer (11) | Creating socket. | 2018-07-18 10:56:18
DTC client #1. 127.0.0.1 | Requested heartbeat interval: 40 | 2018-07-18 10:56:18
DTC client #1. Sample Application. 127.0.0.1 | Received logon request. | 2018-07-18 10:56:18
DTC client #1. Sample Application. 127.0.0.1 | Low bandwidth mode has been requested. | 2018-07-18 10:56:18
DTC client #1. Sample Application. 127.0.0.1 | Sent successful Logon response message to client. Username: . Result text: Connected to SC DTC Protocol server. Service=scdataallservices | 2018-07-18 10:56:18
==========================================================================================================================

Below is my Java Console Log:
==========================================================================================================================
Sending: {"Type":1,"Integer_1":1,"HeartbeatIntervalInSeconds":60,"ClientName":"Sample Application"}
TCPLink is running
Sending: {"Type":101,"RequestAction":"SUBSCRIBE","SymbolID":1,"Symbol":"HSN18"}
Sending: {"Type":3}
Receiving:{"Type":2,"ProtocolVersion":8,"Result":1,"Integer_1":0,"MarketDepthUpdatesBestBidAndAsk":0,"TradingIsSupported":0,"OCOOrdersSupported":0,"OrderCancelReplaceSupported":0,"SecurityDefinitionsSupported":1,"HistoricalPriceDataSupported":0,"ResubscribeWhenMarketDataFeedAvailable":0,"MarketDepthIsSupported":1,"OneHistoricalPriceDataRequestPerConnection":0,"BracketOrdersSupported":0,"UseIntegerPriceOrderMessages":0,"UsesMultiplePositionsPerSymbolAndTradeAccount":0,"MarketDataSupported":1,"ResultText":"Connected to SC DTC Protocol server. Service=scdataallservices","ReconnectAddress":"","ServerName":"SC DTC Server","SymbolExchangeDelimiter":""} END
Sending: {"Type":3}
Receiving: {"Type":3,"NumDroppedMessages":0,"CurrentDateTime":1531882618} END
Sending: {"Type":3}
Receiving: {"Type":3,"NumDroppedMessages":0,"CurrentDateTime":1531882658} END
==========================================================================================================================

However, when I changed the SymbolID in the request message to zero, the server can send the reject message back.
If I changed an invalid Symbol (e.g. ABC), The server will not response anything again.
Below is the Server log:
==========================================================================================================================
Sending: {"Type":101,"RequestAction":"SUBSCRIBE","SymbolID":0,"Symbol":"HSN18"}
Receiving: {"Type":103,"SymbolID":0,"RejectText":"Symbol ID is zero."}
==========================================================================================================================

Is there anything in the SierraChart I need to set or subscribe further? Thank you in advance.
[2018-07-18 13:52:32]
Sierra Chart Engineering - Posts: 104368
This is wrong:
,"RequestAction":"SUBSCRIBE"

In case of a constant you need use the numeric variable it is equal to. So in this case subscribe is 1.
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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

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

Login

Login Page - Create Account