ThomsonReuters.RFA.Data.Real conversion to decimal

Best Answer
-
The RFA.Data.Real has two properties -
Value - Data. Type: long
MagnitudeType- enumerated hint for how the value is to be interpreted. Type: RFA.Data.MagnitudeTypeEnumLets assume, you receive a message like this:
>>dataBuffer.Real
{Value : 44370000
MagnitudeType : 8
}Here the magnitude value of 8 expands to ExponentNeg6 (= 10^-6). So the resulting value should be interpreted as 44.370000.
If you know that RFA.Data.DataBuffer is of type Real, you can also use a handy property .Double to directly get the floating point number.
0
Answers
-
Hello @omar.isaid1
Real consist of (byte) MagnitudeType and (long) Value members;
The Value specifies the mantissa - the value as a whole number, the MagnitudeType indicates the fraction or exponent which applies to this Value member that would yield a decimal value.
MagnitudeType values are defined in MagnitudeTypeEnum, for example, MagnitudeTypeEnum.ExponentNeg2 indicates power of -2
So as an example the decimal value 32.35 can be represented using Real like this:real.MagnitudeType = MagnitudeTypeEnum.ExponentNeg2;
real.Value = 3235;
The decimal value could be obtained like this:
decimal dec = (Decimal)real.Value / 100;
0 -
Thank you very much dear , of course I know the nice RFA.NET .Double , but for some reason related to type of project I work in I have to use data in decimal data type not in float or double data type.Althugh , using double and float is great and easy way
I checked the Enum MsgTypeEnum , now if I have values like : Divisor4
ExponentPos7
NegInfinity what is the best decision to doI think for ExponentPos7 I have to move the comma of precision to right , but what about the other types like : Divisor , Infinity,NegInfinity , Exponent0 , ExponentPos?
0 -
The valid MagnitudeType values are defined in class MagnitudeTypeEnum.
Therefore the byte value 8 expands to the MagnitudeTypeEnum member that is assigned that value, that is: MagnitudeTypeEnum.ExponentNeg6.
0 -
I tried this method I wonder if it is true ?! if I had MagnitudeType divisor8 then : value number / 8 and so on . if I had Exponent0 then the value is power to 0 which means result =0 ?
0 -
Where did you get MsgTypeEnum from? The RFA.Data.Real has magnitude as defined in RFA.Data.MagnitudeTypeEnum.
Exponent0 = 10^0 = 1. So result = value * 1.
Divisor8 = 1/8. Result = value / 8.
ExponentPos5 = 10^5. Result = value * 100000
NegInfinity. Result = -∞
All other values are self explanatory.
0 -
Exponent0 means: 10^0
10^0 == 1 (any base to power 0 == 1)
So this means that when MagnitudeType == Exponent0 (byte value 14) the number expressed as a Decimal does not have a fractional component, e.g.
Given a Real value as follows:
real.Value = 1234; real.MagnitudeType = 14;
The equivalent decimal value will be:= 1234
0 -
Thank you very much so clear and great answer , I need to convert to Decimal for the type of my application because double may be cause round internally
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
- 690 Datastream
- 1.4K DSS
- 629 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 559 WebSocket API
- 39 FX Venues
- 15 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 25 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 280 Open PermID
- 45 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 2K Refinitiv Data Platform
- 717 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
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 95 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛