API Support Forum
OEC API > Order Execution > Extremely Slow SendLinkedOrders()
Author Topic: Extremely Slow SendLinkedOrders()
(3 messages, Page 1 of 1)
Moderators: VPfau
DBrubaker673
Posts: 55
Joined: Jul 18, 2007


Posted: Nov 14, 2007 @ 10:42 AM             Msg. 1 of 3
I am sending a Limit/Stop pair with code that looks like this:

DateTime startTime = DateTime.Now;
Order[] orders = OECClient.Global.SendLinkedOrders(draft, linked);
TimeSpan elapsed = DateTime.Now - startTime;
// report elapsed time in milliseconds

I'm connected to api.openecry.com using API 3.1.2.0. I'm running in Release mode, not Debug mode. I have a very fast Internet connection, Windows XP, Pentium 3.00 GHz, 2GB RAM.

The first time I executed orders today, they took about 50 msec each to repeat. Additional orders increase the time quickly, so that after doing 54 buys and 54 sells, each pair takes 250-313 msec each.
After 104 buys and 104 sells, each pair takes 781-828 msec!

I'm sure you understand I can't live with this. Is the issue on my end or on your end? Is there a workaround? Let me know if you need more details.

Thanks,

Dale
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Nov 14, 2007 @ 10:52 AM             Msg. 2 of 3
it seems very strange.

could you please send the sample application to api@openecry.com?
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Nov 14, 2007 @ 11:59 AM             Msg. 3 of 3
I wouldn't suggest using OEC API advanced example for any performance testing - the code was written for simplicity and clearness, not for performance.

Each time you sending an order, OrderStateChanged event is raised, causing order list to reload all the orders (see OEC.API.Example.OrdersControl.OECClient_OnOrderStateChanged)

As I see on your screenshot (Order Events window), it takes about 200 ms to reload the list - and this happens 3 times
per SendLinkedOrders call.

in real-word application this event handler would update just changed order element in less than 10 ms.

Note that you should be careful writing API event handlers in live applications, because they can affect API performance a lot.