Author |
Topic: Pulling in Silver Weekly Options (10 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
RWare2020 Posts: 206 Joined: Feb 11, 2020 |
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: 63 Joined: |
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: 206 Joined: Feb 11, 2020 |
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: 63 Joined: |
Please provide user name/account you use.
If possible, your code. Yes, "OSI" is a correct symbol. Evgeny
|
||||
RWare2020 Posts: 206 Joined: Feb 11, 2020 |
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: 63 Joined: |
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: 206 Joined: Feb 11, 2020 |
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: 63 Joined: |
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: 63 Joined: |
Silver Weekly Options should be available now.
Please check. Base sysmbols are OSO1, OSO2, OSO3, OSO4, OSO5 Thanks Evgeny
|
||||
RWare2020 Posts: 206 Joined: Feb 11, 2020 |
They are working now, thanks.
|
||||