question

Upvotes
Accepted
1 1 0 2

Time & Sales example

Can anyone point me at an RFA example dealing with Time & Sales requests and processing? I'm using the C++ v8.0.1 libraries.

treprfarfa-apipricingexample
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.

1 Answer

· Write an Answer
Upvote
Accepted
78.2k 246 52 72

You can modify StarterConsumer in RFA C++ package to subscribe to Time & Sales RICs, such as tIBM.N.

To request a Time & Sales RIC, the application needs to use a snapshot request.

rfa::common::Handle* sendItemRequest(
   const rfa::common::RFA_String& itemName, 
   const rfa::common::RFA_String& serviceName,
   rfa::common::UInt8 indicationMask = 0,
   rfa::common::UInt8 msgModelType = rfa::rdm::MMT_MARKET_PRICE,
   //  rfa::common::Int32 interType = rfa::message::ReqMsg::InitialImageFlag | rfa::message::ReqMsg::InterestAfterRefreshFlag);
   rfa::common::Int32 interType = rfa::message::ReqMsg::InitialImageFlag);

The Time & Sales data is available in SEG_TEXT field which represents:

The 255-byte text field which can contain up to four log entries. There are embedded New Line control characters within this field to assist in displaying the log information.

To retrieve the next log segment, the application must subscribe to a RIC in NEXT_LR field.

if(respMsg.getHintMask() & RespMsg::PayloadFlag)
	{
	//	_pDecoder->decodeData(respMsg.getPayload());
		const rfa::common::Data& data = respMsg.getPayload();


		if (!data.isBlank())
		{
			if (data.getDataType() == FieldListEnum){
				const rfa::data::FieldList& input = static_cast<const rfa::data::FieldList&>(data);
				FieldEntry fEntry;


				if (input.find(258, DataBuffer::StringRMTESEnum, fEntry)){ //SEG_TEXT
					const rfa::common::Data& data = fEntry.getData(DataBuffer::StringRMTESEnum);
					if (!data.isBlank())
					{
						const DataBuffer& dataBuf = static_cast<const DataBuffer&>(data);
						printf("%s\n", dataBuf.getAsString().c_str());


					}
				}
				if (input.find(238, DataBuffer::StringAsciiEnum, fEntry)){ //NEXT_LR


					const rfa::common::Data& data = fEntry.getData(DataBuffer::StringAsciiEnum);
					if (!data.isBlank())
					{
						const DataBuffer& dataBuf = static_cast<const DataBuffer&>(data);
						printf("NEXT_LR: %s\n", dataBuf.getAsString().c_str());
						sendItemRequest(dataBuf.getAsString(), _cfgVars.serviceName);
					}


				}
			}
		}
	}

Please see the modified code in the attached file: starterconsumer.zip.

The output of the application looks like:

2017 Feb 06 14:51:11.206 ST GMT+07:00 3B40 2B1C   441 INFO
    <- Received Event Stream Closed Event, event type: OMMItemEvent handle: 0000
000008A386E0.
2017 Feb 06 14:51:11.991 ST GMT+07:00 3B40 2B1C   597 TRACE <- Received MMT_MARK
ET_PRICE Refresh tou:$9l#*C
    serviceName : API_ELEKTRON_EPD_RSSL
    symbolName  : tou:$9l#*C
    streamState : NonStreaming
    dataState   : Ok
    statusCode  : None
    statusText  : All is well.
15:59:57.240              37 X 175.7300   03FEB    1648726     1065


15:59:56.859             100 X 175.7300   03FEB    1648473     M_SWEEP


15:59:56.416             100 X 175.7400   03FEB    1648308     M_SWEEP




NEXT_LR: tou:$9l#*@
2017 Feb 06 14:51:12.001 ST GMT+07:00 3B40 2B1C   413 TRACE Create Item Request
    itemName        : tou:$9l#*@
    serviceName     : API_ELEKTRON_EPD_RSSL
    indicationMask  : 0
    msgModelType    : 6 : MarketPrice
    interactionType : 1 : InitialImageFlag.
********************** INFO ************************ INFO **********************


2017 Feb 06 14:51:12.005 ST GMT+07:00 3B40 2B1C   441 INFO
    <- Received Event Stream Closed Event, event type: OMMItemEvent handle: 0000
000008A38810.
2017 Feb 06 14:51:12.753 ST GMT+07:00 3B40 2B1C   597 TRACE <- Received MMT_MARK
ET_PRICE Refresh tou:$9l#*@
    serviceName : API_ELEKTRON_EPD_RSSL
    symbolName  : tou:$9l#*@
    streamState : NonStreaming
    dataState   : Ok
    statusCode  : None
    statusText  : All is well.
15:59:56.409             200   175.7400   03FEB    1648304


15:59:55.880             100 X 175.8300   03FEB    1648075     M_SWEEP


15:59:55.859             100 X 175.8300   03FEB    1647965     M_SWEEP




NEXT_LR: tou:$9l#*=

To interpret the data in SEG_TEXT, you need to refer to WORLD/TAS1 page.


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.