API Support Forum
OEC API > API Support > Subscribing with 3.2
Author Topic: Subscribing with 3.2
(2 messages, Page 1 of 1)
Moderators: VPfau
JWeissbard91
Posts: 21
Joined: Dec 18, 2007


Posted: Jun 26, 2008 @ 09:39 PM             Msg. 1 of 2
Hi,
I had a question about compatibility with 3.2, I apologize in advance if this was already answered elsewhere in the forum. I used to call SubscribeTicks and Subscribe on a Contract:
objOECClient.ContractGroups("Indices").Contracts(txtContract.Text)
where txtContract is a field the user enters.

Now with 3.2 this no longer works. As I understand it I'm supposed to run RequestContracts at some point, but I'm not sure where. When I run the line:
objOECClient.RequestContracts(objOECClient.BaseContracts.FindBySymbol(txtContract.Text))
and then subscribe I still don't get any results. Am I missing something?

What are BaseContracts? Should I be using them instead of Subscribing to Contrats?

Thank you in advance,
Jonathan Weissbard
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Jun 27, 2008 @ 08:34 AM             Msg. 2 of 2
base contract, such as "ES" or "OES" is just a symbol, which cannot be traded or quoted. Indivudual contracts have different expiration months, strike price (for options), legs (for strategies).

When logged in, API gives a full list of available base contracts, but it does not load individual contracts - because there are so many of them.

Application must call RequestContracts for chosen base contracts, so only needed contracts will be downloaded.

Once downloaded (OnContractChanged event is fired), those indivudual contracts are availalble in API and can be used for sending orders and subscribing for prices and ticks.

Note that contracts for existing orders and positions are downloaded automatically on logon.