In BLPAPI is there a more efficient way to find the security for a subscription?

StackOverflow https://stackoverflow.com/questions/20962160

  •  25-09-2022
  •  | 
  •  

Question

When you make a subscription, you pass in a correlationID and use that to reference the security for the fields that come back

So you can have a counter that increments every subscription and use that as the correlationID, and then keep a map from that counter value to the security object

Is there a more efficient way to do this?

Was it helpful?

Solution

In stead of passing a number and keeping a map, you can use the security object as the correlationID

Then, when you get a tick, instead of getting the counter and looking up the mapped security, you can just cast the correlationID pointer to the security object's type and directly apply any changes to the security object

No lookups needed, and there are no concerns about synchronization on the map.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top