When running algorithms in Lean Docker from inside VS or VS Code I can successfully build or debug the BasicTemplateFrameworkAlgorithm - results via terminal or file. However, I do not know how to run any other algorithm. All methods I've hacked around with only run BasicTemplateFrameworkAlgorithm..
What is the process for running any algorithm and outputitng results?
Plus trying to run another algorithm elsewhere mostly resulted in a long list of missing modules that run fine in Web IDE - is how latest is LEAN:latest?
Thanks.
Aaron Janeiro Stone
At Launcher/config.json, have you changed the defaults to
"algorithm-type-name": "**AlgorithmName**",
"algorithm-language": "Python",
"algorithm-location": "../../../Algorithm.Python/**AlgorithmName**.py",
"debugging": true,
"debugging-method": "PTVSD",
(where **AlgorithmName** refers to the non-default file you wish to debug)? If you have, and are launching the Docker env by first running "Debug in Container" →"Attach to Python (Container)", please attach the error message recieved from VS code if it is unable to connect or from the debugger/terminal if it does connect and then fails.
AM H
Hi. I get this pop up error.
https://www.dropbox.com/s/xkkt6wovf0f3y5u/Screenshot%202020-09-22%20221237.png?dl=0And the launch.json currently as:
{ "name": "Attach to Python (Container)", "type": "python", "request": "attach", "port": 5678, "pathMappings":[{ "localRoot": "${workspaceFolder}", "remoteRoot": "/Lean/" }] },
Aaron Janeiro Stone
It seems that the debugger is refused the ability to attach. While your launch.json seems ok, this error I've seen pop up if the changes I mentioned in my prior post are not made to your local version of
https://github.com/QuantConnect/Lean/blob/master/Launcher/config.json. Specifically, it should be of form (to launch BasicTemplateFrameworkAlgorithm.py as opposed to .cs):
{ // this configuration file works by first loading all top-level // configuration items and then will load the specified environment // on top, this provides a layering affect. environment names can be // anything, and just require definition in this file. There's // two predefined environments, 'backtesting' and 'live', feel free // to add more! "environment": "backtesting", // "live-paper", "backtesting", "live-interactive", "live-interactive-iqfeed" // algorithm class selector "algorithm-type-name": "BasicTemplateFrameworkAlgorithm", // Algorithm language selector - options CSharp, FSharp, VisualBasic, Python, Java "algorithm-language": "Python", //Physical DLL location //"algorithm-location": "QuantConnect.Algorithm.CSharp.dll", "algorithm-location": "../../../Algorithm.Python/BasicTemplateFrameworkAlgorithm.py", //"algorithm-location": "QuantConnect.Algorithm.FSharp.dll", //"algorithm-location": "QuantConnect.Algorithm.VisualBasic.dll", //"algorithm-location": "QuantConnect.Algorithm.Java.dll", //Research notebook //"composer-dll-directory": ".", // engine "data-folder": "../../../Data/", // debugging configuration - options for debugging-method LocalCmdLine, VisualStudio, PTVSD, PyCharm "debugging": true, "debugging-method": "PTVSD", // handlers "log-handler": "QuantConnect.Logging.CompositeLogHandler", "messaging-handler": "QuantConnect.Messaging.Messaging", "job-queue-handler": "QuantConnect.Queues.JobQueue", "api-handler": "QuantConnect.Api.Api", "map-file-provider": "QuantConnect.Data.Auxiliary.LocalDiskMapFileProvider", "factor-file-provider": "QuantConnect.Data.Auxiliary.LocalDiskFactorFileProvider", "data-provider": "QuantConnect.Lean.Engine.DataFeeds.DefaultDataProvider", "alpha-handler": "QuantConnect.Lean.Engine.Alphas.DefaultAlphaHandler", "data-channel-provider": "DataChannelProvider", "object-store": "QuantConnect.Lean.Engine.Storage.LocalObjectStore", "data-aggregator": "QuantConnect.Lean.Engine.DataFeeds.AggregationManager", // limits on number of symbols to allow "symbol-minute-limit": 10000, "symbol-second-limit": 10000, "symbol-tick-limit": 10000, // limits the amount of data points per chart series. Applies only for backtesting "maximum-data-points-per-chart-series": 4000, // if one uses true in following token, market hours will remain open all hours and all days. // if one uses false will make lean operate only during regular market hours. "force-exchange-always-open": false, // save list of transactions to the specified csv file "transaction-log": "", // To get your api access token go to quantconnect.com/account "job-user-id": "0", "api-access-token": "", // live data configuration "live-data-url": "ws://www.quantconnect.com/api/v2/live/data/", "live-data-port": 8020, // interactive brokers configuration "ib-account": "", "ib-user-name": "", "ib-password": "", "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": false, "ib-version": "974", // tradier configuration "tradier-account-id": "", "tradier-access-token": "", "tradier-refresh-token": "", "tradier-issued-at": "", "tradier-lifespan": "", "tradier-refresh-session": true, // oanda configuration "oanda-environment": "Practice", "oanda-access-token": "", "oanda-account-id": "", // fxcm configuration "fxcm-server": "http://www.fxcorporate.com/Hosts.jsp", "fxcm-terminal": "Demo", //Real or Demo "fxcm-user-name": "", "fxcm-password": "", "fxcm-account-id": "", // iqfeed configuration "iqfeed-host": "127.0.0.1", "iqfeed-username": "", "iqfeed-password": "", "iqfeed-productName": "", "iqfeed-version": "1.0", // gdax configuration "gdax-api-secret": "", "gdax-api-key": "", "gdax-passphrase": "", // bitfinex configuration "bitfinex-api-secret": "", "bitfinex-api-key": "", // Required to access data from Quandl // To get your access token go to https://www.quandl.com/account/api "quandl-auth-token": "", // Required to access data from Tiingo // To get your access token go to https://www.tiingo.com "tiingo-auth-token": "", // Required to access data from US Energy Information Administration // To get your access token go to https://www.eia.gov/opendata "us-energy-information-auth-token": "", // Required for IEX history requests "iex-cloud-api-key": "", // alpaca configuration // available trading mode: 'paper', 'live' "alpaca-key-id": "", "alpaca-secret-key": "", "alpaca-trading-mode": "paper", // Required for streaming Polygon.io data // To get your access token go to https://polygon.io "polygon-api-key": "", // parameters to set in the algorithm (the below are just samples) "parameters": { // Intrinio account user and password "intrinio-username": "", "intrinio-password": "", "ema-fast": 10, "ema-slow": 20 }, "environments": { // defines the 'backtesting' environment "backtesting": { "live-mode": false, "setup-handler": "QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler", "result-handler": "QuantConnect.Lean.Engine.Results.BacktestingResultHandler", "data-feed-handler": "QuantConnect.Lean.Engine.DataFeeds.FileSystemDataFeed", "real-time-handler": "QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler", "history-provider": "QuantConnect.Lean.Engine.HistoricalData.SubscriptionDataReaderHistoryProvider", "transaction-handler": "QuantConnect.Lean.Engine.TransactionHandlers.BacktestingTransactionHandler" }, // defines the 'live-paper' environment "live-paper": { "live-mode": true, // the paper brokerage requires the BacktestingTransactionHandler "live-mode-brokerage": "PaperBrokerage", "setup-handler": "QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler", "result-handler": "QuantConnect.Lean.Engine.Results.LiveTradingResultHandler", "data-feed-handler": "QuantConnect.Lean.Engine.DataFeeds.LiveTradingDataFeed", "data-queue-handler": "QuantConnect.Lean.Engine.DataFeeds.Queues.LiveDataQueue", "real-time-handler": "QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler", "transaction-handler": "QuantConnect.Lean.Engine.TransactionHandlers.BacktestingTransactionHandler" }, // defines the 'live-tradier' environment "live-tradier": { "live-mode": true, // this setting will save tradier access/refresh tokens to a tradier-tokens.txt file // that can be read in next time, this makes it easier to start/stop a tradier algorithm "tradier-save-tokens": true, // real brokerage implementations require the BrokerageTransactionHandler "live-mode-brokerage": "TradierBrokerage", "data-queue-handler": "TradierBrokerage", "setup-handler": "QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler", "result-handler": "QuantConnect.Lean.Engine.Results.LiveTradingResultHandler", "data-feed-handler": "QuantConnect.Lean.Engine.DataFeeds.LiveTradingDataFeed", "real-time-handler": "QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler", "transaction-handler": "QuantConnect.Lean.Engine.TransactionHandlers.BrokerageTransactionHandler" }, // defines the 'live-interactive' environment "live-interactive": { "live-mode": true, // real brokerage implementations require the BrokerageTransactionHandler "live-mode-brokerage": "InteractiveBrokersBrokerage", "setup-handler": "QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler", "result-handler": "QuantConnect.Lean.Engine.Results.LiveTradingResultHandler", "data-feed-handler": "QuantConnect.Lean.Engine.DataFeeds.LiveTradingDataFeed", "data-queue-handler": "QuantConnect.Brokerages.InteractiveBrokers.InteractiveBrokersBrokerage", "real-time-handler": "QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler", "transaction-handler": "QuantConnect.Lean.Engine.TransactionHandlers.BrokerageTransactionHandler", "history-provider": "BrokerageHistoryProvider" }, // defines the 'live-interactive-iqfeed' environment "live-interactive-iqfeed": { "live-mode": true, // real brokerage implementations require the BrokerageTransactionHandler "live-mode-brokerage": "InteractiveBrokersBrokerage", "setup-handler": "QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler", "result-handler": "QuantConnect.Lean.Engine.Results.LiveTradingResultHandler", "data-feed-handler": "QuantConnect.Lean.Engine.DataFeeds.LiveTradingDataFeed", "data-queue-handler": "QuantConnect.ToolBox.IQFeed.IQFeedDataQueueHandler", "real-time-handler": "QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler", "transaction-handler": "QuantConnect.Lean.Engine.TransactionHandlers.BrokerageTransactionHandler", "history-provider": "QuantConnect.ToolBox.IQFeed.IQFeedDataQueueHandler" }, // defines the 'live-fxcm' environment "live-fxcm": { "live-mode": true, // real brokerage implementations require the BrokerageTransactionHandler "live-mode-brokerage": "FxcmBrokerage", "data-queue-handler": "FxcmBrokerage", "setup-handler": "QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler", "result-handler": "QuantConnect.Lean.Engine.Results.LiveTradingResultHandler", "data-feed-handler": "QuantConnect.Lean.Engine.DataFeeds.LiveTradingDataFeed", "real-time-handler": "QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler", "transaction-handler": "QuantConnect.Lean.Engine.TransactionHandlers.BrokerageTransactionHandler", "history-provider": "BrokerageHistoryProvider" }, // defines the 'live-oanda' environment "live-oanda": { "live-mode": true, // real brokerage implementations require the BrokerageTransactionHandler "live-mode-brokerage": "OandaBrokerage", "data-queue-handler": "OandaBrokerage", "setup-handler": "QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler", "result-handler": "QuantConnect.Lean.Engine.Results.LiveTradingResultHandler", "data-feed-handler": "QuantConnect.Lean.Engine.DataFeeds.LiveTradingDataFeed", "real-time-handler": "QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler", "transaction-handler": "QuantConnect.Lean.Engine.TransactionHandlers.BrokerageTransactionHandler", "history-provider": "BrokerageHistoryProvider" }, "live-gdax": { "live-mode": true, // real brokerage implementations require the BrokerageTransactionHandler "live-mode-brokerage": "GDAXBrokerage", "data-queue-handler": "GDAXDataQueueHandler", "setup-handler": "QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler", "result-handler": "QuantConnect.Lean.Engine.Results.LiveTradingResultHandler", "data-feed-handler": "QuantConnect.Lean.Engine.DataFeeds.LiveTradingDataFeed", "real-time-handler": "QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler", "transaction-handler": "QuantConnect.Lean.Engine.TransactionHandlers.BrokerageTransactionHandler", "history-provider": "BrokerageHistoryProvider" }, "live-bitfinex": { "live-mode": true, // real brokerage implementations require the BrokerageTransactionHandler "live-mode-brokerage": "BitfinexBrokerage", "data-queue-handler": "BitfinexBrokerage", "setup-handler": "QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler", "result-handler": "QuantConnect.Lean.Engine.Results.LiveTradingResultHandler", "data-feed-handler": "QuantConnect.Lean.Engine.DataFeeds.LiveTradingDataFeed", "real-time-handler": "QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler", "transaction-handler": "QuantConnect.Lean.Engine.TransactionHandlers.BrokerageTransactionHandler", "history-provider": "BrokerageHistoryProvider" }, // defines the 'live-alpaca' environment "live-alpaca": { "live-mode": true, // real brokerage implementations require the BrokerageTransactionHandler "live-mode-brokerage": "AlpacaBrokerage", "data-queue-handler": "AlpacaBrokerage", "setup-handler": "QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler", "result-handler": "QuantConnect.Lean.Engine.Results.LiveTradingResultHandler", "data-feed-handler": "QuantConnect.Lean.Engine.DataFeeds.LiveTradingDataFeed", "real-time-handler": "QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler", "transaction-handler": "QuantConnect.Lean.Engine.TransactionHandlers.BrokerageTransactionHandler", "history-provider": "BrokerageHistoryProvider" } } }
AM H
Yesw, this is what my config.json looks like.
Aaron Janeiro Stone
Interesting. Just to be sure, I would try copy+pasting the code I sent to replace the file contents and try runnign again (as this is the usual cause of your error message). Otherwise, could you provide your OS?
AM H
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!