The value I am trying to publish is getting round-off how can I resolve it?
below is the example of value I am passing and what it is getting published.
Value passed :-
nestedFieldList.add(EmaFactory.createFieldEntry().realFromDouble(22, 5.0, OmmReal.MagnitudeType.EXPONENT_POS_1));
nestedFieldList.add(EmaFactory.createFieldEntry().realFromDouble(25, 4.9, OmmReal.MagnitudeType.EXPONENT_POS_1));
Value received after publish :-
Fid: 22 Name = BID DataType: Real Value: 10.0
Fid: 25 Name = ASK DataType: Real Value: 0.0
Can anyone please let me know how I can resolve it?
Answers
-
Thank you for reaching out to us.
Under the hood, the structure of real is:
boolean _isBlank;
int _hint;
long _value;When you set the value 5.0 with the MagnitudeType.EXPONENT_POS_1 (10^1) as a hint, the _value will be 0.5 which is not supported by long. I think it is converted to 1. Therefore, 1 * (10^1) is equal to 10.
When you set the value 4.9 with the MagnitudeType.EXPONENT_POS_1 (10^1) as a hint, the _value will be 0.49 which is not supported by long. I think it is converted to 0. Therefore, 0 * (10^1) is equal to 0.
You can try this one:
EmaFactory.createFieldEntry().realFromDouble(22, 5.0, OmmReal.MagnitudeType.EXPONENT_0); EmaFactory.createFieldEntry().realFromDouble(25, 4.9, OmmReal.MagnitudeType.EXPONENT_NEG_1);
0 -
Am getting below error when tried your suggestion
Exception in thread "pool-4-thread-1" Exception Type='OmmInvalidUsageException', Text='Passed in value is null', Error Code='-22'
0 -
Those code should not throw that exception.
Can you verify the call stack of that exception?
0 -
Exception in thread "pool-4-thread-1" Exception Type='OmmInvalidUsageException', Text='Passed in value is null', Error Code='-22'
at com.refinitiv.ema.access.EntryImpl.ommIUExcept(EntryImpl.java:592)
at com.refinitiv.ema.access.FieldEntryImpl.ascii(FieldEntryImpl.java:577)
at com.trep.publish.TrepPublishingClient.onRefreshMsg(TrepPublisher.java:98)
at com.refinitiv.ema.access.LoginCallbackClientConsumer.notifyOnRefreshMsg(LoginCallbackClient.java:992)
at com.refinitiv.ema.access.LoginItem.handleTimeoutEvent(LoginCallbackClient.java:1137)
at com.refinitiv.ema.access.TimeoutEvent.execute(TimeoutEvent.java:107)
at com.refinitiv.ema.access.OmmBaseImpl.rsslReactorDispatchLoop(OmmBaseImpl.java:1894)
at com.refinitiv.ema.access.OmmBaseImpl.run(OmmBaseImpl.java:2031)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)0 -
It relates to an ascii value.
What is in this line com.trep.publish.TrepPublishingClient.onRefreshMsg(TrepPublisher.java:98)?
0 -
nestedFieldList.add(EmaFactory.createFieldEntry().ascii(17, activ));
0 -
The activ may be null.
FieldList fieldList = EmaFactory.createFieldList();
String activ = null;
fieldList.add(EmaFactory.createFieldEntry().ascii(17, activ));The exception is:
Exception Type='OmmInvalidUsageException', Text='Passed in value is null', Error Code='-22'
at com.refinitiv.ema.access.EntryImpl.ommIUExcept(EntryImpl.java:605)
at com.refinitiv.ema.access.FieldEntryImpl.ascii(FieldEntryImpl.java:583)
at com.refinitiv.ema.examples.training.consumer.series100.ex100_MP_Streaming.Consumer.main(Consumer.java:58)0 -
Have removed the activ and tried with the EXPONENT_0 but it is also rounding off the values.
Can you please suggest any generic solution for all Double fields I am using as below?
nestedFieldList.add(EmaFactory.createFieldEntry().realFromDouble(22, getBid(), OmmReal.MagnitudeType.EXPONENT_0));
0 -
I Resolved it by passing numeric value.
Thanks for your time
0 -
If you want one decimal point, you can use the OmmReal.MagnitudeType.EXPONENT_NEG_1.
If you want two decimal points, you can use the OmmReal.MagnitudeType.EXPONENT_NEG_2.
1 -
Ok.
0 -
For your information, am trying to use below values of bid & ask
0.9521
0.9521_1
0.6473
0.6473
0.04003
0.04003
5.55
5.4
1.0499
1.0499
0.134029
0.134029
1.2008
1.2008
0.119091
0.119091
0.2484
0.2484
0.559
0.559
0.010806
0.010806
0.6138
0.6138
0.5319
0.5319
0.2386
0.2386
0.0923
0.0923
0.6913
0.6913
0.02733
0.02733
0.9261
0.9261
0 -
For your information, am trying to use below values of bid & ask
0.9521
0.9521_1
0.6473
0.6473
0.04003
0.04003
5.55
5.4
1.0499
1.0499
0.134029
0.134029
1.2008
1.2008
0.119091
0.119091
0.2484
0.2484
0.559
0.559
0.010806
0.010806
0.6138
0.6138
0.5319
0.5319
0.2386
0.2386
0.0923
0.0923
0.6913
0.6913
0.02733
0.02733
0.9261
0.9261
0 -
For your information, am trying to use below values of bid & ask
0.9521
0.9521_1
0.6473
0.6473
0.04003
0.04003
5.55
5.4
1.0499
1.0499
0.134029
0.134029
1.2008
1.2008
0.119091
0.119091
0.2484
0.2484
0.559
0.559
0.010806
0.010806
0.6138
0.6138
0.5319
0.5319
0.2386
0.2386
0.0923
0.0923
0.6913
0.6913
0.02733
0.02733
0.9261
0.9261
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 684 Datastream
- 1.4K DSS
- 615 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 249 ETA
- 554 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 643 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 192 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛