IB Gateway Automation

Last week, we released IBAutomater, a tool that allows you to automate many actions while connecting to Interactive Brokers via the IB Gateway. It is best used with LEAN to fully manage your algorithm portfolio but can be plugged into your own trading system. We created it as a standalone, event-based, version-controlled package for handling login events of the IB Gateway in a predictable manner.

IBAutomater contains three key events your application can handle to automate your processes;

  • OutputDataReceived, for capturing all logging output from the IB Gateway process allowing you to capture complete logs and handle the data appropriately.
  • ErrorDataReceived, to capture and handle error logging information emitted by IB Gateway.
  • Exited, to detect and handle when the IB Gateway process ends.

With these systems, you can now create an automated login flow that gracefully deals with success and failure conditions using IBAutomater’s built-in event handlers. Starting and stopping the IBGateway can be automated while error and output data can be easily logged, so you can deeply integrate IBAutomater into your applications.

IBAutomater, like the rest of LEAN, is copyrighted under the Apache 2.0 license. Apache 2.0 is incredibly permissive in allowing unrestricted use, extension, and integration of the software it covers. Empowering organizations to build on the LEAN stack means giving them the freedom to create proprietary components on top of it, which an Apache 2.0 license achieves.

Anyone using the IBAutomater will also benefit from versioning powered by NuGet. NuGet provides an easy and familiar installation process while letting you pin your local development to a specific version. As this package is used in production at QuantConnect you can have confidence it will be fully tested with thousands of live IB accounts in the QuantConnect cloud. Check out our full installation and usage instructions on GitHub.

Alex Otsu

By: Alex Otsu

28.05.2019