question

Upvotes
Accepted
2 0 1 2

Why does ADS server always reply with the same market price to the consecutive MMT_MARKET_PRICE requests?

Hello,

Whenever I send market price query continuously to the ADS server, server always replies the same price. The type of the response messages are always REFRESH. I also don’t know if it is normal that I never get UPDATE or STATUS type response messages.

I use the below code to query the ADS server. The code is called in a while loop continuously.

What can be wrong? Could you plese help?

Thanks in advance

ReqMsg reqMsg = new ReqMsg();  
AttribInfo attribInfo = new AttribInfo();  
reqMsg.MsgModelType = ThomsonReuters.RFA.RDM.RDM.MESSAGE_MODEL_TYPES.MMT_MARKET_PRICE;  
reqMsg.InteractionType = ReqMsg.InteractionTypeFlag.InitialImage | ReqMsg.InteractionTypeFlag.InterestAfterRefresh;  
attribInfo.NameType = ThomsonReuters.RFA.RDM.RDM.INSTRUMENT_NAME_TYPES.INSTRUMENT_NAME_RIC;  
attribInfo.Name = new RFA_String("TRYTOM=D3"); 
attribInfo.ServiceName = new RFA_String("IDN_RDF");
reqMsg.AttribInfo = attribInfo;  
OMMItemIntSpec ommItemIntSpec = new OMMItemIntSpec();  
ommItemIntSpec.Msg = reqMsg; 
long itemHandle = this.ommConsumer.RegisterClient(this.marketPriceEventQueue, ommItemIntSpec, this);  
int dispatchReturn = this.marketPriceEventQueue.Dispatch(10);

treprfarfa-apiADSmarket-price
capture.png (18.4 KiB)
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
25k 87 11 23

Hi @ali.takavci

You have specified an Interaction type of ReqMsg.InteractionTypeFlag.InitialImage | ReqMsg.InteractionTypeFlag.InterestAfterRefresh

This means you are requesting an Initial Image (Refresh) followed by any further events that occur after the Refresh - such as Updates or change in State/Status.

You don't need to keep requesting the same instrument - just request once and then call the dispatch() method in the loop. Your ProcessEvent handler should then receive a Refresh, followed by any Updates as and when they occur.

I recommend you work through the short Tutorials on this page to get a better understanding of how the RFA API works Robust Foundation API .Net Tutorial

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.

Hi Umer, thank you very much for the helpful reply. As you said, registering the request once is enough and I needed to dispatch in a loop.

Tutorial 3 - RFA Event Dispatch Mechanism explains the issue very well. Thank you very much for the instruction.

Upvote
13.7k 61 39 63

Hi @ali.takavci,

The behaviour you are seeing is completely normal. You will only see changes in the price if market conditions change. If you are viewing a symbol that is inactive or viewing it outside market trading hours, you won't see changes that frequently.

Try a symbol that you know is very active and one that is actively trading and you should see the values changing. You will also see UPDATE messages when market conditions change for this symbol.

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.

Hi Nick, thank you very much for the helpful reply. In fact, I was receiving update type messages very very rare and my client was stucking with the same refresh messages most of the time. Umer's suggestion is the solution. market price request should have been made only once outside the while loop. Thank you for the kind response.