question

Upvotes
Accepted
16 2 3 4

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"?

treprfarfa-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Monitored by @Nipat Kunvutipongsak

@1069772808

Thank you for your participation in the forum.

Are any of the replies below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the most appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Hi @1069772808

Thank you for your participation in the forum.

Are any of the replies below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the most appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

AHS

1 Answer

· Write an Answer
Upvotes
Accepted
1.5k 5 6 7

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.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.