API Support Forum
OEC API > API Support > Options Support
Author Topic: Options Support
(2 messages, Page 1 of 1)
Moderators: VPfau
LCarter2
Posts: 20
Joined: Jun 13, 2013


Posted: Aug 30, 2013 @ 03:20 PM             Msg. 1 of 2
From the API documentation it looks like I can get access to options for a particular contract from the OEC::API::Contract::Options field.

I attempted to access the options for ESU3. The HasOptions field is set to true, but there are options (ie Options field has a count of 0).

Is there something that I need to do to have the Options field populated?

I tried using the OECClient::RequestContracts method, but this still did not populate the Options field.

Leigh Carter
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Sep 04, 2013 @ 10:18 AM             Msg. 2 of 2
Hello. It requires the next trick:
1. Request a symbol lookup with ParentContract option:


criteria.DesiredResultCount = 1;
criteria.SearchText = "*";
criteria.ParentContract = Underlying;


2. In symbol lookup's response you will get a couple options related to ESU3. Now you can obtain their base contracts and call RequestContracts(...) for each of them.


var res = new List<BaseContract>();
foreach (Contract contract in Underlying.Options)
if (!res.Contains(contract.BaseContract))
{
res.Add(contract.BaseContract);
OECClient.Global.RequestContracts(contract.BaseContract);
}


Victor Vins
Lead Software Developer