question

Upvotes
Accepted
9 1 3 5

REDILIB Unsubscribe from market data for a given symbol

Do you have an example of how to unsubscribe for a given symbol?
Let's say I am subscribing to SPY and DIA. I want to unsubscribe from SPY. How would I do this without unsubscribing from DIA?

redi-api
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.

Upvotes
Accepted
32.2k 40 11 20

Hello @ichernyavskiy,

Your app should be able to unsubscribe, via DeleteWatch, from any instrument you have subscribed via AddWatch.

I have added Unsubscribe, via DeleteWatch, to our C# REDI Monitoring L1 Console example and tutorial code on github

I think this addition should be useful, for developers monitoring L1 quotes from C#.

Please let us know if this helps to clarify?

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 @zoya.farberov,

The C# REDI Monitoring L1 Console example creates a new CacheControl for every quote subscription. I'm pretty sure this is a bad example of how to use CacheControl. Can you possibly fix this example so more people aren't confused?

Hello @peter.drier,

Creating CacheControl for every quote subscription is the correct usage of the API.

From purely inquisitive perspective, it's very easy to modify C# REDI Monitoring L1 Console example, to reuse CacheControl, and to observe the output, containing duplicates and missing updates.

I hope this info helps.

Hi @zoya.farberov,

Wow, that's actually shocking. CacheControl as an object is inherently a table. I have an entire collection of positions in a single CacheControl, as well as a collection of Orders in another. And from the way the documentation is written (I've read it all, cover to cover, including every post in this forum) there's nothing to imply or even mention that L1 was any different.

Given each quote should fundamentally be a row, can you explain why they each need their own table? You reference duplicates and missing data, what about having 2 rows in a table causes duplicates or missing data that one row wouldn't have a problem with?

Does the Redi app itself make a CacheControl per quote on the watchlist?

For context, Redi is already pretty slow.. creating a hundred COM objects just to marshal quotes around is both more fragile and slow. Anything I can do to prevent COM errors is important, they have a bad habit of being hard to recover from.

Cheers,
Peter

Upvotes
32.2k 40 11 20

Hello @ichernyavskiy,

Please see CacheControl -> DeleteWatch in RediSpec

Does this work for you? Do you need a complete code example?

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.

Upvotes
9 1 3 5

Zoya, I've tried several different ways of unsubscribing from one symbol and none work.

In my sample code I added a method unsubscribe in same class as subscribe, getCell and CacheEvent handler. Pass it a symbol. In my case SPY

Public Sub Unsubscribe(ByVal Symbol As String)

quoteCacheTest.DeleteWatch(0, Symbol, "", err)

End Sub

Once I triger it, I can still see SPY getting updates in CacheEvent.

I've attached image showing how subscribing and unsubscribing is getting called. Perhaps you can take a look at tell me if I am doing something silly.

subscribe-now.png


subscribe-now.png (148.3 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.

Upvotes
9 1 3 5

The example helped tremendously.

I was created way too many objects. What I should have done is query my dictionary for quoteCache that I have for a given symbol and use that to unsubscribe.

Thank you so much!

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.