API Support Forum
OEC API > API Support > Why OECClient.Global.Contracts.Values is empty?
Author Topic: Why OECClient.Global.Contracts.Values is empty?
(5 messages, Page 1 of 1)
Moderators: VPfau
eo707
Posts: 68
Joined: Nov 08, 2011


Posted: Jan 14, 2016 @ 02:52 AM             Msg. 1 of 5
OnLoginComplete I did run the request contract.
OECClient.Global.RequestContracts("RLM-M") (for TF)

I looked in the online documentation, to see where I can find all your methods...Call Back Events...
Could you guide me in addition?
Do I have OnSubscribedSuccess (or Status Changed)???
I don't see any reaction to the RequestContracts call, and then I do call OECClient.Global.Subscribe(Contract from list in subject, but it is null because it is empty)
OECClient.Global.Contracts.Values is empty

It used to work, few hours ago.
After I connect, nothing happened, don't get price changed...

Thanks to your help.
eo707
Posts: 68
Joined: Nov 08, 2011


Posted: Jan 14, 2016 @ 02:56 AM             Msg. 2 of 5
Hello,
Just found the Events Link since I asked in this forum, would like to contribute.

List of Events can be subscribed to OEC:
http://futures.gaincapital.com/api/api/?topic=html/Events_T_OEC_API_OECClient.htm

Thank you for your support
eo707
Posts: 68
Joined: Nov 08, 2011


Posted: Jan 14, 2016 @ 03:06 AM             Msg. 3 of 5
UPDATE:
I ran subscribe after a little while and got my Contract.
Usually It didn't do that...
Still I see that as error and wish to request:
Can you tell me how / when I can be sure that Contract is there?
Since I ran Subscribe one time, and now I miss it (sometimes).

Or, What comes in the sequence before Contract comes to place.

Even when I ask, I continue to look, and find.

Thanks,
eo707
NShine
Posts: 36
Joined:


Posted: Jan 14, 2016 @ 09:13 AM             Msg. 4 of 5
Hi,

Please see our FAQ in our API documentation.

http://www.gainfutures.com/api/api/?topic=html/c1dcf698-2b86-4259-81c1-cb749c226e70.htm

Quote: I called RequestContracts(BaseContract), but Contracts list still has no contracts. Why?
As most of OECClient methods, RequestContracts is asynchronous. Though it returns immediately, results are available only after the contracts are downloaded and event is fired. Make sure you got an event OnContractsChanged before accessing the contracts

In your case, you will want to implement the above event and avoid checking the contracts immediately after your request. The API will not have had time to send the request and receive a response. Let me know if this works for you.

Also, please check the forum for similar questions. In this case, the most recent thread not created by you was titled "Empty Contract List" where I wrote the same answer as I did above.

http://futuresonline.com/cfbb/index.cfm?page=topic&topicID=1039
Edited by NShine on Jan 14, 2016 at 09:14:04
eo707
Posts: 68
Joined: Nov 08, 2011


Posted: Jan 14, 2016 @ 01:35 PM             Msg. 5 of 5
I think I got it..
The FAQ is amazing to get familiar with the API.

you can close it.