API Support Forum
OEC API > API Support > Weekly options
Author Topic: Weekly options
(4 messages, Page 1 of 1)
Moderators: VPfau
CWeber984
Posts: 226
Joined: Apr 24, 2012


Posted: Apr 15, 2013 @ 03:31 PM             Msg. 1 of 4
I am unable to find a way in the api to get the weekly options for a given symbol, say the 10 yr T-Note.

When I use OEC Trader Demo Options Chain, I select ZNM3 for the underlying, and then in the expiration drop down list I see the OZN expirations, which includes the expirations for OZN1, OZN2, and OZN3.
I was trying to get a similar list of those weekly options by using the following code:

OECAPICOM::IContractPtr futCon = OECAPI()->Contracts->Item("ZNM3");
OECAPICOM::IContractListPtr options = futCon->Options;

However, the list of options contracts are all monthlies. I would like to be able to obtain the available weekly options through some similar method.

I've tried a few things programmatically and have scoured the documentation, but haven't found anything related to getting weekly options.

Do you have any advice about how I can get the weekly options for a given symbol?

Thanks for your support,

CHW
CWeber984
Posts: 226
Joined: Apr 24, 2012


Posted: Apr 15, 2013 @ 09:07 PM             Msg. 2 of 4
Update: the documentation for weekly options clarified what I might need to do in order to get the weekly options for a given symbol. (for example: http://www.cmegroup.com/trading/equity-index/us-index/nasdaq-100_contractSpecs_options.html#prodType=WK1)

As the weekly options have their own base symbols, I will need to request the contracts for those base syms. The contracts return in OnContractsChanged. This worked when I requested the contracts for EW1/2/4 (E-mini S&P500 options week 1).

Also, I am aware the weekly options would be returned through the OnSymbolLookupReceived callback, but was just hoping for an alternative.

I am still holding out some hope to be able to request the contract for an options base symbol and have its weekly options returned in its contracts list, but I understand if this is not possible. Let me know.

Much appreciated,

CHW
CWeber984
Posts: 226
Joined: Apr 24, 2012


Posted: Apr 15, 2013 @ 11:07 PM             Msg. 3 of 4
Update: I've found that if I request the contracts for the desired base weekly symbol first, then when I execute the 2 lines of code in the first msg post, the weekly symbols /are/ in the contract list.

For example:

OECAPICOM::IBaseContractPtr bc = OECAPI()->BaseContracts->Item("OEW4");
OECAPI()->RequestContracts(bc);
OECAPICOM::IBaseContractPtr bc = OECAPI()->BaseContracts->Item("OES");
OECAPI()->RequestContracts(bc);

OECAPICOM::IContractPtr futCon = OECAPI()->Contracts->Item("ESM3");
OECAPICOM::IContractListPtr options = futCon->Options;

The contracts for OES month/yr combos as well as OEW4 month/yr combos is now found in the "options" contract list.

Is this going to be alright, or would you recommend a different way?

Thanks again,


CHW
Edited by CWeber984 on Apr 15, 2013 at 23:08:14
DmitriyG
Posts: 9
Joined: Oct 26, 2011


Posted: Apr 16, 2013 @ 11:21 AM             Msg. 4 of 4
To get all option bases for your contract you can use OECAPI SymbolLookup method with parameters specified:

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

where Underlying is your contract instance. Ensure in OnSymbolLookupReceived handler that you get response. Results contain one option contract of each option base. Use them to request all other available options using RequestContracts. ContractsChanged handler can be used to monitor results for that operation.


Dmitriy Gorbachyov
Edited by DmitriyG on Apr 16, 2013 at 11:23:49