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
Hello @monakhov
Elektron SDK Java Packages provide example360__MarketPrice__Viewdemonstrating 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:
array.add(EmaFactory.createOmmArrayEntry().intValue(15));//field id of the currency
Then compile and run the example360__MarketPrice__Viewapplication.You should see the currency as the example shown below:
You cannot specify the currency for RIC. The currency is set bythe feed and cannot be changed by any APIs. After EMA Java sends a RIC request, it will receivedata of the RIC including the currency generated by the feed and pass to theapplication.
View feature allows you to specify a list of fields to receivein the request. For more details and example snipped source code, please referto Elektron Messaging API (Java) - Batch and View features
Hope this help.
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 messagejava.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)
@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));
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.