SmartQuant Discussion

Get Event on OQ Application Shutdown
Page 1 of 1

Author:  aburnettthompson [ Sat Sep 17, 2011 1:19 am ]
Post subject:  Get Event on OQ Application Shutdown

Hi there,

I'm writing my own code to push trades from OQ to database. Part of this involves connection to a message broker (AMQP) which runs on its own (internal) threads. I need an event of some kind when OpenQuant is shutting down as I need to dispose of the connection. Without this when OQ is closed my code & the messaging connection keeps the process alive.

I tried subscribing to Application.ApplicationExit but it doesn't fire. Is there anything else I can do to get an event or callback when OQ is closed by the user?


Author:  Dr. Anton Fokin [ Sat Sep 17, 2011 11:44 am ]
Post subject:  Re: Get Event on OQ Application Shutdown


perhaps Alex will reply on Monday with some better idea, but I think you can try to put your code in a destructor of an object that is disposed on application close.


Author:  aburnettthompson [ Sat Sep 17, 2011 3:45 pm ]
Post subject:  Re: Get Event on OQ Application Shutdown

Currently I'm initializing my services in the static constructor of a base strategy which I then inherit in OQ strategies. Also I managed to get a shutdown event by subscribing to Application.ThreadExit and checking for synchronisationContext != null (which indicates the UI thread shutting down).

However, I think I'm going about this the wrong way.

Basically what I want to do is route completed orders to my own trade booking system for auditing purposes. It may be better for me to create an Execution Provider (which would have explicit Connect/Disconnect/Shutdown method calls) that first routes the order to broker (Interactive Brokers) and second to my own Trade Booking system if successfully filled.

Does this sound like a better plan?

I understand the Interactive Brokers execution provider isn't open sourced, would it be difficult to do the above?

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