RediLib Market data slow and cacheEvent fires 3 times every time

I am processing market data updates from Redi Api. When CacheEven occurs and I get an update, the even fires 3 times. I was wondering why that was. Even snapshot fires 3 times
Also when comparing market data tick time to say Bloomberg, I can see it being 200 to 400 milliseconds late. My Redi+ is connected over the internet. Is that the culprit or should it be faster? How long does API take to get data and serve it to me?
Best Answer
-
Hi @ichernyavskiy,
Each event should be seen once. So let's see how.
The quick way to ascertain it in VB.NET, is to download and run example Quote Monitor API from here:
It prints every event onto Immediate window, once. Is this what you observe when you run this code, or you still see the triplicates?
Two things I would check next, if what you observe is consistent:
I think the order, when called, is slightly off in the attached picture code, and possibly, also called multiple times.
Any update to the instrument, not necessarily to the fields you are retrieving, will still constitute an update and result in an update event. For example, sometimes ask will update, but not bid, sometimes, bid, but not ask, sometimes neither of these two.
Finally, to assure yourself that there will still be single event with multiple updating symbols, no duplicates or triplicates, one can do a quick code change on this example, see "AddWatch" on Symbol = "IBM", just add another "AddWatch" right after it, on "GOOG" and observe events in Immediate window only, one per.
tmpVal = L1Cache.Submit(vTable, vwhere, verr)
tmpVal = L1Cache.AddWatch(0, Symbol, "", verr)
tmpVal = L1Cache.AddWatch(0, "GOOG", "", verr)0
Answers
-
Zoya, I am working in VB.Net
I've copied snippets of code and pasted them into an image attached. In first sub, I send subscribe to your API. In second subscribe, I subscribe symbol for price updates. and in event handler I listen for action.
In event fire the portion of code I am showing
code prints 1 initially 3 times and then 5 3 times each time price updates.
0 -
Zoya, to answer your last question - yes. I am seeing same behavior of event firing 3 times in sample code as well.
Any ideas on what is causing 200-400 milliseconds in latency when compared to Bloomberg for instance?
0 -
Zoya, your link points to a link to github where there are many different projects.
This link is what I more or less copied and pasted in VB. When I see a price update, I can see in eventhandler string is printed 3 times.https://github.com/TR-API-Samples/Example.REDI.CSharp.Examples/tree/master/REDIConsoleL1
Is there a way to know which field was updated so I can see if maybe 3 fields caused an event fire?
Here is code from your sample in VB. It prints to console same data 3 times each time a field gets updatedfire-3-times-2.png
0 -
-
Please run the example:
Quote Monitor - API (Global Equities & Futures).xlsm.
This example is very simple and only watches single instrument. It should also be relevant as you work in VB.NET Please observe Immediate Window for a clear, separated view of the updates.
The example you are looking at appears to be C# Console Monitor example.
0 -
The macro in excel only fires once.
0 -
In excel, you have submit first and then AddWatch.
In my code, I have Addwatch and then submit.
In my code, if I do submit first and then AddWatch, I get an exception
Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH)) at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at RediLib.ICacheControl.AddWatch(Object vaType, Object vaArg1, Object vaArg2, Object& vaError)
at TimeTester1.RediConsole1.QuoteCache.Subscribe()0 -
There are likely multiple ways to achieve triplicates
Do you watch 3 instruments in total per chance? If so, please test with 2 or 4. Just a guess.
One very easy way that I can think of, in C#, to get triplicates without any other errors, is to reuse the same CacheControl instead of creating a new one for every instrument.
Are you able to run the C# L1 example, "REDIConsoleL1", as is, without any enhancements, do you see any duplication of the events?
0 -
REDI
delivers real-time market data to the user interface and API. Update frequency
may vary based on specific use cases.We suggest reaching out to your account
manager for more details.0 -
Zoya,
In excel code, I switched from subit/addwatch to addwatch/submit.
This created multiple updates fire-multiple-times-excel.png
So now I am wondering what am I doing wrong to get the error when doing submit/addwatch in my code.
Looking at some other examples of your code, I see both ways. When I was writing a test application, I received that error message and swapped.
It is throwing same error 3 times as well.
Error in sub Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH)) at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at RediLib.ICacheControl.AddWatch(Object vaType, Object vaArg1, Object vaArg2, Object& vaError)
at TimeTester1.RediConsole1.QuoteCache.Subscribe() in C:\Users\Spare1\Documents\Visual Studio 2010\Projects\TimeTester1\TimeTester1\REDIFEED.vb:line 97line 97 is where addwatch is happening.
0 -
Thank you, Zoya, for working on this.
I was looking over my example of "duplicates" and it appears in excel example, it was not a duplicate. Example I highlighted was not exactly same. Vwap tick was slightly different.
I have the simplified example from excel and i have my code. I will comb through it again and will let you know if I see any issues. Most likely the issue is between keyboard and chair here.0 -
Zoya, I figured out why I was getting 3 event fires. In my code, I added handler of the event but that is not necessary.
Initially, my Redi+ was not enabled for API L1 so I added
AddHandler quoteCacheTest.CacheEvent, AddressOf quoteCacheHandler to see if I can get the data to flow. This was not the issue but the code was left over. Once I removed this portion, it stopped firing 3 times and updates only once.
DeleteWatch still does not work properly.
Say I have 2 symbols in my list, SPY and DIA in that order. When I unsubscribe from SPY, it stops subscribing to DIA, but SPY is still updating. When I unsubscribe from SPY again, it again skips SPY.
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
- 280 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
- 717 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 中文论坛