question

Upvotes
Accepted
13 2 2 7

Is there anyway to specify what to return for the price tick?

I was going through the data dictionary and saw that in the enumtype.def file we have RTMES encoding for PRCTCK_1. I have read through the developers guide regarding RTMES decoding and was wondering if there is any other way to decode this so that we have UTF-8.

If not, is there a way to specify to return U or D for uptick and downtick respectively?

I have also seen in the enumtype.def file that for PRCTCK_1 there is enumeration for " U", " D", " +", " -". Is there a way to choose to use these enumerated values?

elektronrefinitiv-realtimeelektron-sdkrrteta-apielektron-transport-api
icon clock
10 |1500

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

1 Answer

Upvotes
Accepted
11.3k 25 8 13

@manning0218

Do you mean that you don't want to use RMTES decoding for RMTES enum values of the PRCTCK_1 field?

The enum data normally is provided in UInt16 from provider. ETA application uses the getFieldEntryEnumType function to get corresponding enumerated information such as value display, meaning loaded which is loaded from the enumtype.def file.

If you want to change the display value of a enumeration, you may manually verify if the display value is 0xDE or 0xFE and then returns "U" or "D" instead.

Anyway, I recommend RMTES decoding for enum values. Below is the sample code demonstrating how to decode RMTES enum values to UTF-8.

RsslRet
decodeFieldEntry(RsslFieldEntry* fEntry, RsslDecodeIterator *dIter)
{    
…
case RSSL_DT_ENUM:
if ((ret = rsslDecodeEnum(dIter, &fidEnumValue)) == RSSL_RET_SUCCESS)
{
    RsslEnumType *pEnumType = getFieldEntryEnumType(dictionaryEntry, fidEnumValue);
    if (pEnumType)
    {
        /* create cache buffer for storing RMTES and applying partial updates */
        RsslRmtesCacheBuffer rmtesCache;
        char cacheSpace[100];
        /* create RsslBuffer to convert into */
        RsslBuffer utf8Buffer;
        char convertSpace[100];
        int i = 0;
        RsslRet retVal = 0;

        /* populate cache and conversion buffers with created memory */
        rmtesCache.data = cacheSpace;
        rmtesCache.length = 0; /* this is the used length, since cache starts out empty it should start at 0 */
        rmtesCache.allocatedLength = 100;
        utf8Buffer.data = convertSpace;
        utf8Buffer.length = 100;
        /* apply RMTES content to cache, if successful convert to UTF-8 */
        if ((retVal = rsslRMTESApplyToCache(&(pEnumType->display), &rmtesCache)) < RSSL_RET_SUCCESS)
        {
            /* error while applying to cache */
            printf("Error %s (%d) encountered while applying buffer to RMTES cache. Error Text: %s\n",
            rsslRetCodeToString(retVal), retVal, rsslRetCodeInfo(retVal));
        }
        else if ((retVal = rsslRMTESToUTF8(&rmtesCache, &utf8Buffer)) < RSSL_RET_SUCCESS)
        {
            /* error when converting */
            printf("Error %s (%d) encountered while converting from RMTES to UTF-8. Error Text: %s\n",
            rsslRetCodeToString(retVal), retVal, rsslRetCodeInfo(retVal));
        }
        else
        {
            /* SUCCESS: conversion was successful – application can now use converted content */
            for (i = 0; i < utf8Buffer.length; i ++) {
                    printf(" %x", (unsigned char)utf8Buffer.data[i]);
                }
                printf("(%d)\n", pEnumType->value);
            }
    }    
    else
        printf("%d\n", fidEnumValue);
}
else if (ret != RSSL_RET_BLANK_DATA)
{
    printf("rsslDecodeEnum() failed with return code: %d\n", ret);
    return ret;
}
break;
icon clock
10 |1500

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

We don't want to use the RMTES enum values just because the decoding for RMTES to UTF-8 is costly. We will have to do decode for all our enum values and if we have say 20 enum values come back in which 19 do not need to use the RMTES decoding then we are adding a lot of overhead from my understanding.

Click below to post an Idea Post Idea