Back

Downloading data to my local Lean installation using IB

I was able to get my local installation of Lean to build the default python algorithm, but now I need to download data from Interactive Brokers and it doesn't look like QuantConnect.ToolBox.exe wants to use the configuration in Lean's config.json. I've run it from the command line - should I be running it within the Visual Studio solution somehow? I'm not familiar with it.

config.json snippet:

// The port is what I found in TWS's API configuration.
// I currently have TWS open.
"data-provider": "QuantConnect.Lean.Engine.DataFeeds.DefaultDataProvider",
"live-data-url": "ws://www.quantconnect.com/api/v2/live/data/",
"live-data-port": 8020,
"ib-account": "[redacted]",
"ib-user-name": "[redacted]",
"ib-password": "[redacted]",
"ib-host": "127.0.0.1",
"ib-port": "7497",
"ib-agent-description": "Individual",
"ib-tws-dir": "C:\\Jts",
"ib-trading-mode": "paper",
"ib-enable-delayed-streaming-data": true,
...

Command line execution:

QuantConnect.ToolBox.exe --app=IBDL --tickers=CRON --resolution=Daily --from-date=20180227-09:30:00 --to-date=20200317-16:00:00
20200318 14:46:59.255 Trace:: Config.Get(): Configuration key not found. Key: ib-account - Using default value:
20200318 14:46:59.255 Trace:: Config.Get(): Configuration key not found. Key: ib-host - Using default value: LOCALHOST
20200318 14:46:59.257 Trace:: Config.GetValue(): ib-port - Using default value: 4001
20200318 14:46:59.257 Trace:: Config.Get(): Configuration key not found. Key: ib-tws-dir - Using default value:
20200318 14:46:59.258 Trace:: Config.Get(): Configuration key not found. Key: ib-version - Using default value: 974
20200318 14:46:59.258 Trace:: Config.Get(): Configuration key not found. Key: ib-user-name - Using default value:
20200318 14:46:59.258 Trace:: Config.Get(): Configuration key not found. Key: ib-password - Using default value:
20200318 14:46:59.259 Trace:: Config.Get(): Configuration key not found. Key: ib-trading-mode - Using default value:
20200318 14:46:59.260 Trace:: Config.GetValue(): ib-agent-description - Using default value: I
20200318 14:46:59.419 Trace:: Config.GetValue(): ib-enable-delayed-streaming-data - Using default value: False
20200318 14:46:59.420 Trace:: InteractiveBrokersBrokerage.InteractiveBrokersBrokerage(): Starting IB Automater...
20200318 14:46:59.440 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): IBAutomater process started - Id:18276
20200318 14:46:59.668 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): Exception in thread "main" org.apache.commons.cli.MissingArgumentException: Missing argument for option: user
20200318 14:46:59.668 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): at org.apache.commons.cli.DefaultParser.checkRequiredArgs(DefaultParser.java:211)
20200318 14:46:59.668 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): at org.apache.commons.cli.DefaultParser.handleOption(DefaultParser.java:612)
20200318 14:46:59.669 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): at org.apache.commons.cli.DefaultParser.handleShortAndLongOption(DefaultParser.java:505)
20200318 14:46:59.669 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): at org.apache.commons.cli.DefaultParser.handleToken(DefaultParser.java:243)
20200318 14:46:59.669 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:120)
20200318 14:46:59.669 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:76)
20200318 14:46:59.669 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:60)
20200318 14:46:59.669 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterErrorDataReceived(): at ibautomater.IBAutomater.main(IBAutomater.java:40)
20200318 14:46:59.679 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterExited(): Exit code: 1
20200318 14:47:59.449 Trace:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): IB Automater initialization timeout.
20200318 14:47:59.449 Trace:: InteractiveBrokersBrokerage.InteractiveBrokersBrokerage(): Host: LOCALHOST, Port: 4001, Account: , AgentDescription: I
20200318 14:47:59.453 Trace:: InteractiveBrokersBrokerage.ResetHandler(): thread started.
20200318 14:47:59.460 Trace:: InteractiveBrokersBrokerage.Connect(): Attempting to connect (1/5) ...
20200318 14:48:05.994 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:4001. 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)

As you can see above, none of the config data is used. How does the Toolbox load its config?

Update Backtest







0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi, Jake, this should be loaded from the binary directory of the ToolBox. Where do you put the config file above?

It will be something like this: /Lean/ToolBox/bin/Debug(or Release)/config.json

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


The file I've been modifying is at: /Lean/Launcher/config.json. It contains my algorithm-location reference as well as my quantconnect and interactive brokers account configuration.

After executing a filename search in Visual Studio there's only one other config.json file and it's found in /Lean/ToolBox/CoarseUniverseGenerator/config.json. The ToolBox version only has a few config options set that seem to relate to basic default functionality. Do I have to modify this file by duplicating config information found in my launcher config?

Also I'm not sure why VS only found two files; there are multiple, each found in /Lean/Launcher/bin/[environment]. However when I opened up the /Lean/Launcher/bin/Debug version, it seems to have all the changes I've been making to the /Lean/Launcher version anyhow.

0

Hi Jake Mitchell ,

Thank you for the report.

When IBDownloader makes a history request using the InteractiveBrokerBrokerage, it checks whether Forex data is from Oanda while IBDownloader creates the Forex Symbol using FXCM market. We just need to use Market.Oanda instead of Market.FXCM in IBDownloaderProgram.cs#L73.

As for Equity data, it will be addressed by
Extends IBDownloader to support all security types. #2705
I don't think it's hard (I give it a go for fun), but it may need to wait for changes in InteractiveBrokerBrokerage to allow L1 data first.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed