Returns the current trading sessions collection.
Read-only property
Visual Basic |
---|
Public Property Sessions As CQGSessions |
Collection of trading sessions of the instrument
See the usage of CQGInstrument properties in the InstrumentSubscribed event's example section.
The example demonstrates the Sessions property usage of the CQGInstrument object.
VB
C#
Private Sub cel_InstrumentSubscribed(ByVal Symbl As String, ByVal Instrument As CQG.ICQGInstrument) ' You'll get here if instrument is subscribed Dim currentColumn As Integer ' Let's start from 2nd column currentColumn = 2 Dim currentSession As CQGSession For Each currentSession In Instrument.Sessions Cells(2, currentColumn) = currentSession.Number Cells(3, currentColumn) = currentSession.Name Cells(4, currentColumn) = currentSession.PrimaryFlag Cells(5, currentColumn) = CStr(currentSession.StartTime) Cells(6, currentColumn) = CStr(currentSession.EndTime) If currentSession.Number = Instrument.SessionNumber Then ' Write above current sesion column that this is the active session Cells(1, currentColumn) = "Active" End If ' Move to the next column currentColumn = currentColumn + 1 Next 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) { // You'll get here if instrument is subscribed // Let's start from 2nd column int currentColumn = 2 ; foreach( CQGSession currentSession in Instrument.Sessions ) { // Start new session section and mark it as "Active" if currentSession is the active one Console.Write( "Start Session {0} {1}" , currentSession.Number , ( currentSession.Number == Instrument.SessionNumber ) ? "Active" : "" ) ; Console.WriteLine( "Name = {0}" , currentSession.Name ) ; Console.WriteLine( "Name = {0}" , currentSession.PrimaryFlag ) ; Console.WriteLine( "Name = {0}" , currentSession.StartTime.ToString() ) ; Console.WriteLine( "Name = {0}" , currentSession.EndTime.ToString() ) ; // Move to the next column ++ currentColumn ; } } private void cel_IncorrectSymbol(string Symbl) { // Incorrect symbol (Symbl) is passed to NewInstrument function }