when i deal with a response of item, can i get the bid/ask and datetime as String?

when i decode the OMMMsg i want to get the bid/ask as the format of String, if i use the api :toString(), can i get it as "10.22" or the tostring() method will return in a different way? and it is the similar question about "VALUE_DATE" field, if i use tostring() method, can i get the expected string as "02 SEP 2017"?

Tagged:

Best Answer

  • BID and ASK fields are of type REAL. For these types, the toString() method returns a value which is suitable for presentation in the English language. The value is not suitable for parsing other than with RFA itself as it may contain such values ""Inf", "-Inf", "NaN", fractions and what not. The decimal separator will always be dot (.) (regardless of your locale) and there will never be a thousands separator in the value. Example value: "-235373599.44". So judging from your question, the toString() method will suit your need, except that fractions will never be translated to decimals but will be presented in their exact form namely as fractions. But the use of fractional values is rare. I think parts of the US Treasury Bond market still use them, but other than that ?? They kind of went out of fashion in the financial markets 10-15 years ago.

    VALUE_DATE is of type DATE. For this type, the toString()
    method returns a value which is suitable for presentation in the English
    language, namely the form "DD MON YYYY", where 'MON' is a capitalized 3-letter month abbreviation in the English language. (regardless of your locale). The day-of-month is always prefixed with zero to the length of 2. The year is always 4 digits. Example value: "02 OCT 2017". So judging from your question, the toString() method will suit your need.

    For both types an empty string - rather than null - is returned if the value is blank.