Real-Time SDK - Java
Quick Start - Connecting to a deployed RTDS
Last update | Oct 2024 |
Environment | Windows, Linux |
Compilers | Oracle/Open JDK 11, 17, Amazon Corretto 11. Refer to RTSDK Java Compatibility Matrix document or README file for a complete list of supported compiler versions. |
Prerequisites | The steps outlined within this guide depend on details outlined within the RTSDK Java Installation Guide available within the Documentation tab. Ensure this document is at your disposal. Access to an existing Real-Time Distribution System to retrieve content |
Introduction
The goal of this Getting Started tutorial is to provide the developer with the steps required to download and confirm they have access to their Real-Time Distribution System (RTDS) by executing one of the packaged RTSDK examples. EMA and ETA are sub-components of the RTSDK (Real-Time SDK) package that includes a number of examples available to test specific functionality. For our purposes, the goal is to walk through the procedure to specify the connection details to access your market data environment to connect and retrieve market data content.
The tutorial is applicable to both Linux and Windows environments.
Download the RTSDK
The Enterprise Message API (EMA) and Enterprise Transport API (ETA) are included in the RTSDK package. Within the RTSDK Java Installation Guide, you can refer to the sections to obtain the download package, set up Gradle, and establish any dependencies required to run the packaged examples.
Select and configure a consumer sample
After you've installed the RTSDK package on your file system, you may test whether you can successfully obtain streaming data from your RTDS environment. Within the Building Examples section defined within the RTSDK Java Installation Guide, ensure you can generate a listing of the RTSDK examples. This will guarantee that your Gradle system is up and running before you try out one of the examples.
Once you have successfully listed the examples as outlined within the Installation Guide, then we can move to the Building and Running an Example using Gradle section within the guide. While there are many examples to try, for our purposes, we will simply consume some streaming market data from the platform using examples for both ETA and EMA.
To run an example, you will need to ensure you have the following:
- Server connection details
- Eg: ads:14002
- Eg: ads:14002
- Service providing market data
- Eg: MDSERVICE
- Eg: MDSERVICE
You will need to reach out to your market data team to get this required information.
Build and run the examples
As outlined within the Installation Gude, use Gradle to build the desired example (ETA: runVAConsumer; EMA: runconsumer100)
ETA
To list the command-line parameters:
> Gradlew runVAConsumer --args="-?"
And an example of how to run this test to retrieve streaming market data:
> Gradlew runVAConsumer --args="-c rtds:14002 ELEKTRON_AD mp:AAPL.O"
Upon execution, we are presented with some initial connection results followed by our initial image called a RefreshMsg. The RefreshMsg or initial image contains all fields for the requested instrument representing the latest up-to-date market values. Following this image, we will begin to see UpdateMsgs or real-time updates reflecting changes in the market.
The example application will automatically exit after ~1 minute. Alternatively, you can (Ctrl+C) to exit at any time.
Consumer initializing...
Channel Up Event: java.nio.channels.SocketChannel[connected local=/10.46.208.3:60241 remote=ewa/10.116.80.111:14002]
Received Login Refresh for Username: U8007876
LoginRefresh:
streamId: 1
name: U8007876
nameType: 1
State: Open/Ok/None - text: "Login accepted by host torsrmds11."
isSolicited: true
applicationId: 256
applicationName: ADS
position: 10.46.208.3/U8007876-TPL-A
providePermissionProfile: 0
providePermissionExpressions: 1
singleOpen: 1
allowSuspectData: 1
supportBatchRequests: 1
supportBatchReissues: 1
supportBatchCloses: 1
supportOMMPost: 1
supportOptimizedPauseResume: 0
supportStandby: 0
supportViewRequests: 1
Received Source Directory Refresh
DirectoryRefresh:
streamId: 2
State: Open/Ok/None - text: "null"
clearCache: true
solicited: true
filter: INFO | GROUP | STATE
Service:
serviceId: 779
InfoFilter:
serviceName: DELAY_CONFLATE1
vendor: Thomson Reuters
isSource: 0
supportsQosRange: 0
supportsOutOfBandSnapshots: 1
...
AAPL.O
DOMAIN: MARKET_PRICE
State: Open/Ok/None - text: "All is well"
1/PROD_PERM: 74
2/RDNDISPLAY: 66
3/DSPLY_NAME: APPLE INC
4/RDN_EXCHID: (0)
6/TRDPRC_1: 144.1499
7/TRDPRC_2: 144.15
8/TRDPRC_3: 144.15
9/TRDPRC_4: 144.155
10/TRDPRC_5: 144.155
11/NETCHNG_1: 1.2099
12/HIGH_1: 144.6
13/LOW_1: 142.78
14/PRCTCK_1: ■(2)
15/CURRENCY: USD(840)
16/TRADE_DATE: 21 SEP 2021
18/TRDTIM_1: 16:09:00:000:000:000
19/OPEN_PRC: 143.93
21/HST_CLOSE: 142.94
22/BID: 144.14
...
32741/TRNOVR_UNS: 5.7553131375547E9
32743/ACVOL_UNS: 40035669
(Channel java.nio.channels.SocketChannel[connected local=/10.46.208.3:60241 remote=ewa/10.116.80.111:14002]):
AAPL.O
DOMAIN: MARKET_PRICE
UPDATE TYPE: QUOTE
22/BID: 144.14
25/ASK: 144.15
30/BIDSIZE: 4.0
31/ASKSIZE: 7.0
11683/BIDFINMMID: <blank data>
11684/ASKFINMMID: <blank data>
3298/BIDXID: NAS(43)
3297/ASKXID: NAS(43)
6579/BID_COND_N: R
6580/ASK_COND_N: R
293/BID_MMID1: NAS
296/ASK_MMID1: NAS
1000/GV1_TEXT: A
8937/LIMIT_INDQ: BOE(25)
3887/SEQNUM_QT: 5.415158E7
118/PRC_QL_CD: (0)
3264/PRC_QL3: (0)
8406/QTE_ORIGIN:
1041/GV1_FLAG:
12783/NBBO_IND: 6 (5)
3855/QUOTIM_MS: 58182906
1025/QUOTIM: 16:09:42:000:000:000
14238/ORDRECV_MS: 16:09:42:906:000:000
14246/ORDREC2_MS: <blank data>
...
EMA
The majority of the EMA examples do not provide command-line parameters but instead require modification to the source code. From the RTSDK root directory, navigate to the source directory:
./Ema/Examples/src/main/java/com/refinitiv/ema/examples/training/consumer/series100/ex100_MP_Streaming
Within the Consumer.java source file, you can modify connection details for your specific environment. For example, within the main function, you will likely need to replace the 'localhost' and 'DIRECT_FEED' values to suit your environment setup. You may need to contact your market data team for these details.
OmmConsumerConfig config = EmaFactory.createOmmConsumerConfig();
consumer = EmaFactory.createOmmConsumer(config.host("localhost:14002").username("user"));
ReqMsg reqMsg = EmaFactory.createReqMsg();
consumer.registerClient(reqMsg.serviceName("DIRECT_FEED").name("IBM.N"), appClient);
Once the source file has been configured, you are ready to execute the EMA example:
> gradlew runconsumer100
The output will be similar to that of the ETA example.
Once you have successfully completed the steps above, you can further your learning by following the series of EMA tutorials or ETA tutorials.