quantconnect-cli v1.4.5
Deprecation warning
This package is deprecated, please use the new CLI hosted in the QuantConnect/lean-cli repository.
QuantConnect CLI
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.
Install
$ 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.
Usage
A workflow with QuantConnect CLI may look like this:
1. cd
into the QuantConnect CLI project.
2. Run qcli files:pull
to pull remotely changed files.
3. Run qcli files:watch
to start watching for file changes which will be pushed to QuantConnect when they happen.
4. Open a new terminal and cd
into the QuantConnect CLI project again (keep qcli files:watch
running in the other terminal).
5. Start programming and run backtests with qcli backtests:new --open
whenever there is something to backtest. The --open
flag 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.
Commands
qcli api:get ENDPOINT
qcli api:post ENDPOINT
qcli backtests:list
qcli backtests:new
qcli backtests:report
qcli backtests:results
qcli backtests:update
qcli files:pull
qcli files:push
qcli files:watch
qcli help [COMMAND]
qcli init
qcli live:info
qcli live:list
qcli live:logs
qcli live:start
qcli live:stop
qcli nodes:delete
qcli nodes:list
qcli nodes:stop
qcli nodes:update
qcli projects:compile
qcli projects:delete
qcli projects:info
qcli projects:list
qcli projects:new PATH
qcli api:get ENDPOINT
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
qcli api:post ENDPOINT
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
qcli backtests:list
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
qcli backtests:new
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
qcli backtests:report
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
qcli backtests:results
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
qcli backtests:update
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
qcli files:pull
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
qcli files:push
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
qcli files:watch
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
qcli help [COMMAND]
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
qcli init
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
qcli live:info
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
qcli live:list
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
qcli live:logs
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
qcli live:start
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
qcli live:stop
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
qcli nodes:delete
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
qcli nodes:list
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
qcli nodes:stop
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
qcli nodes:update
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
qcli projects:compile
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
qcli projects:delete
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
qcli projects:info
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
qcli projects:list
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
qcli projects:new PATH
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
Contributing
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.