API Support Forum
OEC API > API Support > White Sugar (WSG) Contracts request returns in OnContractsChange as a "W"
Author Topic: White Sugar (WSG) Contracts request returns in OnContractsChange as a "W"
(2 messages, Page 1 of 1)
Moderators: VPfau
CWeber984
Posts: 226
Joined: Apr 24, 2012


Posted: Jul 27, 2012 @ 04:07 PM             Msg. 1 of 2
From http://www.openecry.com/trading/order-types.cfm

futures->softs-> White Sugar's symbol is WSG.

We use this API call: OECAPI()->RequestContracts(...).
When we send in "WSG", OnContractsChange() returns a "W".

CString csStr = "WSG";
OECAPICOM::IBaseContractPtr bc = OECAPI()->BaseContracts->FindBySymbol((LPCTSTR) csStr);
if(bc)
{
OECAPI()->RequestContracts(bc); //subscribe to get this base contract.
}

apiOEC::OnContractsChanged(LPDISPATCH/*IBaseContract*/bc)
{
OECAPICOM::IBaseContractPtr BaseContract = bc;
BaseContract->Symbol; //This gives us the "W"
//OECAPICOM::IContractPtr con = contracts->ItemByIndex(I);
//std:string base = con->BaseSymbol; //"W" again
}

We tested it through OEC_Trader_Demo_3.5, but were unable to find the WSG symbol at all (or the "W" symbol).

Can you verify that WSG is currently unavailable and that this is perhaps an OEC-side bug?

CHW
jlanawalt
Posts: 88
Joined: Feb 12, 2009


Posted: Aug 13, 2012 @ 04:56 PM             Msg. 2 of 2
It looks like WSG is being returned by the demo server again so we can no longer reproduce this error.

It would have been nice to know that this was server-side and what tests we ought to be doing to avoid a bad value in OnContractsChanged.