Skip to main content
The QFEX CLI provides JSON-only command-line access to QFEX for both human operators and AI agents. A background daemon manages the underlying WebSocket connections to QFEX, while CLI commands remain stateless from the caller’s perspective. For a higher-level guide to using the CLI with AI agents, see Agentic Trading.

Installation

Quick Start

Why Use The CLI

  • All command output is JSON, which makes it easy to pipe into jq or parse in code.
  • The daemon keeps persistent connections to market data and trade WebSockets, so scripts do not need to manage subscriptions, authentication, or socket lifecycle directly.
  • Market data commands work without credentials.
  • Trading commands use the same API keys described in the API introduction.

Common Commands

Environments

The CLI supports both QFEX production and UAT environments:
  • prod: Connects to qfex.com with real funds.
  • uat: Connects to qfex.io for testing strategies and integrations without real funds.
You can select the environment during qfex login or by editing ~/.config/qfex/config.yaml, then restarting the daemon.

Subaccounts

If your account has subaccounts, qfex login will prompt you to choose which account should be active by default. The selected value is stored in ~/.config/qfex/config.yaml as selected_subaccount. Use these commands to inspect or change it later:
Selecting a different subaccount updates the config and restarts the daemon so authenticated trading and account requests use the new account context. You can also transfer money between subaccounts using:
This command accepts --from, --to, and --amount (in USD). You can set either --from or --to to "primary" to refer to your main account. The other account should be a UUID returned by qfex account subaccounts list.