This event is fired when a new instrument is resolved and subscribed.
Deprecated. Use InstrumentResolved instead.
Visual Basic |
---|
Public Event InstrumentSubscribed( _ ByVal symbol_ As String, _ ByVal cqg_instrument As CQGInstrument _ ) |
- symbol_
- the commodity symbol that was requested by user in NewInstrument method
- cqg_instrument
resolved CQGInstrument object
InstrumentSubscribed is also fired if a duplicate resolution is attempted. In that case the Instrument parameter returns the same object as it returned the first time.
The example shows how to access CQGInstrument properties immediately after it is subscribed.
VB
C#
Private Const strSomeTagName As String = "AlreadySubscribed" Private Sub cel_InstrumentSubscribed(ByVal Symbl As String, _ ByVal Instrument As CQG.ICQGInstrument) If Instrument.Tag(strSomeTagName) = True Then ' Instrument was already subscribed once Else Instrument.Tag(strSomeTagName) = True ' Instrument subscribed first time End If ' Here we tell CQGCEL to send us ask/bid change notifications along ' with quote changes Instrument.DataSubscriptionLevel = dsQuotesAndBBA Range("B5") = Symbl Range("B6") = Instrument.Description Range("B7") = Instrument.YearString Range("C7") = Instrument.MonthChar End Sub Private Sub cel_IncorrectSymbol(ByVal Symbl As String) ' Incorrect symbol (Symbl) is passed to NewInstrument function End Sub
const string strSomeTagName = "AlreadySubscribed" ; private void cel_InstrumentSubscribed(string Symbl, CQGInstrument Instrument) { if( Instrument == null ) { // Failed to subscribe instrument return ; } if( Instrument.get_Tag( strSomeTagName ) == true ) { // Instrument was already subscribed once } else { Instrument.set_Tag( strSomeTagName , true ) ; // Instrument subscribed first time } // Here we tell CQGCEL to send us ask/bid change notifications along // with quote changes Instrument.DataSubscriptionLevel = eDataSubscriptionLevel.dsQuotesAndBBA ; Console.WriteLine( Symbl ) ; Console.WriteLine( Instrument.Description ) ; Console.WriteLine( Instrument.YearString ) ; Console.WriteLine( Instrument.MonthChar ) ; } private void cel_IncorrectSymbol(string Symbl) { // Incorrect symbol (Symbl) is passed to NewInstrument function }