Profile Picture

Properly Dispose of IBroker

Posted By austinsimpson 3 Years Ago
Posted Friday March 13 2015
Hi All,

I'm currently developing a broker service using the IBroker interface. Unfortunately, I've ran into an issue where RightEdge doesn't quit after I stop the trading system and close the RightEdge window. If I look in Task Manager, I can still see that RightEdge is open. 

I've done a bit of trial and error through a barebones broker plugin and slowly added pieces of our code until we can replicate the issue. The our API uses a main class for connecting, getting tick data, and placing orders. When it's instantiated, RightEdge won't close. After that, I changed the plugin's inheritance from IBroker to ITickRetrieval and RightEdge shuts down just fine.

I was wondering if there is anything specific to IBroker that needs to be implemented for it to properly shut down.

Posted Monday March 16 2015
I'd guess that there's an event loop that's still running in the API library you're using or in your code.  Make sure to properly close, dispose, shutdown, etc the API class you create in your service's Disconnect method.  If you're running an event loop yourself (ie via calling Application.Run()), make sure to shut it down when Disconnect is called.

Posted Monday March 16 2015
I managed to solve the issue moving the main class's initializer to the Connect method, instead of the Initialize method. It seems to me like Initialize gets called twice on the same instance, or RightEdge is creating two separate instances of our service's main class. 

Anyway, moving our initializer to the Connect method causes us to only create our class when we actually need it.

Thank you for the help!

Similar Topics

Reading This Topic

2005-2018 © RightEdge Systems