Hi,

I'm trying to download historical data from Interactivebrokers using ToolBox. Executing the following in the command line fromĀ \Lean\ToolBox\bin\Debug fails (using Yahoo Finance as downloader works, so the problem is likely IB specific):

QuantConnect.ToolBox.exe --app=IBDL --tickers=SPY --resolution=Daily --from-date=20200201-09:30:00 --to-date=20200227-16:00:00

Here is the output:

20200227 16:23:22.378 Trace:: Config.Get(): Configuration key not found. Key: ib-version - Using default value: 974 20200227 16:23:22.539 Trace:: InteractiveBrokersBrokerage.InteractiveBrokersBrokerage(): Starting IB Automater... 20200227 16:23:22.880 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): StartIBGateway(): starting IBGateway 20200227 16:23:22.986 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): Exception in thread "main" java.lang.NoClassDefFoundError: ibgateway/GWClient 20200227 16:23:22.986 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): at ibautomater.IBAutomater.startIBGateway(IBAutomater.java:69) 20200227 16:23:22.986 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): at ibautomater.IBAutomater.main(IBAutomater.java:55) 20200227 16:23:22.986 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): Caused by: java.lang.ClassNotFoundException: ibgateway.GWClient 20200227 16:23:22.986 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): at java.net.URLClassLoader.findClass(Unknown Source) 20200227 16:23:22.986 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): at java.lang.ClassLoader.loadClass(Unknown Source) 20200227 16:23:22.986 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) 20200227 16:23:22.986 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): at java.lang.ClassLoader.loadClass(Unknown Source) 20200227 16:23:22.986 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): ... 2 more 20200227 16:23:24.097 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterExited(): Exit code: 1 20200227 16:24:22.565 Trace:: InteractiveBrokersBrokerage.InteractiveBrokersBrokerage(): IB Automater initialization timeout. 20200227 16:24:22.565 Trace:: InteractiveBrokersBrokerage.InteractiveBrokersBrokerage(): IB Automater initialized. 20200227 16:24:22.566 Trace:: InteractiveBrokersBrokerage.InteractiveBrokersBrokerage(): Host: 127.0.0.1, Port: 4002, Account: DU1733589, AgentDescription: Individual 20200227 16:24:22.576 Trace:: InteractiveBrokersBrokerage.ResetHandler(): thread started. 20200227 16:24:22.591 Trace:: InteractiveBrokersBrokerage.Connect(): Attempting to connect (1/5) ... 20200227 16:24:27.169 Trace:: InteractiveBrokersBrokerage.HandleError(): RequestId: -1 ErrorCode: -1 - System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 127.0.0.1:4002. at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port). at IBApi.EClientSocket.createClientStream(String host, Int32 port). at IBApi.EClientSocket.eConnect(String host, Int32 port, Int32 clientId, Boolean extraAuth) 20200227 16:24:27.177 Trace:: Brokerage.OnMessage(): Information - Code: -1 - System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 127.0.0.1:4002. at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port). at IBApi.EClientSocket.createClientStream(String host, Int32 port). at IBApi.EClientSocket.eConnect(String host, Int32 port, Int32 clientId, Boolean extraAuth) 20200227 16:24:27.182 Trace:: InteractiveBrokersBrokerage.Connect(): IB message processing thread started: #12 20200227 16:24:27.182 Trace:: InteractiveBrokersBrokerage.Connect(): IB message processing thread ended: #12 20200227 16:24:42.181 Trace:: InteractiveBrokersBrokerage.Connect(): Operation took longer than 15 seconds. 20200227 16:24:43.182 Trace:: InteractiveBrokersBrokerage.Connect(): Attempting to connect (2/5) ... 20200227 16:24:45.187 Trace:: InteractiveBrokersBrokerage.HandleError(): RequestId: -1 ErrorCode: -1 - System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 127.0.0.1:4002. at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port). at IBApi.EClientSocket.createClientStream(String host, Int32 port). at IBApi.EClientSocket.eConnect(String host, Int32 port, Int32 clientId, Boolean extraAuth) 20200227 16:24:45.188 Trace:: Brokerage.OnMessage(): Information - Code: -1 - System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 127.0.0.1:4002. at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port). at IBApi.EClientSocket.createClientStream(String host, Int32 port). at IBApi.EClientSocket.eConnect(String host, Int32 port, Int32 clientId, Boolean extraAuth) 20200227 16:24:45.189 Trace:: InteractiveBrokersBrokerage.Connect(): IB message processing thread started: #14 20200227 16:24:45.190 Trace:: InteractiveBrokersBrokerage.Connect(): IB message processing thread ended: #14 20200227 16:25:00.189 Trace:: InteractiveBrokersBrokerage.Connect(): Operation took longer than 15 seconds. 20200227 16:25:01.191 Trace:: InteractiveBrokersBrokerage.Connect(): Attempting to connect (3/5) ... 20200227 16:25:03.196 Trace:: InteractiveBrokersBrokerage.HandleError(): RequestId: -1 ErrorCode: -1 - System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 127.0.0.1:4002. at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port). at IBApi.EClientSocket.createClientStream(String host, Int32 port). at IBApi.EClientSocket.eConnect(String host, Int32 port, Int32 clientId, Boolean extraAuth) 20200227 16:25:03.196 Trace:: Brokerage.OnMessage(): Information - Code: -1 - System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 127.0.0.1:4002. at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port). at IBApi.EClientSocket.createClientStream(String host, Int32 port). at IBApi.EClientSocket.eConnect(String host, Int32 port, Int32 clientId, Boolean extraAuth) 20200227 16:25:03.197 Trace:: InteractiveBrokersBrokerage.Connect(): IB message processing thread started: #16 20200227 16:25:03.197 Trace:: InteractiveBrokersBrokerage.Connect(): IB message processing thread ended: #16 20200227 16:25:18.197 Trace:: InteractiveBrokersBrokerage.Connect(): Operation took longer than 15 seconds. 20200227 16:25:19.197 Trace:: InteractiveBrokersBrokerage.Connect(): Attempting to connect (4/5) ... 20200227 16:25:21.199 Trace:: InteractiveBrokersBrokerage.HandleError(): RequestId: -1 ErrorCode: -1 - System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 127.0.0.1:4002. at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port). at IBApi.EClientSocket.createClientStream(String host, Int32 port). at IBApi.EClientSocket.eConnect(String host, Int32 port, Int32 clientId, Boolean extraAuth) 20200227 16:25:21.200 Trace:: Brokerage.OnMessage(): Information - Code: -1 - System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 127.0.0.1:4002. at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port). at IBApi.EClientSocket.createClientStream(String host, Int32 port). at IBApi.EClientSocket.eConnect(String host, Int32 port, Int32 clientId, Boolean extraAuth) 20200227 16:25:21.201 Trace:: InteractiveBrokersBrokerage.Connect(): IB message processing thread started: #18 20200227 16:25:21.201 Trace:: InteractiveBrokersBrokerage.Connect(): IB message processing thread ended: #18 20200227 16:25:36.201 Trace:: InteractiveBrokersBrokerage.Connect(): Operation took longer than 15 seconds. 20200227 16:25:37.201 Trace:: InteractiveBrokersBrokerage.Connect(): Attempting to connect (5/5) ... 20200227 16:25:39.203 Trace:: InteractiveBrokersBrokerage.HandleError(): RequestId: -1 ErrorCode: -1 - System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 127.0.0.1:4002. at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port). at IBApi.EClientSocket.createClientStream(String host, Int32 port). at IBApi.EClientSocket.eConnect(String host, Int32 port, Int32 clientId, Boolean extraAuth) 20200227 16:25:39.204 Trace:: Brokerage.OnMessage(): Information - Code: -1 - System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 127.0.0.1:4002. at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port). at IBApi.EClientSocket.createClientStream(String host, Int32 port). at IBApi.EClientSocket.eConnect(String host, Int32 port, Int32 clientId, Boolean extraAuth) 20200227 16:25:39.205 Trace:: InteractiveBrokersBrokerage.Connect(): IB message processing thread started: #20 20200227 16:25:39.205 Trace:: InteractiveBrokersBrokerage.Connect(): IB message processing thread ended: #20 20200227 16:25:54.205 Trace:: InteractiveBrokersBrokerage.Connect(): Operation took longer than 15 seconds.

Here is my IB configurations:

// interactive brokers configuration "ib-account": "DUXXXXXX", "ib-user-name": "XXXXXXXX", "ib-password": "XXXXXXXX", "ib-host": "127.0.0.1", "ib-port": "4002", "ib-agent-description": "Individual", "ib-tws-dir": "C:\\Jts", "ib-trading-mode": "paper", "ib-enable-delayed-streaming-data": true,

Appreciate if someone can assist in figuring out why this fails?

Author