Metadata-Version: 2.4
Name: pyqqq-cli
Version: 0.4.25
Summary: CLI tool for controlling strategies deployed on the PyQQQ platform.
License: MIT
Author: PyQQQ team
Author-email: pyqqq.cs@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: click (>=8.1.7,<9.0.0)
Requires-Dist: croniter (>=3.0,<4.0)
Requires-Dist: freezegun (>=1.5.1,<2.0.0)
Requires-Dist: openai (>=1.35.10,<2.0.0)
Requires-Dist: pylint (>=3.2.5,<4.0.0)
Requires-Dist: pyqqq (>=0.12,<0.13)
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
Requires-Dist: requests (>=2.31.0,<3.0.0)
Requires-Dist: websockets (>=12.0,<13.0)
Project-URL: Documentation, https://qupiato-sdk-18secs-cf54ebea1b14b422537daf0462fb86d68f4582d064a4.gitlab.io
Description-Content-Type: text/markdown

## pyqqq-cli

### Installation

You can install `pyqqq-cli` via pip:

```bash
pip install pyqqq-cli
```

### Usage

After installation, the `qqq` command will be available:

```bash
qqq [OPTIONS] COMMAND [ARGS]...
```

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

### Commands

#### `deploy`

Deploy a strategy to the cloud.

Packages and uploads the current directory, then launches the strategy as a long-running deployment. The deployment name defaults to the entryfile basename without extension. Names are normalized to lowercase alphanumeric characters and hyphens.

```bash
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.

Without `--published`, shows all active deployments of the current user, including deployment ID, status, type, schedule (for cronjobs), and creation time. With `--published`, shows strategies published to the public registry.

```bash
qqq list
qqq list --published
```

| Option | Description |
|--------|-------------|
| `--published` | Show strategies published to the public registry |

---

#### `logs`

Show logs of a deployed strategy.

Fetches stdout/stderr output from the running deployment. Works for regular deployments, backtests, and cronjobs.

```bash
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.

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

```bash
qqq pause DEPLOYMENT_ID
```

---

#### `resume`

Resume a paused strategy.

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

```bash
qqq resume DEPLOYMENT_ID
```

---

#### `delete`

Delete a deployed strategy.

Permanently removes the deployment and stops its execution. This action is irreversible. With `--published`, removes the strategy from the public registry instead.

```bash
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.

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

```bash
qqq update DEPLOYMENT_ID
```

---

#### `env`

Show environment variables of deployed strategies.

Without a deployment ID, shows environment variables for all deployments. With an ID, shows variables for that deployment only.

```bash
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.

Packages and uploads the strategy, then schedules it to run automatically on the specified cron schedule. Minimum allowed interval is 5 minutes.

```bash
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.

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.

```bash
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.

Executes the strategy 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. The execution mode is determined by `app.yaml` if present.

```bash
qqq run my_strategy.py
```

---

#### `lint`

Lint a Python strategy file for errors.

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.

```bash
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.

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

```bash
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.

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

```bash
qqq pull user@example.com/my-strategy
```

---

#### `publish`

Publish a strategy to the public registry.

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.

```bash
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.

```bash
qqq version
```

### License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

