question

Upvotes
Accepted
1 0 0 0

How to publish a price with double.MAXVALUE to subscriber using RFA.

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.

Upvotes
Accepted
78.2k 246 52 72

@liubo3.zh

It depends on the type of field which holds this data. If it is Real, you need to use encodeReal. You can verify it from the RDMFieldDictionary file.

!
!ACRONYM    DDE ACRONYM          FID  RIPPLES TO  FIELD TYPE     LENGTH  RWF TYPE   RWF LEN
!-------    -----------          ---  ----------  ----------     ------  --------   -------
!
TRDPRC_1   "LAST"                   6  TRDPRC_2    PRICE              17  REAL64           7

For example, if you are using the TRDPRC_1 field, you need to call encodeReal. However, TREP may be unable to cache the data (Double.MAX_VALUE) because the value may exceed the 7 bytes (the RWF maximum field length for caching).

Therefore, you may need to create your custom fields which a negative field identifier to hold the Double.MAX_VALUE in TREP cache.

Instead of using Double.MAX_VALUE, you can set it as blank for no value.

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.

Upvotes
1.5k 5 6 7

In what language?

I'll take a guess that you mean Double.MAX_VALUE, hence you are referring to Java?


Therefore my reply: Publish into a field of type DOUBLE . According to the RFA Javadocs it can hold such a value.


But I'm wondering:

  1. Why use IEEE floating point types? In the financial world, and in particular with market data, it is almost never acceptable to be inaccurate.
  2. Why do you want to publish a max value?


My 2c. :-)

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.

Upvotes
1 0 0 0
Thank you for you reply! Which api should i use to encode the pirce. encodeReal or encodeDoule, is there any different should we condsider? Why use IEEE floating point types? In the financial world, and in particular with market data, it is almost never acceptable to be inaccurate. --the price is from future market,which means no price. Why do you want to publish a max value? --the price is from future market,which means no price.
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.

Upvotes
1 0 0 0

Thanks for your reply.

Doule.max is a float data.

But wehen we use encode_doule api, we got a negative number which is not correct.

How to using encode_double 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.

Upvotes
78.2k 246 52 72

@liubo3.zh

I have tested with direct connection by running QSConsumer to connect to QSProvider.

1. I have added a custom field with double type into RDMFieldDictionary file

TEST_DOUBLE "TEST DOUBLE"        -12345    NULL    DOUBLE        0        DOUBLE                    8

Both QSProvider and QSConsumer use this local data dictionary.

2. Modify QSProvider to publish Double.MAX_VALUE in both refresh and update messages

        _encoder.encodeFieldEntryInit( (short)-12345, OMMTypes.DOUBLE);
        _encoder.encodeDouble(Double.MAX_VALUE);;

3. Modify QSConsumer to check for Double.MAX_VALUE

if(data.getType()==OMMTypes.DOUBLE) {
    double d = ((OMMNumeric)data).toDouble();
    if(d == Double.MAX_VALUE) {
         System.out.println("### Get Double.MAX_VALUE");
                              }
 }

The result from QSConsumer indicates that it can retrieve Double.MAX_VALUE in the custom double field (-12345 TEST_DOUBLE).

        FIELD_LIST
            FIELD_ENTRY 6/TRDPRC_1: 10.6000
            FIELD_ENTRY 22/BID: 10.4000
            FIELD_ENTRY 25/ASK: 10.8000
            FIELD_ENTRY 32/ACVOL_1: 700
            FIELD_ENTRY -12345/TEST_DOUBLE: ### Get Double.MAX_VALUE
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.