Files
quantconnect--lean/Launcher/config.json
Adalyat Nazirov a4f66628fd Lean Optimization interface in QCAlgorithm (#4923)
* initial commit

* run parametrized algorithm with command line parameters

* skeleton: top level structure

* OptimizationNodePacket scheme

* pass parameters as HashSet

* run Lean and read results

* call method on optimization completion

* refactor public interfaces

- close ParameterSet collection; allow only get operations
- explicit method to start LeanOptimizer

* synchronize RunLean method; the result could come in before the backtest id is set in the collections

* another portion of refactoring and interface changes

* comments

* comments & tests for Extremum, Minimization and Maximization classes

* unify optimization paramater values (min, max, step) & mode GridSearch tests

- swap min&max if necessary
- iterate left => right (negate step value if necessary) & provide default step value if step == 0
- no StackOverflow Exception
- parameterSet Id should be global for current generator and retain between steps
- test signle point boundary (min == max)

* BruteForceStrategy tests

* more comments

* Update Optimizer assembly information

- Update Optimizer projects assembly information to match behavior of
  the other projects

* Tweaks

- Adding comments
- Replace OnComplete for Ended event
- Replace Abort for Dispose
- ConsoleLeanOptimizer will keep track of running processes
- Each backtest will store results in a separated directory, so they
  don't fight for the log.txt file.
- Adding cmdline option for lean to close automatically
- Adding concurrent execution backtest limit
- Console optimizer will start Lean minimized
- Escape spaces in Json path

* remove parameter set generator abstraction layer

we don't need this flexibility now.

* refactor public methods; Step shouldn't be public

* constraints: wip

* define contract

* comparison operators and tests

* specify JsonProperty values

* Move SafeMultiply100 to extensions

* Throw exception on failed Optimizer.Start

* constraints: wip

* change finish & dispose process

* minor fixes

- handle force lean abort
- notify consumer if target has been reached

* target & constraints; adapt unit tests

* Minor Tweaks and fixes

- Some logging improvements
- Remove Public since not required

* Ignore empty ParameterValue

* simplify condition

* avoid reinitialization

* reduce type; force immutable

* unit tests for constraints  and target value

* parse & normalize percent values, i.e. 20% => 0.2

* fixup

* Target & Constraint & OptimizationNodePacket unit tests

* Add more json unit tests

- Adding more json conversion unit tests. Fix bug for Extremum which
  wasn't using the converter.

* LeanOptimizer tests

* Estimation results

* User thread safe counters

* LeanOptimizer unit tests; push OptimizationResult on Ended event

* more unit tests

* Minor tweaks

-Estimate ToString in a single line.
-Typos and missing header file

* Add base SendUpdate method

- Add base SendUpdate method for LeanOptimizer

* fix LeanOptimizer test; rely on internal Update rather than timer

* Add OptimizationStatus

- Add missing commments and OptimizationStatus

* EulerSearch implementation: wip

* OptimizationParameter custom converter

* change the type

* make step optional

* change folder structure

* enumerate optimization parameter using IEnumerable & IEnumerator

* unit tests: parameters & objectives

* unit tests: strategies

* remove redundant TODO

* change Euler search boundaries

* more Euler tests

* prevent race condition

* Add account/read endpoint

- Adding account/read endpoint. Adding unit test

* Add status check before running lean

* Minor self review

- Adding missing comments, minor changes

* remove array parameters

* minor changes

- tidy up config file, rename variable
- accept min less or equal than max

* move OptimizationParameter methods to strategies

* Minor improvements for BaseResultHandler derivates

* minor changes

- strict requirements for Step and MinStep values
- strategy specific settigs

* Add TotalRuntime to estimate

Co-authored-by: Martin Molinero <martin.molinero1@gmail.com>
2020-12-02 20:10:40 -03:00

324 lines
13 KiB
JSON

{
// 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, Python
"algorithm-language": "CSharp",
//Physical DLL location
"algorithm-location": "QuantConnect.Algorithm.CSharp.dll",
//"algorithm-location": "../../../Algorithm.Python/BasicTemplateFrameworkAlgorithm.py"
//Research notebook
//"composer-dll-directory": ".",
// engine
"data-folder": "../../../Data/",
// debugging configuration - options for debugging-method LocalCmdLine, VisualStudio, PTVSD, PyCharm
"debugging": false,
"debugging-method": "LocalCmdline",
// 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": "",
// binance configuration
"binance-api-secret": "",
"binance-api-key": "",
// Required to access data from Quiver Quantitative
// To get your access token go to https://api.quiverquant.com
"quiver-auth-token": "",
// 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"
},
"live-binance": {
"live-mode": true,
// real brokerage implementations require the BrokerageTransactionHandler
"live-mode-brokerage": "BinanceBrokerage",
"data-queue-handler": "BinanceBrokerage",
"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": "PolygonDataQueueHandler",
"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"
}
}
}