API Support Forum
User Profile

Viewing User Profile for: MMartinovic306


About

Oct 11, 2012 06:07 AM

Oct 24, 2012 03:14 PM

Oct 24, 2012 03:49 PM



Post Statistics
MMartinovic306 has contributed to 2 posts out of 5677 total posts (0.04%) in 4424 days (0.00 posts per day).

20 most recent posts:

API Support » OECClient.Contracts is empty? Oct 24, 2012 @ 03:14 PM (Total replies: 3)

Thank you, that solved it.

As a sidenote, having a sample app more informative than the documentation iteslf is generally not an ideal state of things, that's just for your consideration.

Nevertheless, thank you very much.

Miroslav Martinovic

API Support » OECClient.Contracts is empty? Oct 23, 2012 @ 04:31 AM (Total replies: 3)

I am trying to connect to api servers, the connection seems to be established fine, but when I try to pick a contract, it fails, because OECClient.Contracts contains no items (it's not null, just zero-length list.)

I am using following code:


oclient = OEC.API.OECClient.CreateInstance(false);
oclient.OnLoginComplete += new OEC.API.OnLoginCompleteEvent(oclient_OnLoginComplete);
oclient.OnLoginFailed += new OEC.API.OnLoginFailedEvent(oclient_OnLoginFailed);
oclient.OnError += new OEC.API.OnErrorEvent(oclient_OnError);
oclient.UUID = uuid;
oclient.Connect(host, port, username, password, true);


and then in oclient_OnLoginComplete i try to retrieve the contract:

OEC.API.Contract esuContract = oclient.Contracts["ESZ2"];
oclient.Subscribe(esuContract);
oclient.OnPriceTick += new OEC.API.OnPriceChangedEvent(oclient_OnPriceTick);


which fails on the first line as oclient.Contracts.Count is zero.
What am I doing wrong?

(I've been snooping around other oclient variables, and for example oclient.BaseContracts populates just fine, but all the items in it seem to have their Contracts list/property zero-length as well. All the other properties (Accounts, Channels, Currencies, everything) seem to be initialized fine, it seems to me just as if server was consistently trying to convince me there are no contracts available to subscribe to...)

Miroslav Martinovic