API Support Forum
OEC API > API Support > DataErrrorresponce with no vivid reason
Author Topic: DataErrrorresponce with no vivid reason
(3 messages, Page 1 of 1)
Moderators: VPfau
OVasylenko564
Posts: 2
Joined: Apr 06, 2017


Posted: May 29, 2017 @ 09:58 AM             Msg. 1 of 3
Hi there, i get a weard reaction on simple code. Can't get what's wrong. Any ideas?

public static void ConnectOEC()
{
string login = "DevUserName";
string password = "DevAPIPass";
OECClient oecapi = new OECClient();
oecapi.UUID = "9e61a8bc-0a31-4542-ad85-33ebab0e4e86";
oecapi.Connect("api.gainfutures.com", 9200, login, password, true);
Console.WriteLine("Connecting...");
oecapi.OnLoginComplete += new OnLoginCompleteEvent(oecapi_OnLoginComplete);
oecapi.OnLoginFailed += new OnLoginFailedEvent(oecapi_OnLoginFailed);

Console.WriteLine("OnLoginComplete: CompleteConnected={0}", oecapi.CompleteConnected);
Console.WriteLine("\tAccounts: {0}, orders: {1}, base contracts: {2}", oecapi.Accounts.Count, oecapi.Orders.Count, oecapi.BaseContracts.Count);
System.Windows.Forms.Application.Run();
}


The response is OnLoginComplete: CompleteConnected=False
OnLoginfailed: DattaError

Edited by OVasylenko564 on May 29, 2017 10:02 AM
VPfau
Moderator
Posts: 164
Joined:


Posted: May 30, 2017 @ 10:52 AM             Msg. 2 of 3
Hello,

After OECAPI connects to servers it initializes authentication and data load process. Till it's done you will have CompleteConnetion == false. In case of exception on data load process it will never set CompleteConnetion == true and drop connections.

Check the exception in the logs.
What OECAPI version do you use? Did you take the fresh OECAPI from OEC Trader?
Vitaliy Pfau
OVasylenko564
Posts: 2
Joined: Apr 06, 2017


Posted: May 30, 2017 @ 02:55 PM             Msg. 3 of 3
I've found my problem and solution. My methods with Accounts class were implemented incorrectly. After correction everything works fine. Thanks for your reply!