API Support Forum
OEC API > Market Data > download a list of CME market options
Author Topic: download a list of CME market options
(4 messages, Page 1 of 1)
Moderators: VPfau
FGiordano538
Posts: 21
Joined: May 09, 2022


Posted: Jun 16, 2022 @ 08:48 AM             Msg. 1 of 4
Hello, I need to download a list of CME market options, including all of them. Is there a command? And if so, is there an example in vb.net?
Thank you
CMicciche902
Posts: 332
Joined:


Posted: Jun 16, 2022 @ 02:34 PM             Msg. 2 of 4
There are too many contracts for one single command. You may review symbol lookup: https://gainfutures.com/GFAPI/?topic=html/0522b8f0-2870-43a9-ad0a-76a4421cbac1.htm and https://gainfutures.com/specifications/
Chris M
CMicciche902
Posts: 332
Joined:


Posted: Jun 16, 2022 @ 02:36 PM             Msg. 3 of 4
FGiordano538
Posts: 21
Joined: May 09, 2022


Posted: Jun 17, 2022 @ 05:17 AM             Msg. 4 of 4
with the command "client.Contracts.Lookup.ByCriteria", I can download symbols with a common base, maximum 50.
With "Client.Contracts.Lookup.BySymbol (Tit_)" I download as many as I want, but I need to know the exact symbol.
it seems to me that with the command "Client.Contracts.Load.Request (Request.Build)", I can download all the options of an underlying in groups of 1000. I tried but failed.
Place the code.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TitoliRichiesti = gfClient.Contracts.Lookup.BySymbol("ESZ22")

End Sub

Sub gfClient_SymbolLookupReceived_(c As IGFClient, e As SymbolLookupEventArgs)
If e.RequestID = TitoliRichiesti Then
For Each contract As GF.Api.Contracts.IContract In e.Contracts
ScaricaOp_Sottostante(contract)
Next

End If

End Sub
Private Sub ScaricaOp_Sottostante(contract As GF.Api.Contracts.IContract)

If contract.HasOptions Then
Dim _loadContractExpression As New ContractLoadExpressionBuilder

_loadContractExpression.Push(New ParentContractIDCriterion(contract.ID))
_loadContractExpression.Build()

Dim Request As New ContractLoadRequestBuilder()
Request.WithSkipCount(0)
Request.WithResultCount(1000)

Request.WithExpression(_loadContractExpression.Build)
Request.Build()

_loadRequestID = gfClient.Contracts.Load.Request(Request.Build)
End If
End Sub

it returns me this error
"System.InvalidOperationException: 'Tree must have single root. Push more operators."