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

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

  •  25-09-2022
  •  | 
  •  

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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top