Author |
Topic: Order.Quantity is being modified from 1 to 2 (7 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
JGagnon Posts: 95 Joined: Apr 11, 2011 |
Could someone take a look at this please?
This is the order I am sending: Command #202262617 Create for Order #202262617 (Buy 1 6EM2 LMT 130.14) updated As the order goes to working, there is a Modify Order command happening changing the Quantity from 1 to 2, stepping through the code does not reveal what is changing the quantity. OnOrderStateChanged: -1: Unknown -> Sent OnOrderStateChanged: -2: Unknown -> Sent OnOrderStateChanged: -3: Unknown -> Sent Send order Sell Short 2 6EM2 STP 130.15 LMT 130.15 OnOrderConfirmed: -1 -> 202262616 OnOrderStateChanged: 202262616: Sent -> Sent Command #202262616 Create for Order #202262616 (Sell Short 2 6EM2 STP 130.15 LMT 130.15) updated OnOrderStateChanged: 202262616: Sent -> Sent Command #202262616 Create for Order #202262616 (Sell Short 2 6EM2 STP 130.15 LMT 130.15) updated OnOrderConfirmed: -2 -> 202262617 OnOrderStateChanged: 202262617: Sent -> Sent Command #202262617 Create for Order #202262617 (Buy 1 6EM2 LMT 130.14) updated OnOrderStateChanged: 202262617: Sent -> Sent Command #202262617 Create for Order #202262617 (Buy 1 6EM2 LMT 130.14) updated OnOrderConfirmed: -3 -> 202262618 OnOrderStateChanged: 202262618: Sent -> Sent The thread '<No Name>' (0x3198) has exited with code 0 (0x0). The thread '<No Name>' (0x3250) has exited with code 0 (0x0). The thread '<No Name>' (0x2a00) has exited with code 0 (0x0). The thread '<No Name>' (0xfac) has exited with code 0 (0x0). Command #202262618 Create for Order #202262618 (Buy 2 6EM2 STP 130.65) updated OnOrderStateChanged: 202262618: Sent -> Sent Command #202262618 Create for Order #202262618 (Buy 2 6EM2 STP 130.65) updated OnOrderStateChanged: 202262616: Sent -> Accepted OnOrderStateChanged: 202262617: Sent -> Accepted OnOrderStateChanged: 202262618: Sent -> Accepted Command #202262617 Create for Order #202262617 (Buy 1 6EM2 LMT 130.14) updated OnOrderStateChanged: 202262616: Accepted -> Working Working OnOrderStateChanged: 202262617: Accepted -> Working Working Command #202262619 Modify for Order #202262617 (Buy 1 6EM2 LMT 130.14) updated Step into: Stepping over non-user code 'OEC.API.OECClient.FireOnCommandUpdated' Step into: Stepping over non-user code 'OEC.API.Core.UpdateCommand' Step into: Stepping over non-user code 'OEC.API.Core.DispatchClientResponse' Step into: Stepping over non-user code 'OEC.API.Core.FrontLayer_ResponseReceived' Step into: Stepping over non-user code 'OEC.API.Layers.ExecutionLayer.SendResponseUp' Step into: Stepping over non-user code 'OEC.API.Layers.OECConnectionLayer.ReadConnection' Step into: Stepping over non-user code 'System.Windows.Forms.Control.InvokeMarshaledCallbackDo' Step into: Stepping over non-user code 'System.Windows.Forms.Control.InvokeMarshaledCallbackHelper' Step into: Stepping over non-user code 'System.Windows.Forms.Control.InvokeMarshaledCallbacks' OnOrderStateChanged: 202262618: Accepted -> Working The thread '<No Name>' (0x1f70) has exited with code 0 (0x0). Working Step into: Stepping over non-user code 'OEC.API.OECClient.FireOnOrderStateChanged' Step into: Stepping over non-user code 'OEC.API.Core.AddOrderState' Step into: Stepping over non-user code 'OEC.API.Core.AddOrderState' Step into: Stepping over non-user code 'OEC.API.Core.DispatchClientResponse' Step into: Stepping over non-user code 'OEC.API.Core.FrontLayer_ResponseReceived' Step into: Stepping over non-user code 'OEC.API.Layers.ExecutionLayer.SendResponseUp' Step into: Stepping over non-user code 'OEC.API.Layers.OECConnectionLayer.ReadConnection' Step into: Stepping over non-user code 'System.Windows.Forms.Control.InvokeMarshaledCallbackDo' Step into: Stepping over non-user code 'System.Windows.Forms.Control.InvokeMarshaledCallbackHelper' Step into: Stepping over non-user code 'System.Windows.Forms.Control.InvokeMarshaledCallbacks' Command #202262620 Modify for Order #202262617 (Buy 2 6EM2 LMT 130.14) updated Step into: Stepping over non-user code 'OEC.API.OECClient.FireOnCommandUpdated' Step into: Stepping over non-user code 'OEC.API.Core.UpdateCommand' Step into: Stepping over non-user code 'OEC.API.Core.DispatchClientResponse' Step into: Stepping over non-user code 'OEC.API.Core.FrontLayer_ResponseReceived' Step into: Stepping over non-user code 'OEC.API.Layers.ExecutionLayer.SendResponseUp' Step into: Stepping over non-user code 'OEC.API.Layers.OECConnectionLayer.ReadConnection' Step into: Stepping over non-user code 'System.Windows.Forms.Control.InvokeMarshaledCallbackDo' Step into: Stepping over non-user code 'System.Windows.Forms.Control.InvokeMarshaledCallbackHelper' Step into: Stepping over non-user code 'System.Windows.Forms.Control.InvokeMarshaledCallbacks' Command #202262619 Modify for Order #202262617 (Buy 2 6EM2 LMT 130.14) updated Step into: Stepping over non-user code 'OEC.API.OECClient.FireOnCommandUpdated' Step into: Stepping over non-user code 'OEC.API.Core.UpdateCommand' Step into: Stepping over non-user code 'OEC.API.Core.DispatchClientResponse' Step into: Stepping over non-user code 'OEC.API.Core.FrontLayer_ResponseReceived' Step into: Stepping over non-user code 'OEC.API.Layers.ExecutionLayer.SendResponseUp' Step into: Stepping over non-user code 'OEC.API.Layers.OECConnectionLayer.ReadConnection' Step into: Stepping over non-user code 'System.Windows.Forms.Control.InvokeMarshaledCallbackDo' Step into: Stepping over non-user code 'System.Windows.Forms.Control.InvokeMarshaledCallbackHelper' Step into: Stepping over non-user code 'System.Windows.Forms.Control.InvokeMarshaledCallbacks' Step into: Stepping over non-user code 'System.Windows.Forms.Control.WndProc' Step into: Stepping over non-user code 'System.Windows.Forms.NativeWindow.DebuggableCallback' Step into: Stepping over non-user code 'System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop' The thread 'Reader Order' (0xce4) has exited with code 0 (0x0). The thread 'Reader Price' (0x2948) has exited with code 0 (0x0). The thread 'vshost.RunParkingWindow' (0x321c) has exited with code 0 (0x0). The thread '<No Name>' (0x1190) has exited with code 0 (0x0). The program '[10392] TradePlatform.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0). Here is the code I am using to create the linked order: OEC.API.Order[] draftOrders = OECClient.Global.SendLinkedOrders(mainOrder, profit1Order, stopLossOrder); profit1Order is the OrderDraft with a Quantity = 1 John Gagnon |
||||
JGagnon Posts: 95 Joined: Apr 11, 2011 |
Here's a little more detail from the OEC Advanced Example:
19:06:18.792 202262633 Command Create Buy 1 6EM2 LMT 130.14 19:06:18.792 4246369 State Sent 19:06:18.823 4246372 State Accepted 19:06:18.852 202262635 Command Modify To: Buy 2 6EM2 LMT 130.14 19:06:18.852 4246375 State Working #2829550 19:06:18.878 202262636 Command Modify To: Buy 2 6EM2 LMT 130.14 19:07:15.186 202262638 Command Cancel 19:07:15.211 4246378 State Cancelled As you can see above when it goes from Accepted to Working the Quantity instantly changes to 2, then there is a second Modify command getting executed, really no idea what is going on here. John Gagnon |
||||
JGagnon Posts: 95 Joined: Apr 11, 2011 |
Am I correct that a limitation of using SendLinkedOrders that if the quantity is not the same as the first order (mainorder) that the system changes the quantity to match that of the mainorder?
For example I just sent the following linked orders: Command #202263224 Create for Order #202263224 (Sell Short 3 6EM2 STP 130.15 LMT 130.14) updated Command #202263225 Create for Order #202263225 (Buy 2 6EM2 STP 131.65) updated Command #202263226 Create for Order #202263226 (Buy 1 6EM2 LMT 130.13) updated OnOrderStateChanged: 202263224: Sent -> Accepted OnOrderStateChanged: 202263225: Sent -> Accepted OnOrderStateChanged: 202263226: Sent -> Accepted OnOrderStateChanged: 202263224: Accepted -> Working Working OnOrderStateChanged: 202263225: Accepted -> Working Working Command #202263227 Modify for Order #202263225 (Buy 2 6EM2 STP 131.65) updated Command #202263226 Create for Order #202263226 (Buy 1 6EM2 LMT 130.13) updated OnOrderStateChanged: 202263226: Accepted -> Working Working Command #202263228 Modify for Order #202263226 (Buy 1 6EM2 LMT 130.13) updated Command #202263227 Modify for Order #202263225 (Buy 3 6EM2 STP 131.65) updated Command #202263229 Modify for Order #202263226 (Buy 3 6EM2 LMT 130.13) updated Command #202263228 Modify for Order #202263226 (Buy 3 6EM2 LMT 130.13) updated As you can see quantity of Order 202263224 = 3 quantity of Order 202263225 = 2 quantity of Order 202263226 = 1 Yet the system changed all quantities to match the main order quantity. I originally had quantities (2, 2, 1) and it was changing the profit target order quantity to 2. Please confirm. I will stop using SendLinkedOrders and instead start using SendOCOOrders with hopefully better results. John Gagnon |
||||
JGagnon Posts: 95 Joined: Apr 11, 2011 |
I'm still stuck on this
Trying to figure out what is modifying my linked order once it moves into the "Working" state: Command #202263346 Modify for Order #202263345 (Buy 1 6EM2 LMT 130.09) updated Step into: Stepping over non-user code 'OEC.API.OECClient.FireOnCommandUpdated' Step into: Stepping over non-user code 'OEC.API.Core.UpdateCommand' Step into: Stepping over non-user code 'OEC.API.Core.DispatchClientResponse' Step into: Stepping over non-user code 'OEC.API.Core.FrontLayer_ResponseReceived' Step into: Stepping over non-user code 'OEC.API.Layers.ExecutionLayer.SendResponseUp' Step into: Stepping over non-user code 'OEC.API.Layers.OECConnectionLayer.ReadConnection' Step into: Stepping over non-user code 'System.Windows.Forms.Control.InvokeMarshaledCallbackDo' Step into: Stepping over non-user code 'System.Windows.Forms.Control.InvokeMarshaledCallbackHelper' Step into: Stepping over non-user code 'System.Windows.Forms.Control.InvokeMarshaledCallbacks' Command #202263347 Modify for Order #202263345 (Buy 2 6EM2 LMT 130.09) updated John Gagnon |
||||
JGagnon Posts: 95 Joined: Apr 11, 2011 |
If I send a sell-short 2 contracts and wait for it to fill
Then send an OCO: 1 contract for buy-limit 2 contract for buy-stop If I kill my program as soon as the order is sent, and then check the progress in the Advanced OEC Example program, the order quantities get modified to be reversed: 2 contract for buy-limit 1 contract for buy-stop Why is this happening? John Gagnon |
||||