This event is fired when a previously requested commodity symbol is resolved into the instruments list.
Visual Basic |
---|
Public Event CommodityInstrumentsResolved( _ ByVal commodity_name As String, _ ByVal instrument_types As eInstrumentType, _ ByVal cqg_commodity_intruments As CQGCommodityInstruments _ ) |
- commodity_name
- The commodity symbol that was requested by the user in the corresponding RequestCommodityInstruments method call.
- instrument_types
Instrument type bitmask that was set by the user in corresponding RequestCommodityInstruments method call.Value Description itAllInstruments Represents all instrument types. itAllOptions Represents Option Call and Option Put instrument types. itFuture Represents Futures instrument type. itOptionCall Represents Option Call instrument type. itOptionPut Represents Option Put instrument type. itOther Represents other (not explicitly listed in the enumeration) instrument types, such as cash, indices, currencies, reports etc. itStock Represents Stock instrument type. itSyntheticStrategy Represents synthetic strategy instrument type. itTreasure Represents Treasury instrument type. itUndefined Undefined type. - cqg_commodity_intruments
A collection, which contains names of instruments corresponding to the requested commodity and filtered by the bitmask set in RequestCommodityInstruments Method.
For example, the returned instrument name for the commodity "EP", will have the following format: "F.EPH7".
If the requested symbol name is invalid the instrumentNames collection will be empty.
The examples below show how to request a symbol list, handle its resolution event, and operate with the received collection.
Const ColNumber = 1 Private Sub CEL_CELStarted() ' Request commodity instrument names list after CEL is started up ' here we request Futures, Option Call and Option Put instruments CEL.RequestCommodityInstruments "DD", itFuture Or itAllOptions End Sub Private Sub CEL_CommodityInstrumentsResolved(ByVal commodityName As String, _ ByVal instrumentTypes As eInstrumentType, _ ByVal instrumentNames As CQG.ICQGCommodityInstruments) Dim InstrumentName As String Dim RowNumber As Integer RowNumber = 1 'iterate through the resolved instrument names collection For Each InstrumentName In instrumentNames ' Subscribe to each instrument in the collection CEL.NewInstrument InstrumentName ' print each instrument name on the active sheet ActiveSheet.Cells(RowNumber, ColNumber) = InstrumentName RowNumber = RowNumber + 1 Next End Sub
#region CQG API event handlers private void cel_CELStarted() { // Request commodity instrument names list after CEL is started up // here we request Futures, Option Call and Option Put instruments cel.RequestCommodityInstruments( "DD", eInstrumentType.itFuture | eInstrumentType.itAllOptions) ; } private void cel_CommodityInstrumentsResolved(string commodityName, eInstrumentType instrumentTypes, CQGCommodityInstruments instrumentNames) { // Iterate through the resolved instrument names collection foreach( string instrumentName in instrumentNames ) { // Subscribe to each instrument in the collection cel.NewInstrument( instrumentName ) ; // Print each instrument name on the console Console.WriteLine( instrumentName ) ; } } #endregion