Skip to main content

CLI tool for controlling strategies deployed on the PyQQQ platform.

Project description

pyqqq-cli

Installation

You can install pyqqq-cli via pip:

pip install pyqqq-cli

Usage

After installation, the qqq command will be available:

qqq [OPTIONS] COMMAND [ARGS]...

Use qqq --help or qqq COMMAND --help for detailed usage of each command.

Resource kinds

The CLI works with three kinds of cloud resources plus the public registry. Each command operates on a specific kind:

Kind Created by Entry point Description
strategy deploy run() A long-running deployment that stays up continuously
backtest backtest run_batch() A one-time batch job
cronjob cronjob run() A strategy scheduled to run on a cron schedule
published strategy publish A strategy shared in the public registry

Strategy and cronjob files must define a run() function as their entry point. Backtest files must define a run_batch() function instead. (The legacy hook executor is no longer supported.)

Resource support per command:

Command strategy backtest cronjob Notes
deploy Creates a long-running deployment
backtest Creates a one-time job
cronjob Creates a scheduled job
list Lists all kinds; TYPE column distinguishes them
logs Kind detected from the deployment ID
env Shows env for all kinds
delete Kind detected from the deployment ID
pause Strategy deployments only
resume Strategy deployments only
update Strategy deployments only
search / pull / publish published only Public registry; only strategies are published
run / lint local local local Local file operations, nothing deployed

Commands

deploy

Deploy a strategy to the cloud. Resource: strategy (long-running deployment).

Packages and uploads the current directory, then launches the strategy as a long-running deployment. The strategy file must define a run() function as its entry point. The deployment name defaults to the entryfile basename without extension. Names are normalized to lowercase alphanumeric characters and hyphens.

qqq deploy my_strategy.py
qqq deploy my_strategy.py --name my-strategy
qqq deploy my_strategy.py --publish
Option Description
--name, -n Override the deployment name
--publish, -p Also register the strategy in the public repository

list

List deployments. Resources: strategy · backtest · cronjob.

Without --published, shows all active resources of the current user — strategies, backtests, and cronjobs together — including deployment ID, status, type, schedule (for cronjobs), and creation time. The TYPE column distinguishes the kinds. With --published, shows strategies published to the public registry.

qqq list
qqq list --published
Option Description
--published Show strategies published to the public registry

logs

Show logs of a deployed resource. Resources: strategy · backtest · cronjob.

Fetches stdout/stderr output from the running resource; the kind is detected from the deployment ID. Works for strategy deployments, backtests, and cronjobs.

qqq logs DEPLOYMENT_ID
qqq logs DEPLOYMENT_ID --follow
qqq logs DEPLOYMENT_ID --lines 100
Option Description
--follow, -f Stream logs in real time
--lines, -n Number of recent lines to return

pause

Pause a deployed strategy. Resource: strategy only (not backtests or cronjobs).

Suspends execution without deleting the deployment. Configuration and environment variables are preserved. Use resume to restart later.

qqq pause DEPLOYMENT_ID

resume

Resume a paused strategy. Resource: strategy only (not backtests or cronjobs).

Restarts a strategy previously suspended with pause. The deployment picks up with the same configuration and environment variables.

qqq resume DEPLOYMENT_ID

delete

Delete a deployed resource. Resources: strategy · backtest · cronjob.

Permanently removes the resource and stops its execution; the kind is detected from the deployment ID. This action is irreversible. With --published, removes the strategy from the public registry instead.

qqq delete DEPLOYMENT_ID
qqq delete PUBLISH_ID --published
Option Description
--published Remove from the public registry instead of deleting a deployment

update

Update the runtime environment of a deployed strategy. Resource: strategy only (not backtests or cronjobs).

Applies the latest environment configuration to a running deployment. The strategy is restarted to pick up the changes.

qqq update DEPLOYMENT_ID

env

Show environment variables of deployed resources. Resources: strategy · backtest · cronjob.

Without a deployment ID, shows environment variables for all resources of any kind. With an ID, shows variables for that resource only.

qqq env
qqq env DEPLOYMENT_ID
qqq env DEPLOYMENT_ID --pretty
Option Description
--pretty, -p Format environment data as indented JSON

cronjob

Deploy a strategy as a scheduled cronjob. Resource: cronjob.

Packages and uploads the strategy, then schedules it to run automatically on the specified cron schedule. The strategy file must define a run() function as its entry point, invoked on each scheduled run. Minimum allowed interval is 5 minutes.

qqq cronjob my_strategy.py --schedule "0 9 * * 1-5"
qqq cronjob my_strategy.py --name my-job --schedule "*/30 * * * *"
Option Description
--name, -n Override the cronjob name
--schedule, -s Cron schedule expression (required)

backtest

Deploy a strategy as a backtest job. Resource: backtest (one-time batch job).

Runs the strategy as a one-time batch job in the cloud. The strategy file must define a run_batch() function. Backtest names must be 24 characters or fewer.

qqq backtest my_strategy.py
qqq backtest my_strategy.py --name my-backtest
qqq backtest my_strategy.py --skip
qqq backtest my_strategy.py --env-file .env.backtest
Option Description
--name, -n Set the backtest name (skips prompt)
--skip, -s Skip the name prompt and use the filename
--env-file, -e Path to an environment file for the backtest

run

Run a strategy locally. Resource: local (nothing deployed).

Executes the strategy's run() entry point in the current Python environment without deploying it to the cloud. Useful for local testing and development. If requirements.txt exists, dependencies are installed automatically.

qqq run my_strategy.py

lint

Lint a Python strategy file for errors. Resource: local file.

Runs pylint in errors-only mode to catch syntax and import errors. If OPENAI_KEY is set in the environment, also performs an AI-assisted lint pass for deeper analysis. Unless --skip-test is provided, the file is also validated by running the hook test suite.

qqq lint my_strategy.py
qqq lint my_strategy.py --skip-test
Option Description
--skip-test Skip the hook test suite

search

Search for publicly published stock investment strategies. Resource: published strategy.

Searches the public registry by keyword. Results include the strategy name, author, and star count.

qqq search momentum
qqq search --email user@example.com
qqq search rsi --email user@example.com
Option Description
--email, -e Filter results to strategies by a specific author

pull

Download a strategy from the public registry. Resource: published strategy.

Fetches a published strategy and saves it to the current directory. NAME must be in the format email/strategy_name.

qqq pull user@example.com/my-strategy

publish

Publish a strategy to the public registry. Resource: published strategy (strategies only).

Packages and uploads the strategy so other users can discover and download it via search and pull. Names are normalized to lowercase alphanumeric characters and hyphens.

qqq publish my_strategy.py
qqq publish my_strategy.py --name my-strategy
Option Description
--name, -n Override the published strategy name

version

Show the installed version number and quit.

qqq version

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyqqq_cli-0.4.26.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyqqq_cli-0.4.26-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file pyqqq_cli-0.4.26.tar.gz.

File metadata

  • Download URL: pyqqq_cli-0.4.26.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.7 Linux/5.10.0-32-cloud-amd64

File hashes

Hashes for pyqqq_cli-0.4.26.tar.gz
Algorithm Hash digest
SHA256 48fce00709310b1fb9507bb913bd6d75b60b3b11745115e5d5a6a131f28bb23a
MD5 1329e5c0a56ad038a4ecf696bf36cf00
BLAKE2b-256 2e877d4fe3841ff7343983ac424f67884893ab2b64e0d893a8d7732e733a975c

See more details on using hashes here.

File details

Details for the file pyqqq_cli-0.4.26-py3-none-any.whl.

File metadata

  • Download URL: pyqqq_cli-0.4.26-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.7 Linux/5.10.0-32-cloud-amd64

File hashes

Hashes for pyqqq_cli-0.4.26-py3-none-any.whl
Algorithm Hash digest
SHA256 cfed29b302e5b2f271e3e664989957fc594e224608e4234378de307868b5a34b
MD5 92f453a414c965dbbd205a2ba6cc0f93
BLAKE2b-256 dfd41c8a354738f736d16beafc7c0b304d2ef86af0591436f49b00046969e01d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page