This event is fired when instrument's DOM* is updated.
Visual Basic |
---|
Public Event InstrumentDOMChanged( _ ByVal cqg_instrument As CQGInstrument, _ ByVal prev_asks As CQGDOMQuotes, _ ByVal prev_bids As CQGDOMQuotes _ ) |
In order to receive this event for an instrument, its data subscription level should be set to dsQuotesAndDOM.
Mode and frequency of DOM update firing can be changed from CQGAPIConfig.DOMUpdatesMode and CQGAPIConfig.DOMUpdatesPeriod properties.
When the event is fired for the first time the prevAsks and prevBids collections are empty.
Note: Not all the instruments have DOM support. In case such instrument's subscription level is set to dsQuotesAndDOM this event will be fired only once and all DOM collections (instrument.DOMAsks, instrument.DOMBids, prevAsks and prevBids) will be empty.
*DOM goes for depth of market
These examples show the handling of InstrumentDOMChanged event. Here is also shown how to get the best ask/bid of the new DOM book.
Private Sub cel_InstrumentDOMChanged(ByVal Instrument As CQG.ICQGInstrument, _ ByVal prevAsks As CQG.ICQGDOMQuotes, _ ByVal prevBids As CQG.ICQGDOMQuotes) 'Get the best ask of current DOM book Dim BestAsk As CQGQuote Set BestAsk = Instrument.DOMAsks(0) 'Get the best bid of current DOM book Dim BestBid As CQGQuote Set BestBid = Instrument.DOMBids(0) End Sub
private void cel_InstrumentDOMChanged(CQGInstrument Instrument, CQGDOMQuotes prevAsks, CQGDOMQuotes prevBids) { //Get the best ask of current DOM book CQGQuote BestAsk = Instrument.DOMAsks[0]; //Get the best bid of current DOM book CQGQuote BestBid = Instrument.DOMBids[0]; }