This package can be used to connect to Interactive Brokers' trading services through the Trader Workstation (TWS) and IB Gateway (IBG) apps.

Disclaimer and Waiver

You can use this package for any and all purposes so long as it's connected to your paper trading account or Interactive Brokers' live demo. You are violating the license agreement in the instant you connect InteractiveTradeR to a live Interactive Brokers account without permission. Please contact Jake Vestal, the package author, for information on licensing.

Not affiliated with Interactive Brokers, LLC in any way.

Package options

InteractiveTradeR uses the following R options to configure your connections to Trader Workstation (TWS) and IB Gateway (IBG):

  • interactivetrader.paper: Set to TRUE to use options configured for PAPER account; set to FALSE for LIVE. Defaults to TRUE. Using InteractiveTradeR to trade real money without a license violates the license agreement.

  • interactivetrader.platform: Set to "TWS" to use options configured for Trader Workstation account; set to "IBG" for IB Gateway. Defaults to TWS.

  • interactivetrader.tws.paper.host: Identifies its set value as the host name at which InteractiveTradeR should look to connect to an instance of Trader Workstation connected to a PAPER account. Because most users run TWS on the same machine as InteractiveTradeR, this option should usually be kept to the default setting of "localhost".

  • interactivetrader.tws.paper.host: Identifies its set value as the host name at which InteractiveTradeR should look to connect to an instance of Trader Workstation connected to a PAPER account. Because most users run TWS on the same machine as InteractiveTradeR, this option should usually be kept to the default setting of "localhost".

  • interactivetrader.tws.paper.port: Identifies the port on which an instance of Trader Workstation, connected to a PAPER account, has been configured to listen for API connections. Default is 7497, matching the default set by Interactive Brokers.

  • interactivetrader.tws.paper.master: To use a master_client_idMaster Client ID that you have configred within TWS for a PAPER account, set this option to the value you have selected for your TWS paper account's Master Client ID.

  • interactivetrader.ibg.paper.host: Identifies its set value as the host name at which InteractiveTradeR should look to connect to an instance of IB Gateway connected to a PAPER account. Because most users run IBG on the same machine as InteractiveTradeR, this option should usually be kept to the default setting of "localhost".

  • interactivetrader.ibg.paper.port: Identifies the port on which an instance of IB Gateway, connected to a PAPER account, has been configured to listen for API connections. Default is 4002, matching the default set by Interactive Brokers.

  • interactivetrader.ibg.paper.master: To use a master_client_idMaster Client ID that you have configred within IBG for a PAPER account, set this option to the value you have selected for your IBG paper account's Master Client ID.

  • interactivetrader.tws.live.host: Identifies its set value as the host name at which InteractiveTradeR should look to connect to an instance of Trader Workstation connected to a LIVE account on which actual trades will be executed with real money. Because most users run TWS on the same machine as InteractiveTradeR, this option should usually be kept to the default setting of "localhost". Using InteractiveTradeR to trade real money without a license violates the license agreement.

  • interactivetrader.tws.live.port: Identifies the port on which an instance of Trader Workstation, connected to a LIVE account, has been configured to listen for API connections. Default is 7496, matching the default set by Interactive Brokers. Using InteractiveTradeR to trade real money without a license violates the license agreement.

  • interactivetrader.tws.live.master: To use a master_client_idMaster Client ID that you have configred within TWS for a LIVE account, set this option to the value you have selected for your TWS paper account's Master Client ID. Using InteractiveTradeR to trade real money without a license violates the license agreement.

  • interactivetrader.ibg.live.host: Identifies its set value as the host name at which InteractiveTradeR should look to connect to an instance of IB Gateway connected to a LIVE account on which actual trades will be executed with real money. Because most users run IBG on the same machine as InteractiveTradeR, this option should usually be kept to the default setting of "localhost". Using InteractiveTradeR to trade real money without a license violates the license agreement.

  • interactivetrader.ibg.live.port: Identifies the port on which an instance of IB Gateway, connected to a LIVE account, has been configured to listen for API connections. Default is 4001, matching the default set by Interactive Brokers. Using InteractiveTradeR to trade real money without a license violates the license agreement.

  • interactivetrader.ibg.live.master: To use a master_client_idMaster Client ID that you have configred within IBG for a LIVE account, set this option to the value you have selected for your IBG paper account's Master Client ID. Using InteractiveTradeR to trade real money without a license violates the license agreement.

See also