About RDP streaming event
Hi all, In my app I have used streaming to get the data and use asyncio to do the calculation process when got an event sometimes it's still do the refresh event process but it's got update event usually it's must finish the refresh event first then do the update event but in my case it's doesn't finish refresh event it swaps to update event. Is this normal? because from my understanding I must use await in my app to swap to other tasks but my app didn't use any of it. here below is example of my code
Best Answer
-
I am not sure I fully understand your question.
Also, I am not a Python expert so cannot confirm how the asycnio task will be actioned or shutdown etc - nor can I advise on general Python 'multi-threading'.
The key point I am making is that you are dealing with live streaming data - so it is entirely possible to receive an update for an instrument before you have finished processing the Refresh.
Depending on how long your Update related calculations take, it is also entirely possible that you could receive a further update, whilst you are still processing the previous update.
For something like Java or C++, the developer could spawn off a worker thread to process the RefreshMsg leaving the main (API) thread to continue receiving and handling the Update - with some strategy to ensure that any subsequent update does not disrupt or corrupt any ongoing calculations on the same instrument still being performed on the Refresh or previous update.
You need to redesign your code so that the calculations are not done in the callback (on_data_refresh, on_data_update). For example, rather than performing any Refresh or Update calculations in the callback function - you add data to a queue and return control back to the RDP library. You could then have a separate 'thread' processing the queue? Again - not a Python expert so not sure how appropriate this is?
0
Answers
-
Not sure I fully understand your question but I will try...
Are you subscribing to multiple instruments and expecting to complete all refresh calculations for all the instruments before processing their updates? Or are you subscribing to a single instrument?
The streaming data events are delivered asynchronously - as and when there is market activity.
So, if you are spending considerable time processing the Refresh and during that time there is some market activity e.g. a price change, then you would expect to receive an update to reflect that price change.
0 -
Hi @umer.nalla
Yes, I'm expecting to complete all refresh calculations for all the instruments before swapping to do the update event. right now my app just discards the refresh event before it finishes and does the update event instead.0 -
As explained above, since the data is sent as per market activity - you can receive update events before you have finished receiving/processing Refresh events for all your instruments.
Perhaps you can consider using the Cache functionality of RDP Streaming - where you can choose when to snap the values from the cache that is maintained by the RDP library
0 -
Hi @umer.nalla
So it's mean that if my calculation process from refresh event took too long and In a meanwhile app got the update event. It's shutdown the asyncio task from refresh event to do update event am I right?0 -
Hi @umer.nalla
Thanks for the advice I'll try to redesign my code.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 690 Datastream
- 1.4K DSS
- 629 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 559 WebSocket API
- 39 FX Venues
- 15 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 25 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 279 Open PermID
- 45 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 2K Refinitiv Data Platform
- 716 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 95 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛