QuantConnect CLI is a CLI aimed at making local development of QuantConnect algorithms easier. It makes it easy to synchronize projects between your local drive and the QuantConnect cloud and supports running cloud backtests from the terminal.
$ npm install --global quantconnect-cli
# or
$ yarn global add quantconnect-cli
After installing using the instructions above, simply cd into an empty directory and run qcli init to set-up a QuantConnect CLI project.
A workflow with QuantConnect CLI may look like this:
cdinto the QuantConnect CLI project.- Run
qcli files:pullto pull remotely changed files. - Run
qcli files:watchto start watching for file changes which will be pushed to QuantConnect when they happen. - Open a new terminal and
cdinto the QuantConnect CLI project again (keepqcli files:watchrunning in the other terminal). - Start programming and run backtests with
qcli backtests:new --openwhenever there is something to backtest. The--openflag means that the backtest results will be opened in the browser when done. Additionally, you can specify the project id or name with--project <project id or name>if you don't want the interactive selector to open every time.
Whenever you create a new algorithm or Alpha Stream via the web interface or with the qcli projects:new command, quit the qcli files:watch command, run qcli files:pull and start qcli files:watch again.
qcli files:pull, qcli files:push and qcli files:watch all accept a --project flag to only pull/push/watch a single project. The value of this flag can be either the id of the project or its name.
qcli api:get ENDPOINTqcli api:post ENDPOINTqcli backtests:listqcli backtests:newqcli backtests:reportqcli backtests:resultsqcli backtests:updateqcli files:pullqcli files:pushqcli files:watchqcli help [COMMAND]qcli initqcli live:infoqcli live:listqcli live:logsqcli live:startqcli live:stopqcli nodes:deleteqcli nodes:listqcli nodes:stopqcli nodes:updateqcli projects:compileqcli projects:deleteqcli projects:infoqcli projects:listqcli projects:new PATH
make an authenticated GET request to the QuantConnect API
USAGE
$ qcli api:get ENDPOINT
ARGUMENTS
ENDPOINT API endpoint to send the request to
OPTIONS
-h, --help display usage information
-v, --version display version information
--verbose display API requests as they happen
EXAMPLE
$ qcli api:get authenticate
{
"success": true
}
See code: src/commands/api/get.ts
make an authenticated POST request to the QuantConnect API
USAGE
$ qcli api:post ENDPOINT
ARGUMENTS
ENDPOINT API endpoint to send the request to
OPTIONS
-b, --body=body JSON string containing the data to use as body of the request
-h, --help display usage information
-v, --version display version information
--verbose display API requests as they happen
EXAMPLE
$ qcli api:post files/create --body '{ "projectId": 1234567, "name": "Empty.cs", "content": "// Empty file" }'
{
"files": [
{
"id": 1234567,
"uid": 12345,
"pid": 1234567,
"fpid": 0,
"sname": "Empty.cs",
"scontent": "// Empty file",
"dtcreated": "2020-01-01 00:00:00",
"dtmodified": "2020-01-01 00:00:00",
"estatus": "Active",
"etype": "File",
"bopen": 0
}
],
"success": true
}
See code: src/commands/api/post.ts
list all backtests for a project
USAGE
$ qcli backtests:list
OPTIONS
-h, --help display usage information
-p, --project=project project id or name (optional, interactive selector opens if not specified)
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/backtests/list.ts
launch a backtest for a project
USAGE
$ qcli backtests:new
OPTIONS
-h, --help display usage information
-n, --name=name name of the backtest (optional, a random one is generated if not specified)
-o, --open open the backtest results in the browser when done
-p, --project=project project id or name (optional, interactive selector opens if not specified)
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/backtests/new.ts
download the report of a given backtest
USAGE
$ qcli backtests:report
OPTIONS
-b, --backtest=backtest backtest id or name (optional, interactive selector opens if not specified)
-h, --help display usage information
-p, --project=project project id or name (optional, interactive selector opens if not specified)
-v, --version display version information
--open open the report in the browser when done
--overwrite overwrite the file if it already exists
--path=path path to save report to (optional, backtest name is used if not specified)
--verbose display API requests as they happen
See code: src/commands/backtests/report.ts
show the results of a given backtest
USAGE
$ qcli backtests:results
OPTIONS
-b, --backtest=backtest backtest id or name (optional, interactive selector opens if not specified)
-h, --help display usage information
-o, --open open the backtest results in the browser
-p, --project=project project id or name (optional, interactive selector opens if not specified)
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/backtests/results.ts
change the name and/or the note of a given backtest
USAGE
$ qcli backtests:update
OPTIONS
-b, --backtest=backtest backtest id or name (optional, interactive selector opens if not specified)
-h, --help display usage information
-p, --project=project project id or name (optional, interactive selector opens if not specified)
-v, --version display version information
--name=name the new name to assign to the given backtest (default: current name)
--note=note the new note to assign to the given backtest (default: current note)
--verbose display API requests as they happen
See code: src/commands/backtests/update.ts
pull files from QuantConnect to the current directory
USAGE
$ qcli files:pull
OPTIONS
-h, --help display usage information
-p, --project=project project id or name of the project to pull (all projects if not specified)
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/files/pull.ts
push local files to QuantConnect
USAGE
$ qcli files:push
OPTIONS
-h, --help display usage information
-p, --project=project project id or name of the project to push (all projects if not specified)
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/files/push.ts
watch for local file changes and push them to QuantConnect
USAGE
$ qcli files:watch
OPTIONS
-h, --help display usage information
-p, --project=project project id or name of the project to watch (all projects if not specified)
-v, --version display version information
--poll use polling to watch for file changes
--verbose display API requests as they happen
See code: src/commands/files/watch.ts
display help for qcli
USAGE
$ qcli help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
See code: @oclif/plugin-help
create a new QuantConnect CLI project
USAGE
$ qcli init
OPTIONS
-h, --help display usage information
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/init.ts
display useful information about a live deployment
USAGE
$ qcli live:info
OPTIONS
-d, --deployment=deployment deployment id (optional, interactive selector opens if not specified)
-h, --help display usage information
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/live/info.ts
list all live projects
USAGE
$ qcli live:list
OPTIONS
-h, --help display usage information
-s, --status=running|runtime-error|stopped|liquidated only show live projects with a given status
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/live/list.ts
display the logs of a live deployment
USAGE
$ qcli live:logs
OPTIONS
-d, --deployment=deployment deployment id (optional, interactive selector opens if not specified)
-e, --end=end show logs before a given timestamp
-h, --help display usage information
-s, --start=start show logs after a given timestamp
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/live/logs.ts
start live trading for a project
USAGE
$ qcli live:start
OPTIONS
-h, --help display usage information
-n, --node=node node id or name (optional, interactive selector opens if not specified)
-p, --project=project project id or name (optional, interactive selector opens if not specified)
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/live/start.ts
stop live trading for a project
USAGE
$ qcli live:stop
OPTIONS
-h, --help display usage information
-p, --project=project project id or name (optional, interactive selector opens if not specified)
-v, --version display version information
--liquidate liquidate existing holdings (optional, defaults to false)
--verbose display API requests as they happen
See code: src/commands/live/stop.ts
delete a node
USAGE
$ qcli nodes:delete
OPTIONS
-h, --help display usage information
-n, --node=node node id or name (optional, interactive selector opens if not specified)
-o, --organization=organization organization id (optional, interactive selector opens if not specified)
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/nodes/delete.ts
list all nodes in an organization
USAGE
$ qcli nodes:list
OPTIONS
-h, --help display usage information
-o, --organization=organization organization id (optional, interactive selector opens if not specified)
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/nodes/list.ts
stop a node
USAGE
$ qcli nodes:stop
OPTIONS
-h, --help display usage information
-n, --node=node node id or name (optional, interactive selector opens if not specified)
-o, --organization=organization organization id (optional, interactive selector opens if not specified)
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/nodes/stop.ts
update the name of a node
USAGE
$ qcli nodes:update
OPTIONS
-h, --help display usage information
-n, --node=node node id or name (optional, interactive selector opens if not specified)
-o, --organization=organization organization id (optional, interactive selector opens if not specified)
-v, --version display version information
--name=name (required) new name for the node
--verbose display API requests as they happen
See code: src/commands/nodes/update.ts
compile a project
USAGE
$ qcli projects:compile
OPTIONS
-h, --help display usage information
-p, --project=project project id or name (optional, interactive selector opens if not specified)
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/projects/compile.ts
delete a project
USAGE
$ qcli projects:delete
OPTIONS
-h, --help display usage information
-p, --project=project project id or name (optional, interactive selector opens if not specified)
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/projects/delete.ts
display useful information about a project
USAGE
$ qcli projects:info
OPTIONS
-h, --help display usage information
-p, --project=project project id or name (optional, interactive selector opens if not specified)
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/projects/info.ts
list all projects
USAGE
$ qcli projects:list
OPTIONS
-h, --help display usage information
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/projects/list.ts
create a new project
USAGE
$ qcli projects:new PATH
ARGUMENTS
PATH path of the project to create
OPTIONS
-h, --help display usage information
-l, --language=python|csharp [default: python] language of the project to create
-v, --version display version information
--verbose display API requests as they happen
See code: src/commands/projects/new.ts
All contributions are welcome. Please read the Contributing Guide first as it contains information regarding the tools used by the project and instructions on how to set up a development environment.
