API Support Forum
OEC API > API Support > Cannot Retrieve Contracts
Author Topic: Cannot Retrieve Contracts
(3 messages, Page 1 of 1)
Moderators: VPfau
FFred58
Posts: 8
Joined: May 19, 2009


Posted: May 19, 2009 @ 12:00 AM             Msg. 1 of 3
I cannot retrieve a list of contracts from a BaseContract object.

In fact, even the advanced sample is having problems doing that in the following section of the code:

private void SubscribeSomeContracts()
{
List<Contract> contracts = OECClient.Global.BaseContracts["ES"].GetNearestContracts( 2 );
OECClient.Global.Subscribe( contracts[0] );
OECClient.Global.Subscribe( contracts[1] );
}


I get an Index out of Range error in the contracts[0] section.

I am having similar problems in my own code:
Dim BaseCon As OEC.API.BaseContract = OEC.API.OECClient.Global.BaseContracts("ES")

This returns a valid BaseContract object, but the BaseCon.Contracts list has a count of zero.

Thanks in advance for any help...
Fred.

Fred Baptiste
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: May 19, 2009 @ 12:00 AM             Msg. 2 of 3
have you downloaded "ES" contracts using OECClient.RequestContracts method?
FFred58
Posts: 8
Joined: May 19, 2009


Posted: May 19, 2009 @ 12:00 AM             Msg. 3 of 3
I have now done that and handling the OnContractsChanged event. This seems to work.

However, the API documentation I have does not list any of those methods/events.

I downloaded the API docs from the following location:
http://www.openecry.com/api/apichm.zip

The OECClient page has this at the bottom of it:
Generated from assembly API [3.1.2.0]


I notice that the API.dll I am using (from one of the samples) is 3.3.0.

Where can I download the latest API doc (or could you email it to me)?

Your help is much appreciated!!
Thanks!

Fred Baptiste