Best Way To Turn Off Receipt of realTime Data

I am getting CF_LAST prices on an unknown number of securities (of the order of several dozen). What is the best way to decide that to stop collecting. The "ComplexRequestAndSubscription" has an arbitrary way of doing this (stop after an arbitrary number of RICs). I don't know how many pairs to expect.

Best Answer

  • Alex Putkov.1
    Answer ✓

    This API does not provide a specific notification when the snapshot data retrieval is complete for all RICs in the request. If you need to know, the way you can achieve this in a generic case is first by handling OnStatusReceived event and counting all the valid RICs (the ones with InstrumentState of "Ok" or "Delayed") until the status of all RICs in the request is known. You can get all the RICs in the request from the Rics property of IRealtimeDataRequest. And then by comparing the number of InstrumentUpdates in IRealtimeUpdateDictionary when OnDataReceived event is raised to the number of valid RICs in the request. Add the number of InstrumentUpdates delivered in each OnDataReceived event and when the sum reaches the number of valid RICs in the request (and the number of RICs with status checked equals the number of RICs in the request) the data retrieval is complete.
    This said I'm not quite sure why you'd want to know when the data retrieval is complete. From my point of view I may want to know when all the data is retrieved if this tells me when I can start handling the data. But in this API you only access the data from the callback for OnDataReceived event, not from any place else.

Answers

  • I'm not sure I understand the question. From my perspective the decision when to stop receiving real-time data updates is dictated by the business logic of the application, isn't it? That is assuming the business logic of the application requires real-time data updates in the first place. What I think you might be after, and this is only a guess, is the snapshot data request rather than a subscription for real-time updates. If you need a snapshot of data for a set of RICs and you don't care for any subsequent market data updates for these RICs, then use IRealtimeDataRequest interface instead of IRealtimeDataSubscription. With IRealtimeDataRequest you will not be receiving any updates for the RICs after the initial images. But if you need something else, something other than the snapshot request, then could you elaborate on what you're trying to achieve or what problem you need to solve?

  • Thanks. The snapshot is indeed what I want. How do I know when that is complete. Waiting a preset time of no data? If so, how long?

    Thanks.