Subscribing to Multicast Groups | Table of Content | Error Handling and Recovering |
Handler Events |
The Handler exposes the following events:
The FuturesProductDefinitionReceived event is fired by the Handler when subscription is started. The Handler calls an associated event handler for each Future Product definition it receives. The invocation of the event handler is performed in the same thread in which the Start(ICollection<MarketSubscription>) member was called. Once subscription is started, the event of this type will not be fired for subscribed markets (until the next start).
The OptionsProductDefinitionReceived event is fired by the Handler when subscription is started. The Handler calls an associated event handler for each Future Product definition it receives. The invocation of the event handler is performed in the same thread in which the Start(ICollection<MarketSubscription>) member was called. Once subscription is started, the event of this type will not be fired for subscribed markets (until the next start).
The OptionsStrategyDefinitionReceived event is fired by the Handler when subscription is started. The Handler calls an associated event handler for each Future Product definition it receives. The invocation of the event handler is performed in the same thread in which the Start(ICollection<MarketSubscription>) member was called. Once subscription is started, the event of this type will not be fired for subscribed markets (until the next start).
The AddModifyOrderReceived event occurs when the Handler receives Add Modify Order message for a certain market from multicast feed.
The AddPriceLevelReceived event occurs when the Handler receives Add Price Level message for a certain market from multicast feed.
The BundleMarkerReceived event occurs when the Handler receives Bundle Marker message for a certain market from multicast feed.
The CancelledTradeReceived event occurs when the Handler receives Cancelled Trade message for a certain market from multicast feed.
The ChangePriceLevelReceived event occurs when the Handler receives Change Price Level message for a certain market from multicast feed.
The DeleteOrderReceived event occurs when the Handler receives Delete Order message for a certain market from multicast feed.
The DeletePriceLevelReceived event occurs when the Handler receives Delete Price Level message for a certain market from multicast feed.
The EndOfDayMarketSummaryReceived event occurs when the Handler receives End of Day Market Summary message for a certain market from multicast feed. It has no direct impact either onto the market book or onto the market state. The Handler delivers it directly to the subscribers if they want to know market attributes when the market is closed (like a settlement price). This event has sense only when subscription is active.
The IntervalTieredPriceLimitNotificationReceived event occurs when the Handler receives Interval Price Limit Notification message for a certain market from multicast feed.
The InvestigatedTradeReceived event occurs when the Handler receives Investigated Trade message for a certain market from multicast feed.
The MarkerIndexPricesReceived event occurs when the Handler receives Marker Index Prices message for a certain market from multicast feed.
The MarketEventReceived event occurs when the Handler receives Market Event message for a certain market from multicast feed.
The MarketSnapshotReceived event occurs when the Handler receives Market Snapshot message for a certain market from multicast feed.
The MarketSnapshotOrderReceived event occurs when the Handler receives Market Snapshot Order message for a certain market from multicast feed.
The MarketSnapshotPriceLevelReceived event occurs when the Handler receives Market Snapshot Price Level message for a certain market from multicast feed.
The MarketStateChangeReceived event occurs when the Handler receives Market State Change message for a certain market from multicast feed.
The MarketStatisticsReceived event occurs when the Handler receives Market Statistics message for a certain market from multicast feed.
The NewOptionsMarketDefinitionReceived event occurs when the Handler receives New Options Market Definition message for a certain market from the multicast feed.
The NewOptionsStrategyDefinitionReceived event occurs when the Handler receives New Options Strategy Definition message for a certain market from the multicast feed.
The OldStyleOptionsTradeAndMarketStatsReceived event occurs when the Handler receives Old Style Options Trade And Market Stats message for a certain market from multicast feed.
The OpenInterestReceived event occurs when the Handler receives Open Interest message for a certain market from multicast feed.
The OpenPriceReceived event occurs when the Handler receives Open Price message for a certain market from multicast feed. This message has no direct impact either onto the market book or onto the market state. The Handler delivers it directly to the subscribers if they want to know market attributes whenthe market is closed (like a settlement price). This event has sense only when subscription is active.
The OptionOpenInterestReceived event occurs when the Handler receives Option Open Price message for a certain market from multicast feed.
The OptionSettlementPriceReceived event occurs when the Handler receives Option Settlement Price message for a certain market from multicast feed. This message has no direct impact either onto the market book or onto the market state. The Handler delivers it directly to the subscribers if they want to know market attributes when the market is closed (like a settlement price). This event has sense only when subscription is active.
The PreOpenPriceIndicatorReceived event occurs when the Handler receives Pre-Open Price Indicator message for a certain market from multicast feed.
The RfqReceived event occurs when the Handler receives RFQ message for a certain market from multicast feed.
The SettlementPriceReceived event occurs when the Handler receives Settlement Price message for a certain market from multicast feed.
The StripInfoReceived event occurs when the Handler receives Strip Info message for a certain market from multicast feed.
The SystemTextReceived event occurs when the Handler receives System Text message for a certain market from multicast feed.
The TradeReceived event occurs when the Handler receives Trade message for a certain market from multicast feed.
The MulticastMessageBlockBegin event occurs when the Handler start processing of the multicast message block.
The MulticastMessageBlockEnd event occurs when the Handler finish processing of the multicast message block.
The HandlerStateChanged event occurs when the Handler changes its state.
The LogReplayFinished event occurs when the Handler finished the replay log.
The BookChanged event is raised by the Handler in response to the received notifications from multicast feed about added or modified orders, performed trades, the changes in price levels, etc. The events of this type occur only when subscription is active. Associated handlers will never be called before the Start(ICollection<MarketSubscription>) succeed and after subscription will be stopped using the Stop() member.
The BookUpdated event is raised by the Handler when the processing of all the changes in the current multicast message block is finished. Each BookUpdated is following one or many BookChanged, i.e. when all the individual changes are done, BookUpdated is triggered to notify that all the changes are applied.
The ErrorOccurred event is fired by the Handler if any error condition is met. This could be a generic error like inability to write to the log file as well as some kind of failure scenario like the message reception from multicast feed with an invalid sequence number. This event is raised by the Handler only when subscription is active.
The following sample demonstrates how to receive notifications about Futures Product definitions received by the Handler.
class FuturesProductDefinitionsCollector { Dictionary<int, FuturesProductDefinitionEventArgs> productDefinitions_ = new Dictionary<int,FuturesProductDefinitionEventArgs>(); public FuturesProductDefinitionsCollector() { } public Dictionary<int, FuturesProductDefinition> Definitions { get { return productDefinitions_; } } public void AttachTo(Handler handler) { handler.FuturesProductDefinitionReceived += OnFuturesProductDefinitionReceived; } public void DetachFrom(Handler handler) { handler.FuturesProductDefinitionReceived -= OnFuturesProductDefinitionReceived; } private void OnFuturesProductDefinitionReceived( object sender, FuturesProductDefinitionEventArgs args) { if (!productDefinitions_.ContainsKey(args.MarketId)) productDefinitions_.Add(args.MarketId, args); } }