Class InstrumentProfileCollector
Collects instrument profile updates and provides the live list of instrument profiles. This class contains a map that keeps a unique instrument profile per symbol. This class is intended to be used with InstrumentProfileConnection as a repository that keeps profiles of all known instruments.
As set of instrument profiles stored in this collector can be accessed with View() method.
A snapshot plus a live stream of updates can be accessed with AddUpdateListener(InstrumentProfileUpdateListener) method.
Removal of instrument profile is represented by an InstrumentProfile instance
with a type equal to REMOVED.
This class is thread-safe.
public class InstrumentProfileCollector
- Inheritance
-
InstrumentProfileCollector
- Inherited Members
Methods
AddUpdateListener(InstrumentProfileUpdateListener)
Adds listener that is notified about any updates in the set of instrument profiles. If a set of instrument profiles is not empty, then this listener will be immediately notified.
public void AddUpdateListener(InstrumentProfileUpdateListener listener)
Parameters
listener
InstrumentProfileUpdateListenerThe profile update listener.
GetLastUpdateTime()
Gets last modification time (in milliseconds) of instrument profiles or zero if it is unknown. Note, that while the time is represented in milliseconds, the actual granularity of time here is a second.
public long GetLastUpdateTime()
Returns
- long
Last modification time (in milliseconds) of instrument profiles or zero if it is unknown.
RemoveUpdateListener(InstrumentProfileUpdateListener)
Removes listener that is notified about any updates in the set of instrument profiles.
public void RemoveUpdateListener(InstrumentProfileUpdateListener listener)
Parameters
listener
InstrumentProfileUpdateListenerThe profile update listener.
View()
Gets a concurrent view of the set of instrument profiles.
Note, that removal of instrument profile is represented by an InstrumentProfile instance with a
InstrumentProfileType equal to
InstrumentProfileType.REMOVED
Normally, this view exposes only non-removed profiles. However, if iteration is concurrent with removal,
then a removed instrument profile (with a removed type) can be exposed by this view.
public IEnumerable<InstrumentProfile> View()
Returns
- IEnumerable<InstrumentProfile>
A concurrent view of the set of instrument profiles.