For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
25 3 1 6

how to specify list of fields to receive in the request, Java SDK

I want to specify currency for RIC in which I need a price,

how I can do it ?

Also it would be great to specify exact list of fields.

I would appreciate it if you could give me a code snippet

elektronrefinitiv-realtimeelektron-sdkjavafields
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.

@monakhov

Thank you for your participation in the forum. Are any of the replies below satisfactory in resolving your query? If yes please click the 'Accept' text next to the most appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Upvotes
Accepted
9.5k 10 5 7

Hello @monakhov

Elektron SDK Java Packages provide example360__MarketPrice__View demonstrating how to use View in EMA Java, the application source code is in <Elektron-SDK_Java_Package> \Java\Ema\Examples\src\main\java\com\thomsonreuters\ema\examples\training\consumer\series300\example360__MarketPrice__View, please modify Consumer.java as the following:

  • Modify .host("localhost:14002").username("user") to be your server host and username
  • After array.add(EmaFactory.createOmmArrayEntry().intValue(25)); line add the currency field id(15) line:
array.add(EmaFactory.createOmmArrayEntry().intValue(15));//field id of the currency
  • Modify .serviceName("DIRECT_FEED").name("IBM.N") to be your service and your RIC(ASML.AS).

Then compile and run the example360__MarketPrice__View application.You should see the currency as the example shown below:


currencyview.png (7.2 KiB)
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
9.5k 10 5 7

Hello @monakhov

You cannot specify the currency for RIC. The currency is set by the feed and cannot be changed by any APIs. After EMA Java sends a RIC request, it will receive data of the RIC including the currency generated by the feed and pass to the application.

View feature allows you to specify a list of fields to receive in the request. For more details and example snipped source code, please refer to Elektron Messaging API (Java) - Batch and View features

Hope this help.

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.

Upvotes
25 3 1 6

I try to repeat a code snippet from the manual but got an exception:

long handle = ommConsumer.registerClient(EmaFactory.createReqMsg().serviceName("IDN_INTERVAL_5S").name("ASML.AS").payload(view), priceEventHandler);

exception:

2019-05-09 09:43:04,325 INFO [pool-2-thread-9] c.s.c.a.r.a.v.ReutersIntradayClient Subscribing: Subscription[ric=ASML.AS,price=0.0,priceUpdated=false,assetClass=EQUITY,listingId=ListingId[instrumentId=id2,exchange=AS,currency=EUR]]
2019-05-09 09:43:04,325 ERROR [pool-2-thread-9] c.s.m.e.c.LoggingEventConsumerDecorator Exception while processing message
java.lang.ClassCastException: class com.thomsonreuters.upa.codec.ArrayImpl cannot be cast to class com.thomsonreuters.upa.codec.ElementListImpl (com.thomsonreuters.upa.codec.ArrayImpl and com.thomsonreuters.upa.codec.ElementListImpl are in unnamed module of loader 'app')
at com.thomsonreuters.upa.codec.Decoders.decodeElementEntry(Decoders.java:1099)
at com.thomsonreuters.upa.codec.ElementEntryImpl.decode(ElementEntryImpl.java:122)
at com.thomsonreuters.ema.access.ReqMsgImpl.checkBatchView(ReqMsgImpl.java:788)
at com.thomsonreuters.ema.access.ReqMsgImpl.payload(ReqMsgImpl.java:609)
at ReutersIntradayClient.subscribe(ReutersIntradayClient.java:78)

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.

@monakhov

I have found the same error. Please use the following code instead.

ElementList view = EmaFactory.createElementList();
view.add(EmaFactory.createElementEntry().uintValue(EmaRdm.ENAME_VIEW_TYPE, 1));
view.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_VIEW_DATA, array));
monakhov avatar image monakhov veerapath.rungruengrayubkul

thank you very much it works!

Upvotes
15.2k 40 12 19

Hi @monakhov, Like others have mentioned, you cannot specify the currency for the returned quote, but it is possible to subscribe to your desired currency pair and recalculate the price in your code (provided user has permission to get FX data).

E.g: To convert Bid price for ASML.AS = 178.28 EUR into USD, another snapshot request can be made to EUR= to get the currency spot rate.


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.