Returns the collection of currently resolved instruments.
Visual Basic |
---|
Public Property Instruments As CQGInstruments |
CQGInstruments collection containing all instruments that were previously resolved
The Instruments property returns a collection of instruments, which were previously resolved and subscribed. It also contains instruments that were subscribed, and then their subscription level was set to dsNone.
An instrument is removed from this collection only by calling the RemoveInstrument or RemoveAllInstruments methods.
In CQG API version 3.0 and higher instruments that were subscribed via AutoSubscribeInstruments setting are also included in this collection.
The example demonstrates how to get the moment, when two instruments are valid and it is possible to work with a spread. The example demonstrates the usage of the CQGCEL.Instruments collection element access technique using the instrument's full name.
Private Sub cel_InstrumentSubscribed(ByVal Symbl As String, ByVal Instrument As CQG.ICQGInstrument) On Error Goto NoInstrumentInCollection Dim instrum As CQGInstrument If Instrument.FullName = "F.US.CL05Z" Then ' The very next line may throw an exception instrum = cel.Instruments("F.US.CL05X") ' If we got here - then two instruments are subscribed and it's possible to operate with spread. ' Use here instrum and Instrument variables to display spread data. End If Exit Sub NoInstrumentInCollection: ' There's no instrument "F.US.CL05X" in cel.Instruments collection End Sub Private Sub cel_IncorrectSymbol(ByVal Symbl As String) ' Incorrect symbol (Symbl) is passed to NewInstrument function End Sub
private void cel_InstrumentSubscribed(string Symbl, CQGInstrument Instrument) { CQGInstrument instrum ; if( Instrument.FullName == "F.US.CL05Z" ) { try { instrum = cel.Instruments["F.US.CL05X"] ; // If we got here - then two instruments are subscribed and it's possible to operate with spread. // Use here instrum and Instrument variables to display spread data } catch( COMException ) { // There's no instrument "F.US.CL05X" in cel.Instruments collection return ; } } } private void cel_IncorrectSymbol(string Symbl) { // Incorrect symbol (Symbl) is passed to NewInstrument function }