RFA. Snapshot returns 0 instead of empty field

igorg
igorg Advocate

We
use RFA API to get the data from different exchanges..

For
the tickers that are not traded today we expect empty values for the LAST,
HIGH, LOW, OPEN…

In
this case we rely on API message type check:

TibMsg_type tibType = fld.Type();

if ( tibType == TibMsg_type::TIBMSG_NODATA && fld.Size() == 0)
...

However,
it seems we are getting 0 instead. I compared the data from Eikon and Eikon
shows empty values or ‘-’.

Sample
ticker: CAVUSD.SN. How can we differentiate the 0 values that mean empty and real zeros?

P.S. I've talked to content and advance support team and they advised me to submit query here.

Tagged:

Best Answer

  • @igorg

    For MarketFeed data, there are two type of 0 value; blank data(+0) and actual zero value(-0). Application can differentiate those values with TibMsg api via hint data(TSS_HINT_BLANK_VALUE(127))

    Below is the sample of usage.

    #include "tsshints.h"
    ...
    err = tMsg.Get("AVTURNOVER", fldTmp);
    if (!err.code)
    {
    fldTmp.Convert(sField);
    std::cout << "AVTURNOVER: ";
    if (*(Tib_u8*)fldTmp.HintData() == TSS_HINT_BLANK_VALUE)
    printf("<Blank>");
    else
    printf("%0.2f\t", sField);
    }

Answers

  • Hi @igorg, These fields are defined in the data dictionary as price fields and they cannot contain non-numeric value:

    TRDPRC_1   REAL64
    HIGH_1 REAL64
    LOW_1 REAL64
    OPEN_PRC REAL64

    Your application should check if the field is blank or not, by invoking the ```OMMData.isBlank()``` method, and suppress displaying 0 as a result. See an example implementation in the Examples\Common\GenericOMMParser.cpp file in the RFA SDK.

  • We are not using OMM API. We're using RFA API with tibco message.

  • Hi @igorg

    Can you confirm how exactly you are extracting the '0' value from the field?

    In terms of MarketFeed data format my understanding is that a string of "+0" indicates an empty field.

    As a side note, is this a new application you are developing or an existing one you are debugging?

    If you are developing a new application I would strongly urge you to explore our Elektron Message API (EMA). RFA is a feature complete API and MarketFeed is considered a legacy data format. Most of our clients are moving away from MarketFeed data - if they have not already done so.

    As well as being considerably easier to learn, code and maintain - just one benefit of Elektron Message API is that it uses our newer OMM data format - which amongst other things supports the concept of blank / empty data fields.

    For more details on OMM please refer to this whitepaper

    For more details on EMA which is part of the Elektron SDK please refer here

    You may also find this short video useful- Why Migrate from RFA to EMA?

  • To check what data we receive in the message I used this code from one of the samples to log the data to the file:

        char bufff[40];
    memset(bufff, 0, sizeof(bufff));
    TibErr error;
    error = fld.Convert(bufff, sizeof(bufff));
    stringstream os;
    if (error.code == TIBMSG_OK)
    {
    os << fld.Name() << ": " << bufff;
    }
    else
    {
    os << fld.Name() << ": " << "{ERROR}";
    }

    This is old application and there is no plan to migrate yet.

  • zoya faberov
    zoya faberov ✭✭✭✭✭

    Hello @igorg,

    As an additional note, as perhaps it is pertaining to the check failure,

    Instrument CAVUSD.SN does not carry

    LAST, HIGH, LOW, OPEN fids in the initial refresh,

    could this be the cause of the confusion?

    SSL_ET_ITEM_IMAGE  Chan: 0 ServiceName: ELEKTRON_EDGE ItemName: CAVUSD.SN DataFormat: 2 DataDescriptor: 0 DataLength: 1609 SequenceNum: 0 ClientItemTag: 42891248 PreviousName:  NextName:  GroupId: 2 ItemState: SSL_IS_OK StateInfoCode: SSL_INFO_NONE Text: All is well
    <FS>340<US>XX<GS>CAVUSD.SN<US>79<US>1<RS>
    PROD_PERM : UINT 3 : [246]
    RDNDISPLAY : UINT 2 : [64]
    DSPLY_NAME : STRING 16 : [CAMROVA RESOU US]
    RDN_EXCHID : ENUM 3 : [166]
    TRDPRC_1 : REAL 2 : [+0]
    TRDPRC_2 : REAL 2 : [+0]
    TRDPRC_3 : REAL 2 : [+0]
    TRDPRC_4 : REAL 2 : [+0]
    TRDPRC_5 : REAL 2 : [+0]
    NETCHNG_1 : REAL 2 : [+0]
    HIGH_1 : REAL 2 : [+0]
    LOW_1 : REAL 2 : [+0]
    PRCTCK_1 : ENUM 1 : [0]
    CURRENCY : ENUM 3 : [840]
    TRADE_DATE : DATE 11 : [ ]
    TRDTIM_1 : TIME 5 : [ : ]
    OPEN_PRC : REAL 2 : [+0]
    HST_CLOSE : REAL 2 : [+0]
    BID : REAL 2 : [+0]
    BID_1 : REAL 2 : [+0]
    BID_2 : REAL 2 : [+0]
    ASK : REAL 2 : [+0]
    ASK_1 : REAL 2 : [+0]
    ASK_2 : REAL 2 : [+0]
    NEWS : STRING 4 : [ ]
    NEWS_TIME : TIME 5 : [ : ]
    BIDSIZE : REAL 2 : [+0]
    ASKSIZE : REAL 2 : [+0]
    ACVOL_1 : REAL 2 : [+0]
    EARNINGS : REAL 2 : [+0]
    YIELD : REAL 2 : [+0]
    PERATIO : REAL 2 : [+0]
    DIVIDENDTP : ENUM 1 : [0]
    DIVPAYDATE : DATE 11 : [ ]
    EXDIVDATE : DATE 11 : [ ]
    CTS_QUAL : ENUM 1 : [0]
    BLKCOUNT : REAL 2 : [+0]
    BLKVOLUM : REAL 2 : [+0]
    TRD_UNITS : ENUM 1 : [3]
    LOT_SIZE : REAL 2 : [+1]
    PCTCHNG : REAL 2 : [+0]
    OPEN_BID : REAL 2 : [+0]
    DJTIME : TIME 5 : [ : ]
    CLOSE_BID : REAL 2 : [+0]
    CLOSE_ASK : REAL 2 : [+0]
    DIVIDEND : REAL 2 : [+0]
    NUM_MOVES : REAL 2 : [+0]
    OFFCL_CODE : STRING 72 : [<0x00><0x00><0x00><0x00><0x00><0x00><0x00><0x00><0x00><0x00><0x00><0x00>]
    HSTCLSDATE : DATE 11 : [ ]
    YRHIGH : REAL 2 : [+0]
    YRLOW : REAL 2 : [+0]
    TURNOVER : REAL 2 : [+0]
    BOND_TYPE : ENUM 1 : [0]
    BCKGRNDPAG : STRING 4 : [ ]
    YCHIGH_IND : ENUM 1 : [0]
    YCLOW_IND : ENUM 1 : [0]
    BID_NET_CH : REAL 2 : [+0]
    BID_TICK_1 : ENUM 1 : [0]
    CUM_EX_MKR : ENUM 1 : [0]
    PRC_QL_CD : ENUM 1 : [0]
    NASDSTATUS : ENUM 1 : [0]
    PRC_QL2 : ENUM 1 : [0]
    TRDVOL_1 : REAL 2 : [+0]
    LOT_SIZE_A : REAL 2 : [+1]
    BID_HIGH_1 : REAL 2 : [+0]
    BID_LOW_1 : REAL 2 : [+0]
    YRBIDHIGH : REAL 2 : [+0]
    YRBIDLOW : REAL 2 : [+0]
    HST_CLSBID : REAL 2 : [+0]
    YRBDHI_IND : ENUM 1 : [0]
    YRBDLO_IND : ENUM 1 : [0]
    NUM_BIDS : REAL 2 : [+0]
    RECORDTYPE : UINT 3 : [113]
    BID_MMID1 : STRING 4 : [ ]
    ASK_MMID1 : STRING 4 : [ ]
    OPTION_XID : STRING 36 : [<0x00><0x00><0x00><0x00><0x00><0x00>]
    YRHIGHDAT : DATE 11 : [ ]
    YRLOWDAT : DATE 11 : [ ]
    IRGPRC : REAL 2 : [+0]
    IRGVOL : REAL 2 : [+0]
    IRGCOND : ENUM 1 : [0]
    TIMCOR : TIME 8 : [ : : ]
    INSPRC : REAL 2 : [+0]
    INSVOL : REAL 2 : [+0]
    INSCOND : ENUM 1 : [0]
    SALTIM : TIME 8 : [ : : ]
    TNOVER_SC : ENUM 1 : [3]
    BCAST_REF : STRING 10 : [CAVUSD.SN ]
    CROSS_SC : ENUM 1 : [0]
    AMT_OS : REAL 2 : [+0]
    AMT_OS_SC : ENUM 1 : [0]
    OFF_CD_IND : ENUM 1 : [0]
    PRC_VOLTY : REAL 2 : [+0]
    AMT_OS_DAT : DATE 11 : [ ]
    BKGD_REF : STRING 0 : []
    GEN_VAL1 : REAL 2 : [+0]
    GEN_VAL2 : REAL 2 : [+0]
    GEN_VAL3 : REAL 2 : [+0]
    GEN_VAL4 : REAL 2 : [+0]
    GV1_TEXT : STRING 36 : [<0x00><0x00><0x00><0x00><0x00><0x00>]
    GV2_TEXT : STRING 36 : [<0x00><0x00><0x00><0x00><0x00><0x00>]
    GV3_TEXT : STRING 36 : [<0x00><0x00><0x00><0x00><0x00><0x00>]
    GV4_TEXT : STRING 36 : [<0x00><0x00><0x00><0x00><0x00><0x00>]
    SEQNUM : REAL 2 : [+0]
    PRNTYP : STRING 6 : [<0x00>]
    PRNTBCK : REAL 2 : [+0]
    QUOTIM : TIME 8 : [ : : ]
    GV1_FLAG : STRING 6 : [<0x00>]
    GV2_FLAG : STRING 6 : [<0x00>]
    GV3_FLAG : STRING 6 : [<0x00>]
    GV4_FLAG : STRING 6 : [<0x00>]
    OFF_CD_IN2 : ENUM 1 : [0]
    OFFC_CODE2 : STRING 12 : [000000CAVUSD]
    GV1_TIME : TIME 8 : [ : : ]
    GV2_TIME : TIME 8 : [ : : ]
    EXCHTIM : TIME 8 : [ : : ]
    YRHI_IND : ENUM 1 : [0]
    YRLO_IND : ENUM 1 : [0]
    BETA_VAL : REAL 2 : [+0]
    PREF_DISP : UINT 3 : [UEA]
    DSPLY_NMLL : STRING 32 : [ ]
    VOL_X_PRC1 : REAL 2 : [+0]
    DSO_ID : UINT 3 : [@lJ]
    AVERG_PRC : REAL 2 : [+0]
    UPC71_REST : STRING 6 : [<0x00>]
    ADJUST_CLS : REAL 2 : [+0]
    WEIGHTING : REAL 2 : [+0]
    STOCK_TYPE : STRING 18 : [<0x00><0x00><0x00>]
    IMP_VOLT : REAL 2 : [+0]
    RDN_EXCHD2 : ENUM 3 : [166]
    CP_ADJ_FCT : REAL 2 : [+0]
    CP_ADJ_DAT : DATE 11 : [ ]
    MKT_VALUE : REAL 2 : [+0]
    SPEC_TRADE : REAL 2 : [+0]
    FCAST_EARN : REAL 2 : [+0]
    EARANK_RAT : REAL 2 : [+0]
    FCAST_DATE : DATE 11 : [ ]
    YEAR_FCAST : STRING 24 : [<0x00><0x00><0x00><0x00>]
    IRGMOD : ENUM 1 : [0]
    INSMOD : ENUM 1 : [0]
    GV3_TIME : TIME 8 : [ : : ]
    GV4_TIME : TIME 8 : [ : : ]
    IRGFID : REAL 2 : [+0]
    IRGVAL : REAL 2 : [+0]
    PCT_ABNVOL : REAL 2 : [+0]
    BC_10_50K : REAL 2 : [+0]
    BC_50_100K : REAL 2 : [+0]
    BC_100K : REAL 2 : [+0]
    PMA_50D : REAL 2 : [+0]
    PMA_150D : REAL 2 : [+0]
    PMA_200D : REAL 2 : [+0]
    VMA_10D : REAL 2 : [+0]
    VMA_25D : REAL 2 : [+0]
    VMA_50D : REAL 2 : [+0]
    OPN_NETCH : REAL 2 : [+0]
    CASH_EXDIV : REAL 2 : [+0]
    MKT_VAL_SC : ENUM 1 : [0]
    CASH_EXDAT : DATE 11 : [ ]
    @]
    PRC_QL3 : ENUM 1 : [0]
    MPV : ENUM 1 : [0]
    OFF_CLOSE : REAL 2 : [+0]
    QUOTE_DATE : DATE 11 : [ ]
    VWAP : REAL 2 : [+0]
    PROV_SYMB : STRING 32 : [CAVUSD ]
    BID_ASK_DT : DATE 11 : [ ]
    ISIN_CODE : STRING 35 : [<0x00><0x00><0x00><0x00> ]
    MNEMONIC : STRING 20 : [CAVUSD ]
    RTR_OPN_PR : REAL 2 : [+0]
    SEDOL : STRING 72 : [<0x00><0x00><0x00><0x00><0x00><0x00><0x00><0x00><0x00><0x00><0x00><0x00>]
    TRDTIM_MS : UINT 2 : [+0]
    SALTIM_MS : UINT 2 : [+0]
    QUOTIM_MS : UINT 2 : [+0]
    TIMCOR_MS : UINT 2 : [+0]
    CONTEXT_ID : REAL 5 : [+1485]
    DDS_DSO_ID : UINT 3 : [O@B]
    SPS_SP_RIC : STRING 15 : [.[SPSIDNAM13002]
    Image Received.
  • Hi @igorg

    Can you check with your Market Data team to see how their TREP components are configured?

    There is an ADS parameter - convertToIDNStyle which controls how legacy format data in published

    image

    If this is configured correctly, then you should raise a Support ticket with the Developer Support team so they can perform detailed offline investigation.

  • I will try to find out our configuration.. But based on your screenshot (and our code) we're expecting convertToIDNStyle is set to false. But I didn't see any fields reported with zero length. At the same time, if it's set to True, I would see some '+0' , and I don't see them at all..

    Also, empty time fields look like : ' : '.

  • What is "your Marketdata team"? I've asked here and seems we don't know.

  • Let me try this today and I will get back with the result.

    Thanks

  • I can see this hint only for double values. Will it work for INT ?

  • @igorg I have tried some tests on INTEGER field such as BIDSIZE and ASKSIZE. HintData() returns value properly; 127 for +0 (blank) and 0 for -0 (real zero).

  • BIDSIZE: 25672 HintData: 0 TibMsg_type: 7 Size: 8

    ASKSIZE: 36226 HintData: 0 TibMsg_type: 7 Size: 8

    type == 7 is double. It seems this is not a good example.

  • Sorry. I did not aware of the TibMsg type as I just refer to dictionary file.

    BIDSIZE "BID SIZE" 30 NULL INTEGER 15 REAL64 7

    Now, I change the field to REF_COUNT and test it with real zero (-0) and blank(+0). The hint value is returned correctly.

    +0

    REF_COUNT : INT 4 : 0 <127>


    -0

    REF_COUNT : INT 4 : 0 <0>