For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
89 13 20 23

RTMD match the code with historical data for MarketPrice and LegacyLevel2

Any assistance will be greatly appreciated.

Please check the real-time code, am I matching the code correctly for historical data and real-time?

Did I do something wrong with the domains?

The goal is to get real-time data that will match the historical data completely. Please take a look at the code. Am I working with the domains correctly?

RTMD service

real-time code for best ask\bid+trade

OmmConsumer consumer(config.host("1**.***.***.*:14002").username("EM1_****_*******"));
consumer.registerClient(ReqMsg().serviceName("hEDD").domainType(MMT_MARKET_PRICE).name("ESU1"), client);
sleep(1200000);                /

Code for historical data best ask\bid+trade

new TickHistoryRawExtractionRequest
                      {
                          Condition = new TickHistoryRawCondition
                          {
                              ReportDateRangeType = ReportDateRangeType.Range,
                              QueryStartDate = startDate,
                              QueryEndDate = lastDate, 
                              ExtractBy = TickHistoryExtractByMode.Ric,
                              MessageTimeStampIn = TickHistoryTimeOptions.LocalExchangeTime,
                              SortBy = TickHistorySort.SingleByRic,
                              DomainCode = TickHistoryRawDomain.MarketPrice,
                              DisplaySourceRIC = true
                          },
                          IdentifierList = new InstrumentIdentifierList
                          {
                              InstrumentIdentifiers = new[]
                                        {
                                            InstrumentIdentifier.Create(result.IdentifierType, result.Identifier)
                                        },
                              ValidationOptions = new InstrumentValidationOptions
                              {
                                  AllowHistoricalInstruments = true
                              },
                              UseUserPreferencesForValidationOptions = false
                          }, 

real-time code for MarketDepth (10 level - LegacyLevel2 )

OmmConsumer consumer(config.host("1**.***.***.*:14002").username("EM1_****_*******"));
consumer.registerClient(ReqMsg().serviceName("hEDD").domainType(MMT_MARKET_BY_PRICE).name("ESU1"), client);
sleep(1200000);                

Code for historical data MarketDepth (10 level - LegacyLevel2)

new TickHistoryMarketDepthExtractionRequest
 {
  Condition = new TickHistoryMarketDepthCondition
    {
      ReportDateRangeType = ReportDateRangeType.Range,
         QueryStartDate = startDate,
          QueryEndDate = lastDate, 
           ExtractBy = TickHistoryExtractByMode.Ric,
           MessageTimeStampIn = TickHistoryTimeOptions.LocalExchangeTime,
           SortBy = TickHistorySort.SingleByRic,
           View = TickHistoryMarketDepthViewOptions.LegacyLevel2,
           DisplaySourceRIC = true
  },
 IdentifierList = new InstrumentIdentifierList
  {
   InstrumentIdentifiers = new[]
     {
     InstrumentIdentifier.Create(result.IdentifierType, result.Identifier)
       },
       ValidationOptions = new InstrumentValidationOptions
        {
       AllowHistoricalInstruments = true
         } 
          },


I am concerned about the correctness of the real-time code to get LegacyLevel2

refinitiv-real-time
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.

Upvote
Accepted
78.2k 246 52 72

@s61670

The LegacyLevel2 should be the MarketPrice domain in the real-time code.

As I know, not all RICs can provide 10 levels of market depth.

To get legacy level 2 data of ESU1, you can try ESU1m RIC. However, from my test, this RIC has been delisted. However, please contact the content support team directly via MyRefinitv to confirm which RIC can provide legacy level 2 data of ESU1.



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.

Do I understand correctly that the real-time domain for quote+trade and LegacyLevel2 is the same, i.e. MarketPrice?

Can you tell me if the following code is correct?

for real-time quote+trade and LegacyLevel2

  1. OmmConsumer consumer(config.host("1**.***.***.*:14002").username("EM1_****_*******"));
  2. consumer.registerClient(ReqMsg().serviceName("hEDD").domainType(MMT_MARKET_PRICE).name("ESU1"), client);
  3. sleep(1200000); 

and before for quote+trade only ESU1 was needed in this code, but for LegacyLevel2 only ESU1m? And now you need to specify which RIC is needed for LegacyLevel2. But the code for real-time will not change, i.e. exactly the Market_Price domain for both variants?

@s61670

Yes, you are correct. However, please contact the content support team directly via MyRefinitiv to confirm it.

Upvotes
78.2k 246 52 72

@s61670

To compare the real-time Market By Price domain, you can also use the TickHistoryRawExtractionRequest with the TickHistoryRawDomain.MarketByPrice domain.

...
 SortBy = TickHistorySort.SingleByRic,
 DomainCode = TickHistoryRawDomain.MarketByPrice,
 DisplaySourceRIC = true
...

The output from TickHistoryRawExtractionRequest with the TickHistoryRawDomain.MarketByPrice domain looks like the following.

#RIC,Domain,Date-Time,GMT Offset,Type,MsgClass/FID number,UpdateType/Action,FID Name,FID Value,FID Enum String,PE Code,Template Number,Key/Msg Sequence Number,Alias Underlying RIC,Number of FIDs
ESU1,Market By Price,2020-10-22T22:00:00.000000000Z,-5,Raw,REFRESH,,,,,5058,0,0,,0
,,,,Summary,,,,,,,,,,29
,,,,FID,1,,PROD_PERM,5058,
,,,,FID,3,,DSPLY_NAME,EMINI S&P SEP1,
,,,,FID,15,,CURRENCY,840,USD
,,,,FID,17,,ACTIV_DATE,2020-10-22,
,,,,FID,198,,LOT_SIZE_A,50,
,,,,FID,259,,RECORDTYPE,114,
,,,,FID,825,,CROSS_SC,0,1E+00
,,,,FID,1709,,RDN_EXCHD2,22,IOM
,,,,FID,3422,,PROV_SYMB,ESU1,
,,,,FID,3423,,PR_RNK_RUL,1,NOR
,,,,FID,3425,,OR_RNK_RUL,2,"PTS "
,,,,FID,3694,,MNEMONIC,ES,
,,,,FID,3852,,PERIOD_CDE,21,
,,,,FID,3984,,TRD_TYPE,21,
,,,,FID,4148,,TIMACT_MS,71999614,
,,,,FID,5357,,CONTEXT_ID,2123,
,,,,FID,5868,,PROD_GRP,ES,
,,,,FID,6401,,DDS_DSO_ID,8251,
,,,,FID,6480,,SPS_SP_RIC,.[SPSCMFL2,
,,,,FID,6516,,BOOK_STATE,1,N
,,,,FID,6517,,HALT_REASN,0,
,,,,FID,6519,,MKT_OR_RUL,0," "
,,,,FID,6614,,TRD_STATUS,1,"N "
,,,,FID,6615,,HALT_RSN,0,"  "
,,,,FID,6618,,HALT_DATE,,
,,,,FID,6619,,HALT_TIME,,
,,,,FID,8927,,INST_PHASE,2,"O  "
,,,,FID,8928,,STAT_IND,2,"G  "
,,,,FID,12843,,OR_PRC_BAS,1,PRC
ESU1,Market By Price,2020-10-22T22:00:00.036109083Z,-5,Raw,UPDATE,UNSPECIFIED,,,,5058,,53648,,0
,,,,Summary,,,,,,,,,,6
,,,,FID,6517,,HALT_REASN,0,
,,,,FID,6615,,HALT_RSN,0,"  "
,,,,FID,8928,,STAT_IND,2,"G  "
,,,,FID,3852,,PERIOD_CDE,17,
,,,,FID,3984,,TRD_TYPE,17,
,,,,FID,8927,,INST_PHASE,3,"T  "
ESU1,Market By Price,2020-10-22T22:20:37.687716885Z,-5,Raw,UPDATE,UNSPECIFIED,,,,5058,,53664,,0
,,,,Summary,,,,,,,,,,3
,,,,FID,17,,ACTIV_DATE,2020-10-22,
,,,,FID,6516,,BOOK_STATE,1,N
,,,,FID,4148,,TIMACT_MS,80437679,
,,,,MapEntry,,ADD,,,,,,345525.000000000A,,7
,,,,FID,3428,,ORDER_SIDE,2,ASK
,,,,FID,3427,,ORDER_PRC,3455.25,
,,,,FID,3886,,ORDER_TONE,1,
,,,,FID,4356,,ACC_SIZE,4,
,,,,FID,3430,,NO_ORD,1,
,,,,FID,6529,,LV_DATE,2020-10-23,
,,,,FID,6527,,LV_TIM_MS,80437679,
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.

Jirapongse, thanks for the answer.

Do I understand correctly that this is an example for quote+trade (MarketPrice)?

I'm very interested in the LegacyLevel2 situation, what is the real-time code for getting in this format! It is important to me exactly in LegacyLevel2 format to get real-time.

I'm not interested in the code to get historical data, but rather in the code to get real-time data that was mapped to the above code to get historical data.