SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Tue Dec 10, 2019 6:38 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Fill event not trigerred
PostPosted: Thu Oct 03, 2019 8:07 pm 
Offline

Joined: Mon Sep 02, 2019 10:31 am
Posts: 27
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?

Thanks!


Attachments:
OrderFilledTWS.JPG
OrderFilledTWS.JPG [ 13.81 KiB | Viewed 267 times ]
FillEvent.JPG
FillEvent.JPG [ 111.49 KiB | Viewed 267 times ]
Top
 Profile  
 
PostPosted: Fri Oct 04, 2019 11:30 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 562
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.
Code:
framework.OrderManager.Send(order);


Top
 Profile  
 
PostPosted: Fri Oct 04, 2019 5:36 pm 
Offline

Joined: Mon Sep 02, 2019 10:31 am
Posts: 27
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?


Top
 Profile  
 
PostPosted: Fri Oct 04, 2019 6:13 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 562
According DemoApp:
Code:
            
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;
      framework.OrderManager.Send(order);
   }

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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group