Skip to main content

diff_and_emit_instruments

Function diff_and_emit_instruments 

Source
pub fn diff_and_emit_instruments(
    new_instruments: &[InstrumentAny],
    cached: &mut AHashMap<InstrumentId, InstrumentAny>,
    subscriptions: Option<&AHashSet<InstrumentId>>,
    sender: &UnboundedSender<DataEvent>,
)
Expand description

Compares a fresh instrument snapshot against cached definitions, emitting [DataEvent::Instrument] events for new and economically-changed instruments.

The cache is updated to reflect each meaningful change regardless of subscription, while emissions are gated by subscriptions: only subscribed instruments produce events. Pass None to emit for all changes (e.g. a venue-wide subscription).