API Support Forum
OEC API > Market Data > Pulling in Silver Weekly Options
Author Topic: Pulling in Silver Weekly Options
(10 messages, Page 1 of 1)
Moderators: VPfau
RWare2020
Posts: 118
Joined: Feb 11, 2020


Posted: Feb 10, 2021 @ 05:02 PM             Msg. 1 of 10
I can't seem to request the weekly options for the Silver COMEX contract.

The way we request options is:

OECAPICOM::IBaseContractPtr bc = OECAPI()->BaseContracts->Item("OSI2");

if(bc && bc->IsOption)
OECAPI()->RequestContracts(bc); //subscribe to get this base contract.

When doing this, the base contract pointer is NULL.

I can see them in OEC Trader so I can see that they are available, I'm just not sure what I'm doing incorrect to pull in these contracts.
ETrifonov
Posts: 60
Joined: Feb 09, 2015


Posted: Feb 18, 2021 @ 11:15 PM             Msg. 2 of 10
Hello.

What version of COM API do you use?
Looks like it is outdated 3.5 OEC COM API.
Please consider to move to GF COM API.
Also check documentation page for COM API and samples downloads links: https://gainfutures.com/gainfuturesapi/documentation/

Thank you.
Evgeny
RWare2020
Posts: 118
Joined: Feb 11, 2020


Posted: Feb 23, 2021 @ 06:17 PM             Msg. 3 of 10
I have tried the GF COM API as well with the silver weekly options and they are not coming in.

I am getting all other options for other contracts and I am getting the monthly silver contracts, but the weekly silver contracts are not pulling in.

As far as I am aware, the symbol is "OSI" is that correct? Any other suggestions to finding the problem?

Thanks.
ETrifonov
Posts: 60
Joined: Feb 09, 2015


Posted: Feb 23, 2021 @ 06:27 PM             Msg. 4 of 10
Please provide user name/account you use.
If possible, your code.

Yes, "OSI" is a correct symbol.
Evgeny
RWare2020
Posts: 118
Joined: Feb 11, 2020


Posted: Feb 24, 2021 @ 01:37 PM             Msg. 5 of 10
I am using RWare2020 and this is the code I am using to get the options:

Here is the code I use to make sure we are subscribed to the contract:

std::vector weeklies = GetWeeklyMonthlyOptionSyms(opBase);
for(size_t i = 0; i < weeklies.size(); i++)
{
if(m_RequestedOptionsContracts.find(weeklies) == m_RequestedOptionsContracts.end()) {
OECAPICOM::IBaseContractPtr bc = OECAPI()->BaseContracts->Item(weeklies.c_str());
if(bc && bc->IsOption)
{
OECAPI()->RequestContracts(bc); //subscribe to get this base contract.
m_RequestedOptionsContracts.insert(weeklies);
}
}
}


Here is the code I use to actually get the option contracts. Where this code is a little confusing, what we are doing is iterating through all of the options and finding the ones with a different month/year and different base symbol to get the option's available contracts:

OECAPICOM::IContractListPtr options = futCon->Options;
_bstr_t previousMonthYear, previousBase;
int size = options->Count;
for(int i = 0; i < size; i++)
{
OECAPICOM::IContractPtr optCon = options->GetByIndex(i);
if(previousMonthYear != optCon->MonthYear || previousBase != optCon->BaseSymbol)
{
std::string base((char*)optCon->BaseSymbol);
std::string parent((char*)optCon->ParentContract->BaseSymbol);

std::string contractYearMonth = base + (char*)optCon->MonthYear;
orderedList.push_back( OpMonth(optCon->ExpirationDate, contractYearMonth, base, parent) );
previousBase = optCon->BaseSymbol;
previousMonthYear = optCon->MonthYear;
}
}
ETrifonov
Posts: 60
Joined: Feb 09, 2015


Posted: Feb 25, 2021 @ 01:28 AM             Msg. 6 of 10
Hello,

I did check, your account doesn't have restrictions so you should be able to get data.
Did you check our GF COM API sample code, using links I provided for you?
Can you please first make sure you can lookup "OSI" options at all.
Evgeny
RWare2020
Posts: 118
Joined: Feb 11, 2020


Posted: Feb 25, 2021 @ 11:43 AM             Msg. 7 of 10
Yeah I did see the sample code. I am able to get all other options, but the weekly silver options.

I can get the silver monthly options, just not the weekly, so yes I can get the "OSI" options.
ETrifonov
Posts: 60
Joined: Feb 09, 2015


Posted: Feb 28, 2021 @ 10:30 PM             Msg. 8 of 10
Sorry, looks like I'm a bit misundertood you.
For Weekly options, base symbol will be OSO2.
And for some reason we don't have any weekly options for it in the system.
We will look at this issue and let you know.
Evgeny
ETrifonov
Posts: 60
Joined: Feb 09, 2015


Posted: Mar 01, 2021 @ 03:27 PM             Msg. 9 of 10
Silver Weekly Options should be available now.
Please check.
Base sysmbols are OSO1, OSO2, OSO3, OSO4, OSO5
Thanks
Evgeny
RWare2020
Posts: 118
Joined: Feb 11, 2020


Posted: Mar 01, 2021 @ 03:53 PM             Msg. 10 of 10
They are working now, thanks.