API Support Forum
OEC API > API Support > OEC API problems in Remoting mode
Author Topic: OEC API problems in Remoting mode
(2 messages, Page 1 of 1)
Moderators: VPfau
TGalanos
Posts: 2
Joined: Nov 25, 2014


Posted: Dec 12, 2014 @ 07:13 AM             Msg. 1 of 2
During development adapter for BookMap I found two issues related to OEC API. I use Remote API mode and OEC Trader version 3.5.15.14 for development.

1. Symbol look up problem - we can look up contracts only by full name ('ESZ4' for example), not by prefix (just 'ES'). In second case OEC Trader application displays error message and no callback called so we unable to know about problem from caller side.


var api = OECClient.CreateInstance(true);
if (!api.RemoteHostingEnabled)
{
Console.WriteLine("Unable to connect OEC Remoting API.");
return;
}

api.OnSymbolLookupReceived += (lookup, contracts) =>
{
Console.Write("Symbol lookup '{0}' results: ", lookup.SearchText);
if (contracts.Count == 0)
{
Console.WriteLine("contract not found!");
}
else
{
Console.WriteLine(contracts.First.Symbol);
}
};
api.SymbolLookup("ESZ4"); // This one works fine and event fired
api.SymbolLookup("ES"); // This one cause error message and no events

Console.WriteLine("Press any key for continue...");
Console.ReadLine();


2. DoM subscription problem - any attempts to call SubscribeDOM method will lead to display same error message and we never receive DoM updates. But if contract already subscribed on DoM (it opened in DoM viewer inside OEC Trader application) all works fine. Moreother after re-login API starts to receive DoM data for all contracts referenced in UI.


var api = OECClient.CreateInstance(true);
if (!api.RemoteHostingEnabled)
{
Console.WriteLine("Unable to connect OEC Remoting API.");
return;
}

api.OnSymbolLookupReceived += (lookup, contracts) =>
{
var contract = contracts.First;
Console.WriteLine("OnSymbolLookupReceived('{0}')", contract.Symbol);

api.Subscribe(contract);
api.SubscribeDOM(contract);
};
api.OnDOMChanged += contract =>
Console.WriteLine("OnDOMChanged('{0}')", contract.Symbol);

api.SymbolLookup("ESZ4"); // Trigger error in OEC Trader application if ESZ4 not opened in DoM viewer

Application.Run(); // I need it for events receiving


How I can find real problem root cause? Is these problems are on my side or these are issues my concrete OEC Trader/API version?

Tsachi Galanos
CMicciche902
Posts: 367
Joined:


Posted: Dec 12, 2014 @ 04:40 PM             Msg. 2 of 2
API Remoting is an older method that will be retired in the near future. You need to create an API instance instead of using Remoting. Remoting tethers with the OEC Trader application.

Please review the following post to create an instance: http://www.openecry.com/api/api/html/fc0637f9-3fd0-407e-ad3a-51e79c4014ed.htm

Symbol Lookup example: http://www.openecry.com/api/api/html/0522b8f0-2870-43a9-ad0a-76a4421cbac1.htm

Market Data examples: http://www.openecry.com/api/api/html/4e2865e8-7ac9-457e-8d5a-6d930f3408a8.htm

Chris M