question

Upvotes
Accepted
15 2 6 11

RTSDK C++: How to get back instrument data

I am trying to read data for an instrument using RTSDK/C++. I have copied the sample code from Examples/Training/Consumer/400_Series/450_MP_QueryServiceDiscovery/Consumer.cpp and added a handle variable:

// Query endpoints from RDP service discovery for the TCP protocol

ServiceEndpointDiscovery serviceDiscovery(tokenUrl, serviceDiscoveryUrl);

serviceDiscovery.registerClient( ServiceEndpointDiscoveryOption().username( userName ).password( password )

.clientId( clientId ).transport( transportProtocol ).takeExclusiveSignOnControl( takeExclusiveSignOnControl )

.proxyHostName( proxyHostName ).proxyPort( proxyPort ).proxyUserName( proxyUserName ).proxyPassword( proxyPasswd )

.proxyDomain( proxyDomain ), client );


createProgramaticConfig( configDb );


OmmConsumer consumer( config.consumerName( "Consumer_1" ).username( userName ).password( password )

.clientId( clientId ).config( configDb ).takeExclusiveSignOnControl( takeExclusiveSignOnControl )

.tunnelingProxyHostName( proxyHostName ).tunnelingProxyPort( proxyPort )

.proxyUserName( proxyUserName ).proxyPasswd( proxyPasswd ).proxyDomain( proxyDomain ) );


Int64 closure = 1;

UInt64 itemHandle = consumer.registerClient(ReqMsg().serviceName("ELEKTRON_DD").name("IBM.N"), client, (void*)closure);

consumer.reissue(ReqMsg().serviceName("ELEKTRON_DD").name("IBM.N").priority(2, 2), itemHandle);

sleep(60000);

consumer.submit(PostMsg().payload(FieldList().addInt(1, 100).complete()), itemHandle);

sleep( 900000 ); // API calls onRefreshMsg(), onUpdateMsg(), or onStatusMsg()


I get a handle, but the submit() throws an exception:

Attempt to use invalid Handle on submit( const PostMsg& ). Instance name='Consumer_1_1'.

None of the trigger functions, like OnReqMsg() are called

How do I consume data for an instrument?

Should I have a loop, waiting on messages?

ema-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
25.3k 87 12 25

Hi @manjinder.singh

Am I right in thinking you want to consume data e.g. for IBM.N from ELEKTRON_DD service?

If so, why are you calling reissue and also why are you calling submit with a PostMsg? The submit with PostMsg would only be used if you were Posting/Contributing data to a contribution service. The ELEKTRON_DD service on RTO does NOT accept posting/contributions of data. To contribute data you would need to use a locally deployed Contribution engine OR our Refinitiv Contributions Channel service.

Please work through the EMA C++ tutorials which should provide a good understanding regards the basics of subscribing to an instrument and decoding the response

Also, you mention that none of the on event handlers are being called.

So, what output do you see when you run the Cons450 example without your additional reissue and submit calls? Please provide the console output (minus any credentials)

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Basically I've taken out the reissue and submit lines now and the code just exits without calling any event handlers, even if I try a different instrument, like VOD.L


I just want market price data for instruments in the FTSE100 and AIM100 lists


Do I need some permissions enabled to get this type of data for an instrument?

Upvotes
25.3k 87 12 25

Hi @manjinder.singh

Thanks for replying - however, you have not posted any console output etc as requested above - so we can't take a guess at what might be going wrong? Please provide console output as requested.

Your connection may be failing, your credentials may be wrong, you may not be licenced for the particular instruments you are trying to request.

If you were connecting successfully but not licenced for VOD.L or IBM.N - you would at least expect to see a Status Msg advising that you are not entitled to that RIC.

You may also find a log file in your working folder which you can post.

Also, you can try enabling XML Trace as described in this article - note this will not generate anything unless you actually connect successfully.

Can you also try with a generally free RIC such as 'EUR=' which may help confirm if it is a licence issue or otherwise?

consumer.registerClient(ReqMsg().serviceName("ELEKTRON_DD").name("EUR="), client, (void*)closure);

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sorry, our application is not a console application, hence why I didn't provide output

I do log to a file and the only event called is onSuccess(), where I print out the host and port:

onSuccess, host eu-west-1-aws-3-sm.optimized-pricing-api.refinitiv.net, port 14002

Also emaLog shows this:

loggerMsg

TimeStamp: 09:43:41.993

ClientName: EmaConfig

Severity: Error

Text: error reading configuration file [EmaConfig.xml]; file is empty

loggerMsgEnd


loggerMsg

TimeStamp: 09:43:41.994

ClientName: EmaConfig

Severity: Error

Text: failed to extract configuration from path []

loggerMsgEnd


loggerMsg

TimeStamp: 09:43:43.678

ClientName: ChannelCallbackClient

Severity: Success

Text: Received ChannelUp event on channel Channel_1

Instance Name Consumer_1_1

Connected component version: ads3.4.2.L1.linux.tis.rrg 64-bit

loggerMsgEnd


I don't get any other events or error. I get a handle back from consumer.registerClient()

I tried the free "EUR=" RIC, but again, I don't get the onReqMsg() event

I believe my credentials are correct, because if I send an invalid item, I do get an error

As I said, the code is literally the same as the example code

I've just compiled the standalone console example application

Here is the output (removed some services) for RIC EUR=:

Services :

Service :

Provider : aws

Transport : tcp

Endpoint : us-east-1-aws-1-sm.optimized-pricing-api.refinitiv.net

Port : 14002

Data Format : rwf

Location : us-east-1a

Service :

Provider : aws

Transport : tcp

Endpoint : us-east-1-aws-3-sm.optimized-pricing-api.refinitiv.net

Port : 14002

Data Format : rwf

Location : us-east-1a us-east-1b

Service :

Provider : aws

Transport : tcp

Endpoint : us-east-1-aws-2-sm.optimized-pricing-api.refinitiv.net

Port : 14002

Data Format : rwf

Location : us-east-1b


StatusMsg

streamId="5"

domain="MarketPrice Domain"

state="Closed / Suspect / Not entitled / 'Access Denied: User req to PE(526)'"

name="EUR="

nameType="1"

serviceId="257"

serviceName="ELEKTRON_DD"

StatusMsgEnd


For VOD.L:

StatusMsg

streamId="5"

domain="MarketPrice Domain"

state="Closed / Suspect / Not entitled / 'Access Denied: User req to PE(5625)'"

name="VOD.L"

nameType="1"

serviceId="257"

serviceName="ELEKTRON_DD"

StatusMsgEnd

Upvotes
25.3k 87 12 25

Hi @manjinder.singh

The above output confirms that whilst your MachineID etc are valid in terms of logging into the server, the actual account has not been licensed correctly - therefore you see the Status Msgs

Closed / Suspect / Not entitled / 'Access Denied: User req to PE(526)'"

Please speak to your Refinitiv Account team to confirm which exchange/asset classes you are permissioned for.

If you have been told you are on a Trial account, then please try using the delayed form of the RICs such as /EUR= and /VOD.L e.g.

  1. consumer.registerClient(ReqMsg().serviceName("ELEKTRON_DD").name("/EUR="), client, (void*)closure);
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thank you so much @umer.nalla for you help and support

I get data back with the delayed form

I have already requested access to FTSE100 and AIM100 instruments from Refinitiv

Upvotes
3 0 0 4

AppClient client;



// create OMM consumer


OmmConsumer consumer(


OmmConsumerConfig()


.host( "ADS:14002" )


.username( "user1" )


);


what will be the Host IP address for TCP/IP login and username?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.