I'm suddenly unable to deploy algorithms to IB since a recent update in the docker container Quantconnect/lean:latest.
I've been able to use lean-cli to deploy toy trading algorithms to IB previously.
The error comes after creating the IB brokerage:
20240804 08:31:07.358 TRACE:: BrokerageSetupHandler.CreateBrokerage(): creating brokerage
'QuantConnect.Brokerages.InteractiveBrokers.InteractiveBrokersBrokerage'
20240804 08:31:07.362 TRACE:: Config.GetValue(): ib-response-timeout - Using default value: 300
20240804 08:31:07.362 TRACE:: Config.GetValue(): ib-no-submission-orders-response-timeout - Using default value: 10
20240804 08:31:07.363 TRACE:: Config.GetValue(): ib-combo-order-fill-timeout - Using default value: 30
20240804 08:32:47.424 ERROR:: ApiConnection.TryRequest(authenticate): Error: The operation has timed out.
20240804 08:32:47.425 ERROR:: ValidateSubscription(): Failed during validation, shutting down. Error : Invalid api user
id or token, cannot authenticate subscription.
Error: Something went wrong while running 'TestLive' in the 'lean-cli' environment, the output is stored in
'TestLive\live\2024-08-04_16-30-55'
Current checks:
I've used lean login and lean whoami successfully. (so I don't understand why it reads invalid api user id or token).
I've tested the QuantConnect API successfully using my login details, based on this link.
The credentials in lean.json, specifically the IB credentials as well as the organization id, are correct. (They were also unchanged since it last worked)
I'm curious as to why ValidateSubscription fails suddenly, when lean login and lean whoami works fine.
I'm also unable to find the source code to debug the exact request that fails when spinning up InteractiveBrokersBrokerage.InteractiveBrokersBrokerage()
Please assist. Appreciate any help.
The returned logs when using lean deploy
To use IB with QuantConnect you must use IBKR Mobile. This is done from your IB Account Manage Account -> Settings -> User Settings ->
Security -> Secure Login System. In the Secure Login System, select "IB Key Security via IBKR Mobile". Your account details are not saved
on QuantConnect. Interactive Brokers Lite accounts do not support API trading.
Delayed market data is used when you subscribe to data for which you don't have a market data subscription on IB. If delayed market data is
disabled, live trading will stop and LEAN will shut down when this happens.
Package source with Name: Package source 1 added successfully.
The template "Solution File" was created successfully.
The template "Class Library" was created successfully.
Determining projects to restore...
Writing /tmp/tmpnnfAFK.tmp
info : Adding PackageReference for package 'QuantConnect.Brokerages.InteractiveBrokers' into project
'/ModulesProject/ModulesProject.csproj'.
info : Restoring packages for /ModulesProject/ModulesProject.csproj...
info : Installed QuantConnect.Brokerages.InteractiveBrokers 2.5.16552 from /Modules with content hash
5HpHzi0wQGWfejwbO7+4NgfkQhVmBdrOPzzo5iRvAgv/qGQw+YJavh1vdy5CujJSBwZuPb4AXc4rd9A8F5ByEQ==.
info : Package 'QuantConnect.Brokerages.InteractiveBrokers' is compatible with all the specified frameworks in project
'/ModulesProject/ModulesProject.csproj'.
info : PackageReference for package 'QuantConnect.Brokerages.InteractiveBrokers' version '2.5.16552' added to file
'/ModulesProject/ModulesProject.csproj'.
info : Committing restore...
info : Generating MSBuild file /Compile/obj/ModulesProject/ModulesProject.csproj.nuget.g.props.
info : Generating MSBuild file /Compile/obj/ModulesProject/ModulesProject.csproj.nuget.g.targets.
info : Writing assets file to disk. Path: /Compile/obj/ModulesProject/project.assets.json
log : Restored /ModulesProject/ModulesProject.csproj (in 297 ms).
Determining projects to restore...
Writing /tmp/tmpOBoO1R.tmp
info : Adding PackageReference for package 'QuantConnect.Brokerages.InteractiveBrokers.ToolBox' into project
'/ModulesProject/ModulesProject.csproj'.
info : Restoring packages for /ModulesProject/ModulesProject.csproj...
info : Installed QuantConnect.Brokerages.InteractiveBrokers.ToolBox 2.5.16550 from /Modules with content hash
wlbRFBnaVsIiesNa7Fnwu2IX1vmnqHWCZV0XWgy1py4pJGruAuH1NqlrVXVhLsMTxP+flDjZPMRfRcODNcsT9Q==.
info : Package 'QuantConnect.Brokerages.InteractiveBrokers.ToolBox' is compatible with all the specified frameworks in project
'/ModulesProject/ModulesProject.csproj'.
info : PackageReference for package 'QuantConnect.Brokerages.InteractiveBrokers.ToolBox' version '2.5.16550' added to file
'/ModulesProject/ModulesProject.csproj'.
info : Committing restore...
info : Writing assets file to disk. Path: /Compile/obj/ModulesProject/project.assets.json
log : Restored /ModulesProject/ModulesProject.csproj (in 223 ms).
20240804 08:31:02.389 TRACE:: Config.Get(): Configuration key not found. Key: version-id - Using default value:
20240804 08:31:02.394 TRACE:: Config.Get(): Configuration key not found. Key: cache-location - Using default value:
20240804 08:31:02.395 TRACE:: Config.GetValue(): project-id - Using default value: 0
20240804 08:31:02.396 TRACE:: Config.Get(): Configuration key not found. Key: plugin-directory - Using default value:
20240804 08:31:02.399 TRACE:: Composer(): Loading Assemblies from /Lean/Launcher/bin/Debug
20240804 08:31:02.430 TRACE:: Python for .NET Assembly: Python.Runtime, Version=2.0.38.0, Culture=neutral, PublicKeyToken=5000fea6cba702dd
20240804 08:31:02.467 TRACE:: Engine.Main(): LEAN ALGORITHMIC TRADING ENGINE v2.5.0.0 Mode: DEBUG (64bit) Host: SerGreene
20240804 08:31:02.508 TRACE:: Engine.Main(): Started 8:31 AM
20240804 08:31:02.515 TRACE:: Config.Get(): Configuration key not found. Key: lean-manager-type - Using default value: LocalLeanManager
20240804 08:31:02.533 TRACE:: JobQueue.NextJob(): Selected /LeanCLI/main.py
20240804 08:31:02.581 TRACE:: Config.GetValue(): scheduled-event-leaky-bucket-capacity - Using default value: 120
20240804 08:31:02.582 TRACE:: Config.GetValue(): scheduled-event-leaky-bucket-time-interval-minutes - Using default value: 1440
20240804 08:31:02.583 TRACE:: Config.GetValue(): scheduled-event-leaky-bucket-refill-amount - Using default value: 18
20240804 08:31:02.584 TRACE:: Config.GetValue(): storage-limit - Using default value: 10737418240
20240804 08:31:02.584 TRACE:: Config.GetValue(): storage-permissions - Using default value: 3
20240804 08:31:02.589 TRACE:: Config.Get(): Configuration key not found. Key: data-channel - Using default value:
20240804 08:31:02.589 TRACE:: Config.Get(): Configuration key not found. Key: python-venv - Using default value:
20240804 08:31:04.970 TRACE:: Config.Get(): Configuration key not found. Key: data-permission-manager - Using default value:
DataPermissionManager
20240804 08:31:04.982 TRACE:: Config.GetValue(): streamed-chart-limit - Using default value: 12
20240804 08:31:04.982 TRACE:: Config.GetValue(): streamed-chart-group-size - Using default value: 3
20240804 08:31:04.988 TRACE:: Config.GetValue(): downloader-data-update-period - Using default value: 7
20240804 08:31:05.348 TRACE:: Config.GetValue(): zip-data-cache-provider - Using default value: 10
20240804 08:31:05.350 TRACE:: Config.Get(): Configuration key not found. Key: fundamental-data-provider - Using default value:
CoarseFundamentalDataProvider
20240804 08:31:05.353 TRACE:: AlgorithmManager.CreateTokenBucket(): Initializing LeakyBucket: Capacity: 120 RefillAmount: 18 TimeInterval:
1440
20240804 08:31:05.354 TRACE:: Config.GetValue(): algorithm-manager-time-loop-maximum - Using default value: 20
20240804 08:31:05.367 TRACE:: Engine.Run(): Resource limits '0' CPUs. 2147483647 MB RAM.
20240804 08:31:05.368 TRACE:: TextSubscriptionDataSourceReader.SetCacheSize(): Setting cache size to 71582788 items
20240804 08:31:05.369 TRACE:: Config.GetValue(): algorithm-creation-timeout - Using default value: 90
20240804 08:31:05.372 TRACE:: PythonInitializer.Initialize(): start...
PythonEngine.Initialize(): clr GetManifestResourceStream...
20240804 08:31:05.578 TRACE:: PythonInitializer.Initialize(): ended
20240804 08:31:05.582 TRACE:: AlgorithmPythonWrapper(): Python version 3.11.7 (main, Dec 15 2023, 18:24:52) [GCC 11.2.0]: Importing python
module main
20240804 08:31:07.231 TRACE:: AlgorithmPythonWrapper(): main successfully imported.
20240804 08:31:07.240 TRACE:: AlgorithmPythonWrapper(): Creating IAlgorithm instance.
20240804 08:31:07.251 TRACE:: Config.Get(): Configuration key not found. Key: databases-refresh-period - Using default value: 1.00:00:00
20240804 08:31:07.354 TRACE:: Config.GetValue(): mute-python-library-logging - Using default value: True
20240804 08:31:07.356 TRACE:: LocalObjectStore.Initialize(): Storage Root: /Storage. StorageFileCount 9999999. StorageLimit 10240MB
20240804 08:31:07.356 TRACE:: LiveTradingDataFeed.GetDataChannelProvider(): will use DataChannelProvider
20240804 08:31:07.358 TRACE:: BrokerageSetupHandler.CreateBrokerage(): creating brokerage
'QuantConnect.Brokerages.InteractiveBrokers.InteractiveBrokersBrokerage'
20240804 08:31:07.362 TRACE:: Config.GetValue(): ib-response-timeout - Using default value: 300
20240804 08:31:07.362 TRACE:: Config.GetValue(): ib-no-submission-orders-response-timeout - Using default value: 10
20240804 08:31:07.363 TRACE:: Config.GetValue(): ib-combo-order-fill-timeout - Using default value: 30
20240804 08:32:47.424 ERROR:: ApiConnection.TryRequest(authenticate): Error: The operation has timed out.
20240804 08:32:47.425 ERROR:: ValidateSubscription(): Failed during validation, shutting down. Error : Invalid api user
id or token, cannot authenticate subscription.
Error: Something went wrong while running 'TestLive' in the 'lean-cli' environment, the output is stored in
'TestLive\live\2024-08-04_16-30-55'
Hi there,
I'm suddenly unable to deploy algorithms to IB since a recent update in the docker container
Quantconnect/lean:latest
. I've been able to use lean-cli to deploy toy trading algorithms to IB previously.The error comes after creating the IB brokerage:
Current checks:
lean login
andlean whoami
successfully. (so I don't understand why it readsinvalid api user id or token
).lean.json
, specifically the IB credentials as well as the organization id, are correct. (They were also unchanged since it last worked)I'm curious as to why
ValidateSubscription
fails suddenly, whenlean login
andlean whoami
works fine. I'm also unable to find the source code to debug the exact request that fails when spinning upInteractiveBrokersBrokerage.InteractiveBrokersBrokerage()
Please assist. Appreciate any help.
The returned logs when using
lean deploy