SmartQuant Discussion

Fill event not trigerred
Page 1 of 1

Author:  harsh [ Thu Oct 03, 2019 8:07 pm ]
Post subject:  Fill event not trigerred

I am trying to send an order to IB using IB execution provider object. I've added event listeners for multiple Order related events available under "Framework.EventManager.Dispatcher", but none of them are triggered when IB has executed the order.

I see that the order has reflected in TWS console and executed.

Please find attached code sample with breakpoints put on event handlers.

Note: It is a Paper Trading IB account we are testing on.

Can you please explain why none of the events are triggered when Order has executed by IB already?


OrderFilledTWS.JPG [ 13.81 KiB | Viewed 921 times ]
FillEvent.JPG [ 111.49 KiB | Viewed 921 times ]

Author:  skuvv [ Fri Oct 04, 2019 11:30 am ]
Post subject:  Re: Fill event not trigerred

I recommend you take a look at DemoApp solution, it is based on Windows Form application and has similar events. I checked Dispatcher_ExecutionCommand and Dispatcher_ExecutionReport events and they work properly.

ps You should send orders through framework to receive most of events, but you sent your order directly to provider.

Author:  harsh [ Fri Oct 04, 2019 5:36 pm ]
Post subject:  Re: Fill event not trigerred

Thanks @skuv,

When I send the order using OrderManager, Dispatcher_ExecutionCommand and Dispatcher_ExecutionReport but not Fill. Is that a bug or by design?

Also, how does the framework know that I want to send order to IB? Is it just because I had called framework.ProviderManager.GetExecutionProvider("IB") or something else?

Does calling GetExecutionProvider("IB") also sets it as the default Execution Provider for the framework instance?

Author:  skuvv [ Fri Oct 04, 2019 6:13 pm ]
Post subject:  Re: Fill event not trigerred

According DemoApp:
if (sendOrder.Type == OrderType.Market)
      Order order = new Order(ExecutionProvider, instrumentPortfolio, sendOrder.Instrument, sendOrder.Type, sendOrder.Side, sendOrder.Qty, routeId: sendOrder.Route);
      order.AlgoId = sendOrder.AlgoId;

You can set provider right in the Order constructor.
Only strategy can set provider without you. Thus, for application you should set it yourself.

For Fills you should set portfolio, because Fills are created in portfolio.
It works in demo app.

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group