I am trying to get details of itemname 'US30YT=TWEB' with rfa8 java. I can see two field entries -
FIELD_ENTRY 22/BID: 95 56/256
FIELD_ENTRY 25/ASK: 95 64/256
are returning fraction values. How to handle this situation
I am trying to get details of itemname 'US30YT=TWEB' with rfa8 java. I can see two field entries -
FIELD_ENTRY 22/BID: 95 56/256
FIELD_ENTRY 25/ASK: 95 64/256
are returning fraction values. How to handle this situation
else if (data.getType() == OMMTypes.REAL) { OMMNumeric real64 = ((OMMNumeric) data); byte _hint = real64.getHint(); long _longVal= real64.getLongValue(); ps.println("[" + _hint+ "]["+longVal+"]"); }
For instance, just now US30YT=TWEB returned ASK as "[30][24284]" where hint value 30 is "DIVISOR_256" and we can translate the value to 24284/256 and yield the value "94 220/256".
As for US30YTWI=TWEB, the ASK returned "?[10][31280]", hint value 10 is EXPONENT_NEG4. Therefor, the true value should be 31280*(10**(-4)) and hence gives the value "3.1280"
Thanks,
--- Steve
Hello @applicationdevelopment
To convert a REAL field(fraction value) to double, you can use OMMNumeric.toDouble() which returns numeric converted to a double.
The example source code:
double doubleData = ((OMMNumeric) data).toDouble(); System.out.print(fiddef.getName()+" string is " + data + " and value is " + doubleData);
The example output:
BID string is 95 20/256 and value is 95.078125 ASK string is 95 32/256 and value is 95.125
For more detail of OMMNumeric's methods, please refer to <RFAJ package>\Docs\refman\rfajava\com\reuters\rfa\omm\OMMNumeric.html
Thank you for your quick response. We were comparing the responses for the two instrument codes US30YT=TWEB and US30YTWI=TWEB.
The refresh response for US30YTWI=TWEB comes back with decimal(double) notation for ASK and BID fields by US30YT=TWEB returns fractional notated value (e.g. 95 64/256) for the same ASK and BID fields.
Any reason why the field entry values are returned with different notation between these two instruments ?
thanks