{"id":47689712,"url":"https://github.com/kdkiss/bybit-cli","last_synced_at":"2026-04-04T21:00:56.622Z","repository":{"id":347771919,"uuid":"1195079950","full_name":"kdkiss/bybit-cli","owner":"kdkiss","description":"An AI-native CLI for trading on Bybit V5. Built-in MCP server and paper trading.","archived":false,"fork":false,"pushed_at":"2026-04-02T17:20:13.000Z","size":505,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-03T02:34:18.849Z","etag":null,"topics":["agent-tools","bybit","bybit-api","cli","crypto","crypto-cli","crypto-trading-agent","mcp","trading"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kdkiss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-03-29T07:29:20.000Z","updated_at":"2026-04-02T17:20:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"d3b1dfd5-1e23-405c-a6b5-ecda2a205982","html_url":"https://github.com/kdkiss/bybit-cli","commit_stats":null,"previous_names":["kdkiss/bybit-cli"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/kdkiss/bybit-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdkiss%2Fbybit-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdkiss%2Fbybit-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdkiss%2Fbybit-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdkiss%2Fbybit-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kdkiss","download_url":"https://codeload.github.com/kdkiss/bybit-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdkiss%2Fbybit-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31374051,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T17:53:18.093Z","status":"ssl_error","status_checked_at":"2026-04-03T17:53:17.617Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-tools","bybit","bybit-api","cli","crypto","crypto-cli","crypto-trading-agent","mcp","trading"],"created_at":"2026-04-02T15:24:25.111Z","updated_at":"2026-04-03T20:01:16.051Z","avatar_url":"https://github.com/kdkiss.png","language":"Rust","readme":"# bybit-cli\n\n*Thank you to the creators of [krakenfx/kraken-cli](https://github.com/krakenfx/kraken-cli) for providing the idea and framework for this project. This tool is inspired by their CLI, designed as a mirror for Bybit.*\n\n![version](https://img.shields.io/github/v/release/kdkiss/bybit-cli?color=blue)\n![license](https://img.shields.io/badge/license-MIT-green)\n![platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-lightgrey)\n![rust](https://img.shields.io/badge/built_with-Rust-orange)\n\n**DISCLAIMER: This is an UNOFFICIAL community-maintained CLI and is NOT affiliated with Bybit. Use at your own risk. Trading involves significant risk of loss.**\n\nThe AI-native CLI for trading crypto on Bybit. Full Bybit V5 API access. Built-in MCP server. Live and paper trading. Single binary.\n\nWorks with Claude, Cursor, Codex, Copilot, Gemini, and any MCP-compatible agent.\n\nTry these with your AI agent:\n\n\u003e *\"Build me a morning market brief for BTC, ETH, and SOL with trend, volatility, funding, and key levels.\"*\n\n\u003e *\"Watch BTCUSDT and alert me if price breaks above 68,000, drops below 66,000, or gets within 0.25% of either level.\"*\n\n\u003e *\"Create a trade plan for ETHUSDT with an entry, stop, and target, risk only 0.5% of my account, and show me the validate command before placing anything.\"*\n\n\u003e *\"Check my open positions and set a stop-loss at 5% below entry on each one.\"*\n\n---\n\n\u003e [!CAUTION]\n\u003e Unofficial software. Interacts with the live Bybit exchange and can execute real financial transactions. Read [DISCLAIMER.md](DISCLAIMER.md) before using with real funds or AI agents.\n\n## Contents\n\n- [Installation](#installation)\n- [What You Can Trade](#what-you-can-trade)\n- [For AI Agents](#for-ai-agents)\n- [Verifying Binaries](#verifying-binaries)\n- [Quick Start](#quick-start)\n- [API Keys \u0026 Configuration](#api-keys--configuration)\n- [MCP Server](#mcp-server)\n- [Paper Trading](#paper-trading)\n- [Commands](#commands)\n- [Examples](#examples)\n- [Agent Skills](#agent-skills)\n- [Development](#development)\n- [Contributing](#contributing)\n- [License \u0026 Disclaimer](#license--disclaimer)\n\n## Installation\n\nSingle binary, no runtime dependencies.\n\n### One-liner (macOS / Linux)\n\n```bash\ncurl --proto '=https' --tlsv1.2 -LsSf https://github.com/kdkiss/bybit-cli/releases/latest/download/bybit-cli-installer.sh | sh\n```\n\n### One-liner (Windows)\n\n```powershell\nirm https://github.com/kdkiss/bybit-cli/releases/latest/download/bybit-cli-installer.ps1 | iex\n```\n\nDetects your OS and architecture, downloads the right archive, verifies checksums, and installs it. Prebuilt installers are generated for macOS (Apple Silicon and Intel), Linux (`x86_64`), and Windows (`x86_64`).\n\nVerify it works:\n\n```bash\nbybit market server-time \u0026\u0026 bybit market tickers --category linear --symbol BTCUSDT\n```\n\nPre-built archives and installer scripts are available on the [GitHub Releases](https://github.com/kdkiss/bybit-cli/releases) page.\n\nTagged releases are built with `cargo-dist`, attested with GitHub build provenance, and published with per-artifact `.sha256` files, a unified `sha256.sum`, `SHA256SUMS.txt`, and `minisig` signatures. Maintainers must configure `MINISIGN_SECRET_KEY` and publish the matching minisign public key before the first public release.\n\nSee [Verifying Binaries](#verifying-binaries) for minisign verification.\n\n\u003cdetails\u003e\n\u003csummary\u003eBuild from source\u003c/summary\u003e\n\nRequires [Rust](https://rustup.rs/).\n\n```bash\ngit clone https://github.com/kdkiss/bybit-cli\ncd bybit-cli\ncargo install --path . --locked\n```\n\nOr just build:\n\n```bash\ncargo build --release\ncp target/release/bybit ~/.local/bin/\n```\n\n\u003c/details\u003e\n\n## What You Can Trade\n\nOne binary covers Bybit spot, derivatives, earn workflows, streaming, and paper trading.\n\n| Area | What it covers | Flag / namespace | Example |\n|---|---|---|---|\n| **Spot** | Public market data, balances, transfers, and spot orders | `--category spot` | `bybit market tickers --category spot --symbol BTCUSDT` |\n| **Linear derivatives** | USDT/USDC-margined perpetuals and related account/position flows | `--category linear` | `bybit futures buy --symbol BTCUSDT --qty 0.01 --price 50000` |\n| **Inverse derivatives** | Coin-margined contracts and historical market/account views | `--category inverse` | `bybit market instruments --category inverse` |\n| **Options** | Option market data plus account greeks and volatility views | `--category option` | `bybit market instruments --category option` |\n| **Earn** | Flexible saving / earn products, staking, redeeming, and yield history | `earn` namespace | `bybit earn products --coin BTC` |\n| **Paper trading** | Local simulation with live public prices and no API keys | `paper` namespace | `bybit paper buy --symbol BTCUSDT --qty 0.01` |\n\nProduct availability and permissions vary by jurisdiction, account type, and API key scope.\n\n## For AI Agents\n\nIf you're an AI agent or building one, start here:\n\n| Resource | Description |\n|----------|-------------|\n| [CONTEXT.md](CONTEXT.md) | Runtime context — load this at session start |\n| [AGENTS.md](AGENTS.md) | Full integration guide: auth, invocation, errors, rate limits |\n| [agents/tool-catalog.json](agents/tool-catalog.json) | Canonical agent/MCP tool catalog with parameter schemas, auth requirements, examples, and safety flags |\n| [agents/error-catalog.json](agents/error-catalog.json) | Error categories with retry guidance and remediation |\n| [agents/examples/README.md](agents/examples/README.md) | Curated shell-script examples for agent and automation workflows |\n| [skills/INDEX.md](skills/INDEX.md) | Goal-oriented workflow packages |\n| [CLAUDE.md](CLAUDE.md) | Claude-specific integration guidance |\n| [gemini-extension.json](gemini-extension.json) | Gemini CLI extension manifest for auto-starting the MCP server |\n\nCore invocation pattern:\n\n```bash\nbybit \u003ccommand\u003e [args...] -o json\n```\n\n- stdout is valid JSON on success.\n- Exit code 0 means success. Non-zero means failure.\n- On failure, the CLI prints a JSON error envelope to stderr.\n- stderr may also contain human-oriented diagnostics. Do not discard it if you need machine-readable errors.\n\n\u003cdetails\u003e\n\u003csummary\u003eWhy agent-first?\u003c/summary\u003e\n\nMost CLIs are built for humans at a terminal. This one is built for LLM-based agents, MCP tool servers, and automated pipelines that need to call Bybit reliably without custom API clients.\n\n- **Structured output by default.** Every command supports `-o json`. No screen-scraping.\n- **Consistent error envelopes.** Errors are JSON objects with a stable `error` field. Agents route on `error` without parsing human sentences.\n- **Predictable exit codes.** Success is 0, failure is non-zero. Agents detect and classify failures programmatically.\n- **Paper trading for safe iteration.** Test strategies against live prices with `bybit paper` commands. No API keys, no real money, and a close simulation of live market and limit order flows.\n- **Full API surface.** 100+ commands covering market data, trading, account, funding, reporting, positions, assets, subaccounts, futures, and WebSocket streaming.\n- **Built-in MCP server.** Native Model Context Protocol support over stdio with guarded dangerous-tool handling.\n- **Rate-limit aware.** When Bybit rejects a request, the CLI returns an enriched error with `suggestion`, `retryable`, and `docs_url` fields so agents can adapt their strategy.\n\n\u003c/details\u003e\n\n## Verifying Binaries\n\nRelease binaries are signed with [minisign](https://jedisct1.github.io/minisign/). Published artifacts on the [GitHub Releases](https://github.com/kdkiss/bybit-cli/releases) page include checksums and minisign signatures.\n\n**Public key:**\n\n```text\nuntrusted comment: minisign public key 9A81EBFCA673CEDE\nRWTeznOm/OuBmlyv8EeOQxZOog4NsO014QzO/aS3/+1woRbSPGUy3eEF\n```\n\n**Verify a downloaded archive:**\n\n```bash\nminisign -Vm bybit-cli-x86_64-unknown-linux-gnu.tar.gz -P RWTeznOm/OuBmlyv8EeOQxZOog4NsO014QzO/aS3/+1woRbSPGUy3eEF\n```\n\nInstall minisign with `brew install minisign` (macOS) or your Linux package manager.\n\n## Quick Start\n\n### Getting Started for Humans\n\nIf you just want to configure the CLI and start using it interactively:\n\n```bash\nbybit setup\nbybit shell\n```\n\n`bybit setup` walks through credentials and defaults. `bybit shell` starts the interactive REPL with history and tab-completion.\n\n### Quick Checks\n\nPublic market data requires no credentials:\n\n```bash\nbybit market tickers --category linear --symbol BTCUSDT -o json\nbybit market orderbook --category linear --symbol BTCUSDT --limit 10\nbybit market kline --category linear --symbol BTCUSDT --interval 60\n```\n\nWith authentication:\n\n```bash\nexport BYBIT_API_KEY=\"your-key\"\nexport BYBIT_API_SECRET=\"your-secret\"\n\nbybit account balance -o json\nbybit trade open-orders --category linear -o json\nbybit trade buy --symbol BTCUSDT --qty 0.01 --price 50000 --validate\n```\n\nFor humans (table output, interactive setup):\n\n```bash\nbybit setup\nbybit market tickers --category linear --symbol BTCUSDT\nbybit account balance\nbybit shell\n```\n\n## API Keys \u0026 Configuration\n\nAuthenticated commands require a Bybit API key pair. Public market data and paper trading work without credentials.\n\n### Getting API keys\n\nVisit [Bybit API Management](https://www.bybit.com/app/user/api-management). Grant minimum required permissions. For read-only monitoring, \"Read\" is sufficient.\n\n### Environment variables (recommended for agents)\n\n```bash\nexport BYBIT_API_KEY=\"your-key\"\nexport BYBIT_API_SECRET=\"your-secret\"\nexport BYBIT_TESTNET=\"true\"        # optional: use testnet\nexport BYBIT_API_URL=\"https://...\"  # optional: override base URL\n```\n\nFor local development, `bybit-cli` also loads `.env` from the current working directory (or its parents) at startup. Already-exported environment variables keep precedence.\n\n### Config file (for humans)\n\nStored in your platform config directory:\n\n- Linux: `~/.config/bybit/config.toml`\n- macOS: `~/Library/Application Support/bybit/config.toml`\n- Windows: `%APPDATA%\\bybit\\config.toml`\n\nExample:\n\n```toml\n[auth]\napi_key = \"your-api-key\"\napi_secret = \"your-api-secret\"\n\n[settings]\ndefault_category = \"linear\"\noutput = \"table\"\nrecv_window = 5000\ntestnet = false\n```\n\nRun `bybit setup` for interactive configuration.\n\n### Credential resolution\n\nHighest precedence first:\n\n1. CLI flags (`--api-key`, `--api-secret`)\n2. Environment variables (`BYBIT_API_KEY`, `BYBIT_API_SECRET`)\n3. Config file (platform config path, for example `~/.config/bybit/config.toml` on Linux)\n\n### Security\n\n- Config file is created with `0600` permissions (owner read/write only) on Unix.\n- Secrets are never logged, printed, or included in error messages.\n- Use `--api-secret-stdin` instead of `--api-secret` to avoid secrets in process listings.\n- For automation, prefer environment variables over command-line flags.\n\n## MCP Server\n\n\u003e Built-in MCP server is available via `bybit mcp`. It exposes command groups over stdio for MCP-compatible agents.\n\n```json\n{\n  \"mcpServers\": {\n    \"bybit\": {\n      \"command\": \"bybit\",\n      \"args\": [\"mcp\", \"-s\", \"all\"]\n    }\n  }\n}\n```\n\nGemini CLI users can use the included [gemini-extension.json](gemini-extension.json) manifest from the repo root to register the same MCP server configuration.\n\n```bash\nbybit mcp                          # read-only (market, account, paper)\nbybit mcp -s all                   # all services, dangerous calls require acknowledged=true\nbybit mcp -s all --allow-dangerous # all services, no per-call confirmation\nbybit mcp -s market,trade,paper    # specific services\nbybit mcp -s funding,reports,futures,subaccount\n```\n\nAvailable service groups include `market`, `account`, `trade`, `position`, `asset`, `funding`, `reports`, `subaccount`, `futures`, `paper`, and `auth`.\nThe server expects the standard MCP `initialize` plus `notifications/initialized` handshake; normal MCP clients handle that automatically.\n\nPersisted local state is shared with normal CLI mode: saved credentials, the paper journal, shell history, and the anonymous instance ID persist across MCP tool calls and server restarts until reset or deleted.\n\n## Paper Trading\n\nPaper trading provides a safe sandbox for testing trading logic against live Bybit prices. No API keys, no real money. It supports market and limit `buy` / `sell` flows with live pricing, local journal state, fees, and slippage.\n\n**Market orders (fill immediately at live price):**\n\n```bash\nbybit paper init --usdt 10000\nbybit paper buy --symbol BTCUSDT --qty 0.01\nbybit paper sell --symbol BTCUSDT --qty 0.005\nbybit paper status\n```\n\n**Limit orders (fill when market price crosses):**\n\n```bash\nbybit paper buy --symbol BTCUSDT --qty 0.01 --price 50000   # fills when price ≤ 50000\nbybit paper sell --symbol BTCUSDT --qty 0.01 --price 60000  # fills when price ≥ 60000\nbybit paper orders     # check open limit orders (checks fills at current prices)\nbybit paper cancel 1   # cancel order by ID\nbybit paper cancel-all # cancel all pending limit orders\n```\n\n**Full session:**\n\n```bash\nbybit paper init --usdt 10000 -o json\nbybit paper buy --symbol BTCUSDT --qty 0.01 -o json\nbybit paper positions -o json\nbybit paper history -o json\nbybit paper status -o json\nbybit paper reset -o json\n```\n\n`bybit paper reset` can also re-seed the simulator in one step, for example:\n\n```bash\nbybit paper reset --balance 2500 --settle-coin USDC --taker-fee-bps 10 --maker-fee-bps 2 --slippage-bps 0\n```\n\n| Command | Description |\n|---------|-------------|\n| `bybit paper init [--usdt 10000]` | Initialize paper account |\n| `bybit paper buy --symbol SYM --qty Q [--price P]` | Paper buy (market or limit) |\n| `bybit paper sell --symbol SYM --qty Q [--price P]` | Paper sell (market or limit) |\n| `bybit paper orders` | Open limit orders (checks fills) |\n| `bybit paper cancel \u003cORDER_ID\u003e` | Cancel a limit order |\n| `bybit paper cancel-all` | Cancel all limit orders |\n| `bybit paper balance` | Coin balances with total, reserved, and available |\n| `bybit paper positions` | Open positions |\n| `bybit paper history` | Filled trade history |\n| `bybit paper status` | Portfolio value, realized/unrealized P\u0026L, fees, and valuation status |\n| `bybit paper reset` | Reinitialize the paper account, optionally overriding balance, settle coin, fees, or slippage |\n\nAll output includes `\"mode\": \"paper\"` in JSON. Limit buys reserve quote balance plus maker fees, limit sells reserve base asset quantity, and pending orders are reconciled when paper read commands run (`balance`, `positions`, `history`, `cancelled`, `orders`, or `status`).\n\n## Commands\n\nThe CLI exposes 18 top-level command groups. For the machine-readable agent/MCP tool surface, load [agents/tool-catalog.json](agents/tool-catalog.json).\n\n| Group | Auth | Dangerous | Description |\n|-------|------|-----------|-------------|\n| market | No | No | Tickers, orderbook, klines, funding, open interest |\n| trade | Yes | Yes | Order placement, amendment, cancellation, batch ops |\n| account | Yes | No | Balances, info, fee rates, transaction log |\n| position | Yes | Yes | List, leverage, TP/SL, margin, closed P\u0026L |\n| asset | Yes | Yes | Balances, transfers, deposits, withdrawals |\n| convert | Yes | Mixed | Coin conversion quote, execute, status, and history |\n| margin | Mixed | Mixed | Spot margin status, VIP data, mode toggle, and leverage |\n| funding | Yes | Yes | Wallet balances, deposits, withdrawals, and transfers |\n| subaccount | Yes | Yes | Master-account subaccount management |\n| earn | Mixed | Mixed | Bybit Earn products, positions, stake/redeem, and yield history |\n| futures | Mixed | Mixed | Derivatives-focused market data, trading, positions, and streaming |\n| ws | Optional | No | Real-time WebSocket streams |\n| paper | No | No | Paper trading simulation |\n| reports | Yes | No | Histories plus Bybit tax export request/status/retrieve workflows |\n| auth | Mixed | No | Credential management |\n| utility | No | No | Setup wizard, interactive shell |\n\n\u003cdetails\u003e\n\u003csummary\u003eFull command reference\u003c/summary\u003e\n\n### Market Data (Public)\n\n| Command | Description |\n|---------|-------------|\n| `bybit market server-time` | Server time |\n| `bybit market instruments --category linear` | List instruments |\n| `bybit market orderbook --category linear --symbol BTCUSDT` | L2 order book |\n| `bybit market tickers --category linear [--symbol SYM]` | Ticker data |\n| `bybit market kline --category linear --symbol SYM --interval 60` | OHLCV candles |\n| `bybit market mark-price-kline ...` | Mark price kline |\n| `bybit market index-price-kline ...` | Index price kline |\n| `bybit market premium-index-kline ...` | Premium index kline |\n| `bybit market funding-rate --category linear --symbol SYM` | Funding rate history |\n| `bybit market trades --category linear --symbol SYM` | Recent trades |\n| `bybit market open-interest --category linear --symbol SYM --interval 1h` | Open interest |\n| `bybit market volatility [--currency BTC]` | Historical volatility (options) |\n| `bybit market insurance [--coin USDT]` | Insurance fund |\n| `bybit market risk-limit --category linear --symbol SYM` | Risk limits |\n| `bybit market delivery-price --category linear` | Delivery price |\n| `bybit market ls-ratio --category linear --symbol SYM --period 5min` | Long/short ratio |\n\n### Trading\n\n| Command | Description |\n|---------|-------------|\n| `bybit trade buy --symbol SYM --qty Q [--price P] [--validate]` | Buy order |\n| `bybit trade sell --symbol SYM --qty Q [--price P]` | Sell order |\n| `bybit trade amend --symbol SYM --order-id ID [--price P] [--qty Q]` | Amend open order |\n| `bybit trade cancel --symbol SYM --order-id ID` | Cancel order |\n| `bybit trade cancel-all [--symbol SYM]` | Cancel all orders |\n| `bybit trade cancel-after \u003cSECS\u003e` | Dead man's switch (0 = disable) |\n| `bybit trade dcp-info` | Show current DCP (Disconnect Cancel All) configuration |\n| `bybit trade open-orders [--symbol SYM]` | Open orders |\n| `bybit trade history [--symbol SYM] [--limit N]` | Order history |\n| `bybit trade fills [--symbol SYM] [--limit N]` | Execution history |\n| `bybit trade batch-place --orders '[...]'` | Batch place (up to 20) |\n| `bybit trade batch-amend --orders '[...]'` | Batch amend (up to 20) |\n| `bybit trade batch-cancel --orders '[...]'` | Batch cancel (up to 20) |\n\n### Account\n\n| Command | Description |\n|---------|-------------|\n| `bybit account balance [--account-type UNIFIED] [--coin USDT]` | Wallet balance |\n| `bybit account extended-balance [--account-type UNIFIED] [--coin USDT]` | Per-coin balance view across the account |\n| `bybit account info` | Account info (UID, margin mode) |\n| `bybit account fee-rate [--category linear] [--symbol SYM]` | Fee rates |\n| `bybit account transaction-log [--limit N]` | Transaction log |\n| `bybit account borrow-history` | Borrow history |\n| `bybit account collateral-info` | Collateral info |\n| `bybit account greeks` | Options greeks |\n| `bybit account volume [--category linear] [--days 30]` | Approximate executed trading volume over a lookback window |\n| `bybit account set-margin-mode --margin-mode REGULAR_MARGIN` | Set margin mode |\n| `bybit account set-spot-hedging --mode ON` | Set spot hedging |\n| `bybit account set-usdc-settlement --coin USDC` | Set UTA settlement coin for USDC products |\n| `bybit account borrow --coin USDT --amount AMT` | Manually borrow funds |\n| `bybit account repay --coin USDT --amount AMT` | Manually repay borrowed funds |\n| `bybit account quick-repay [--coin USDT]` | Auto-select and repay liabilities |\n\n### Convert\n\n| Command | Description |\n|---------|-------------|\n| `bybit convert coins [--account-type UNIFIED] [--coin BTC] [--side 1]` | List coins and supported conversion directions |\n| `bybit convert quote --from-coin BTC --to-coin USDT (--from-amount AMT \\| --to-amount AMT)` | Request a conversion quote |\n| `bybit convert quote ... --dry-run` | Preview the quote request without calling the API |\n| `bybit convert execute --quote-tx-id ID` | Execute a previously obtained quote |\n| `bybit convert status --quote-tx-id ID [--account-type UNIFIED]` | Check conversion status |\n| `bybit convert history [--account-type UNIFIED] [--coin BTC] [--start MS] [--end MS] [--index N] [--limit N]` | Conversion history |\n\nNotes:\nThe Convert API requires the Bybit API key permission `Exchange`. If that permission is missing, Bybit may reject coin-list and quote requests even though the CLI command itself is correct.\n\n### Spot Margin\n\n| Command | Description |\n|---------|-------------|\n| `bybit margin vip-data [--vip-level \"No VIP\"] [--currency BTC]` | Public VIP borrow/leverage data for spot margin |\n| `bybit margin status` | Current spot margin state and leverage for the unified account |\n| `bybit margin toggle --mode on\\|off` | Enable or disable unified account spot margin |\n| `bybit margin set-leverage --leverage N [--currency BTC]` | Set spot margin leverage globally or for a coin |\n\nNotes:\nSpot margin activation and leverage changes can be rejected by Bybit until the account completes the required margin-trading setup or quiz in the Bybit UI.\n\n### Earn\n\n| Command | Description |\n|---------|-------------|\n| `bybit earn products [--category FlexibleSaving] [--coin BTC]` | List available Bybit Earn products |\n| `bybit earn positions [--category FlexibleSaving] [--coin BTC]` | List active Earn positions |\n| `bybit earn stake --product-id ID --coin BTC --amount AMT` | Stake into an Earn product |\n| `bybit earn redeem --product-id ID --coin BTC --amount AMT` | Redeem from an Earn product |\n| `bybit earn history [--category FlexibleSaving] [--order-id ID]` | Stake/redeem order history or status |\n| `bybit earn yield [--category FlexibleSaving]` | Yield distribution history |\n| `bybit earn hourly-yield [--category FlexibleSaving]` | Hourly yield history |\n\n### Positions\n\n| Command | Description |\n|---------|-------------|\n| `bybit position list [--symbol SYM]` | Open positions |\n| `bybit position set-leverage --symbol SYM --buy-leverage N --sell-leverage N` | Set leverage |\n| `bybit position switch-mode --symbol SYM --mode 0` | Switch one-way/hedge |\n| `bybit position set-tpsl --symbol SYM [--take-profit P] [--stop-loss P]` | Set TP/SL |\n| `bybit position set-risk-limit --symbol SYM --risk-id N` | Set risk limit |\n| `bybit position add-margin --symbol SYM --margin AMT` | Add/reduce margin |\n| `bybit position closed-pnl [--category linear] [--symbol SYM] [--limit N]` | Closed P\u0026L history for supported contract categories |\n| `bybit position move --from-uid UID --to-uid UID --positions '[...]'` | Move positions |\n| `bybit position move-history` | Move position history |\n\n### Assets\n\n| Command | Description |\n|---------|-------------|\n| `bybit asset coin-info [--coin BTC]` | Coin info (networks, limits) |\n| `bybit asset balance [--account-type UNIFIED]` | Asset balance |\n| `bybit asset all-balance [--account-type UNIFIED]` | All coins balance |\n| `bybit asset account-balance --coin USDT` | Single coin balance |\n| `bybit asset transferable --from-account-type FUND --to-account-type UNIFIED` | Transferable coins |\n| `bybit asset transfer --coin USDT --amount AMT --from-account-type F --to-account-type T` | Internal transfer |\n| `bybit asset transfer-history` | Transfer history |\n| `bybit asset sub-transfer ...` | Universal (cross-UID) transfer |\n| `bybit asset sub-transfer-history` | Universal transfer history |\n| `bybit asset deposit-address --coin BTC [--chain-type BTC]` | Deposit address |\n| `bybit asset deposit-history` | Deposit history |\n| `bybit asset withdraw --coin USDT --chain TRX --address ADDR --amount AMT` | Withdraw |\n| `bybit asset withdraw-history` | Withdrawal history |\n| `bybit asset cancel-withdraw --id ID` | Cancel pending withdrawal |\n\n### Funding\n\n| Command | Description |\n|---------|-------------|\n| `bybit funding coin-info [--coin BTC]` | Coin funding metadata |\n| `bybit funding balance [--account-type UNIFIED] [--coin USDT]` | Funding balance by wallet type |\n| `bybit funding all-balance [--account-type UNIFIED]` | All funding balances |\n| `bybit funding account-balance --coin USDT` | Single funding coin balance |\n| `bybit funding transferable --from-account-type FUND --to-account-type UNIFIED` | Coins transferable between wallets |\n| `bybit funding transfer --coin USDT --amount AMT --from-account-type F --to-account-type T` | Internal wallet transfer |\n| `bybit funding transfer-history` | Internal transfer history |\n| `bybit funding sub-transfer ...` | Universal transfer across UIDs |\n| `bybit funding sub-transfer-history` | Universal transfer history |\n| `bybit funding deposit-address --coin BTC [--chain-type BTC]` | Deposit address |\n| `bybit funding deposit-history` | Deposit history |\n| `bybit funding withdraw --coin USDT --chain TRX --address ADDR --amount AMT` | Withdraw |\n| `bybit funding withdraw-history` | Withdrawal history |\n| `bybit funding cancel-withdraw --id ID` | Cancel pending withdrawal |\n\n### Subaccounts\n\n| Command | Description |\n|---------|-------------|\n| `bybit subaccount list` | List up to 10k subaccounts |\n| `bybit subaccount list-all [--page-size N] [--next-cursor CURSOR]` | Paginated subaccount listing |\n| `bybit subaccount wallet-types [--member-ids UID1,UID2]` | Show master/subaccount wallet types |\n| `bybit subaccount api-keys --sub-member-id UID [--limit N]` | List API keys for a subaccount |\n| `bybit subaccount create --username NAME [--member-type 1] [--quick-login]` | Create a subaccount |\n| `bybit subaccount delete --sub-member-id UID` | Delete a subaccount |\n| `bybit subaccount freeze --sub-member-id UID` | Freeze a subaccount |\n| `bybit subaccount unfreeze --sub-member-id UID` | Unfreeze a subaccount |\n\n### Futures\n\n| Command | Description |\n|---------|-------------|\n| `bybit futures instruments [--category linear] [--symbol SYM]` | Derivatives instrument metadata |\n| `bybit futures tickers [--category linear] [--symbol SYM]` | Futures ticker / 24h stats |\n| `bybit futures orderbook --symbol SYM [--limit 50]` | Futures L2 order book |\n| `bybit futures funding-rate --symbol SYM` | Funding rate history |\n| `bybit futures open-interest --symbol SYM --interval-time 1h` | Open interest |\n| `bybit futures positions [--symbol SYM]` | Open futures positions |\n| `bybit futures open-orders [--symbol SYM]` | Open futures orders |\n| `bybit futures history [--symbol SYM] [--limit N]` | Futures order history |\n| `bybit futures fills [--symbol SYM] [--limit N]` | Futures execution history |\n| `bybit futures buy --symbol SYM --qty Q [--price P] [--validate]` | Place a futures buy order |\n| `bybit futures sell --symbol SYM --qty Q [--price P]` | Place a futures sell order |\n| `bybit futures cancel --symbol SYM --order-id ID` | Cancel a futures order |\n| `bybit futures cancel-all [--symbol SYM]` | Cancel all futures orders |\n| `bybit futures set-leverage --symbol SYM --buy-leverage N --sell-leverage N` | Set futures leverage |\n| `bybit futures ws orderbook --symbol SYM [--depth 50]` | Futures order book stream |\n| `bybit futures ws orders` | Private futures order updates |\n\n### Reports\n\n| Command | Description |\n|---------|-------------|\n| `bybit reports transactions [--account-type UNIFIED] [--currency USDT]` | Account transaction log |\n| `bybit reports borrow-history [--currency USDT]` | Borrow history |\n| `bybit reports orders [--category linear] [--symbol SYM]` | Order history |\n| `bybit reports fills [--category linear] [--symbol SYM]` | Execution history |\n| `bybit reports closed-pnl [--category linear] [--symbol SYM]` | Closed P\u0026L history for supported contract categories |\n| `bybit reports moves [--category linear] [--symbol SYM]` | Position move history |\n| `bybit reports deposits [--coin BTC]` | Deposit history |\n| `bybit reports withdrawals [--coin USDT]` | Withdrawal history |\n| `bybit reports transfers [--coin USDT]` | Internal transfer history |\n| `bybit reports sub-transfers [--coin USDT]` | Universal transfer history |\n| `bybit reports register-time` | Bybit Tax API register date for the current account |\n| `bybit reports export-request --report-type TRADE --report-number 2 --start ... --end ...` | Request a Bybit tax export job |\n| `bybit reports export-status --query-id ID` | Check tax export job status |\n| `bybit reports export-retrieve --query-id ID [--download-dir DIR]` | Retrieve tax export URLs and optionally download the files |\n\n### WebSocket Streaming\n\n| Command | Description |\n|---------|-------------|\n| `bybit ws orderbook --symbol SYM [--depth 50]` | L2 order book stream |\n| `bybit ws ticker --symbol SYM` | Ticker stream |\n| `bybit ws trades --symbol SYM` | Public trades stream |\n| `bybit ws kline --symbol SYM --interval 1` | Kline/OHLCV stream |\n| `bybit ws liquidation --symbol SYM` | Liquidation stream |\n| `bybit ws greeks --base-coin BTC` | Options greeks stream |\n| `bybit ws lt-kline --symbol SYM --interval 1` | Leveraged token kline stream |\n| `bybit ws lt-ticker --symbol SYM` | Leveraged token ticker stream |\n| `bybit ws orders` | Private order updates (auth) |\n| `bybit ws positions` | Private position updates (auth) |\n| `bybit ws executions` | Private execution updates (auth) |\n| `bybit ws wallet` | Private wallet updates (auth) |\n| `bybit ws notifications` | All private streams combined (auth) |\n| `bybit ws dcp` | Disconnection-cut-position events (auth) |\n\nPress Ctrl+C to stop. Auto-reconnects on disconnect (exponential backoff, up to 12 attempts).\n\n### Auth\n\n| Command | Description |\n|---------|-------------|\n| `bybit auth set --api-key KEY [--api-secret TEXT]` | Save credentials to config |\n| `bybit auth sign [--payload TEXT]` | Sign test payload, print HMAC-SHA256 |\n| `bybit auth test` | Test credentials against /v5/account/info |\n| `bybit auth show` | Show current credential source and masked key |\n| `bybit auth permissions` | Show active API key permissions and scopes |\n| `bybit auth reset` | Remove credentials from config file |\n\n### Utility\n\n| Command | Description |\n|---------|-------------|\n| `bybit setup` | Interactive setup wizard |\n| `bybit shell` | Interactive REPL with tab-completion and history |\n\n\u003c/details\u003e\n\n## Examples\n\n### Conditional order based on live price\n\n```bash\nPRICE=$(bybit market tickers --category linear --symbol BTCUSDT -o json \\\n  | jq -r '.list[0].lastPrice')\nbybit trade buy --symbol BTCUSDT --qty 0.001 --price \"$PRICE\" --validate\n```\n\n### Real-time price stream\n\n```bash\nbybit ws ticker --category linear --symbol BTCUSDT -o json | while read -r line; do\n  LAST=$(echo \"$line\" | jq -r '.data.lastPrice // empty')\n  [ -n \"$LAST\" ] \u0026\u0026 echo \"BTC: $LAST\"\ndone\n```\n\n### Portfolio snapshot\n\n```bash\nbybit account balance -o json\nbybit position list --category linear -o json | jq '[.list[] | {symbol, side, size, unrealisedPnl}]'\n```\n\n### Dead man's switch\n\n```bash\nbybit trade cancel-after 60\n```\n\nCancels all open orders if not refreshed within 60 seconds. Pass `0` to disable.\n\n### Morning brief\n\n```bash\n#!/bin/bash\necho \"=== Balance ===\" \u0026\u0026 bybit account balance\necho \"=== Positions ===\" \u0026\u0026 bybit position list --category linear\necho \"=== BTC ===\" \u0026\u0026 bybit market tickers --category linear --symbol BTCUSDT\n```\n\n## Agent Skills\n\nShips with a growing agent skills library. See the full [Skills Index](skills/INDEX.md).\n\nExamples:\n\n- `account-snapshot` for a quick balance and positions overview\n- `bybit-recipe-morning-brief` for a reusable multi-market briefing workflow\n- `bybit-recipe-emergency-flatten` for guarded position-exit playbooks\n\n\u003cdetails\u003e\n\u003csummary\u003eTroubleshooting\u003c/summary\u003e\n\n**\"API key is invalid\" (auth error)**\n\n- Verify `BYBIT_API_KEY` and `BYBIT_API_SECRET` are set correctly (case-sensitive).\n- Run `bybit auth test` to test the current credentials.\n- Check that the API key has the required permissions for the operation.\n- Ensure your system clock is accurate — timestamp drift causes auth failures.\n\n**Rate limit errors**\n\nThe CLI does not pre-throttle requests. When Bybit returns a rate limit error (retCode 10006/10018), the CLI surfaces it immediately with a `suggestion` field. Read the suggestion and adjust request frequency. For high-frequency data, prefer WebSocket streaming over REST polling.\n\n**Mainnet vs testnet confusion**\n\n- `BYBIT_TESTNET=true` or `--testnet` switches the CLI to Bybit testnet.\n- Testnet keys are separate from mainnet keys.\n- If a command unexpectedly shows empty balances or auth failures, confirm you are pointing at the intended environment.\n\n**\"Permission denied\" / retCode 10005**\n\n- Your API key is valid, but missing the specific permission required by that command.\n- Run `bybit auth permissions -o json` to inspect the active key scopes.\n- Asset, funding, subaccount, transfer, and some reporting commands typically require wallet-related permissions beyond basic read/trade access.\n\n**\"Symbol not found\" or category mismatch**\n\n- Check that the symbol matches the selected category, for example `BTCUSDT` with `--category linear` or `BTCUSDT` spot with `--category spot`.\n- If a derivatives list command returns parameter errors without a symbol, try leaving the default `linear` category in place or explicitly provide `--settle-coin USDT`.\n- Use `bybit market instruments --category \u003ccategory\u003e` to confirm the exact symbol spelling.\n\n**Config file not found**\n\n- This is normal on first run if you have only set environment variables.\n- Run `bybit setup` to create the config file in your platform config directory, or continue using `BYBIT_API_KEY` / `BYBIT_API_SECRET` directly.\n\n**\"No paper journal\" error**\n\nRun `bybit paper init` to initialize the paper trading account before using other paper commands.\n\n**WebSocket disconnects**\n\nThe CLI reconnects automatically with exponential backoff (up to 12 attempts). If reconnects fail, check network connectivity and Bybit's [status page](https://status.bybit.com).\n\n**\"MCP tool missing\"**\n\nCheck the service selection passed to `bybit mcp -s ...`. The default service set is `market,account,paper`; use `-s all` or include the specific group you need.\n\nFor machine-readable remediation guidance, see [agents/error-catalog.json](agents/error-catalog.json).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eArchitecture\u003c/summary\u003e\n\n```\nsrc/\n  main.rs         — CLI entry point, clap parsing, exit codes\n  lib.rs          — AppContext, Command enum, dispatch, apply_default_category\n  auth.rs         — HMAC-SHA256 signing, timestamp, AuthHeaders\n  config.rs       — Config file I/O, credential resolution, SecretValue wrapper\n  client.rs       — HTTP client with retry, envelope parsing, rustls TLS\n  errors.rs       — Unified error types with JSON envelopes\n  paper.rs        — Paper trading state machine (market + limit orders)\n  shell.rs        — Interactive REPL with rustyline\n  telemetry.rs    — Instance ID, agent detection, request metadata\n  commands/\n    market.rs     — 17 public market data endpoints\n    trade.rs      — Order management + batch ops + cancel-after\n    account.rs    — Account info, balances, settings\n    position.rs   — Position management\n    asset.rs      — Asset transfers, deposits, withdrawals\n    funding.rs    — Funding and wallet workflow aliases\n    subaccount.rs — Master-account subaccount management\n    futures.rs    — Derivatives-focused command namespace\n    reports.rs    — Read-only reporting and history aliases\n    websocket.rs  — WebSocket streaming with reconnect\n    paper.rs      — Paper trading commands\n    auth.rs       — Credential management (set/sign/test/show/reset)\n    utility.rs    — Setup wizard\n    helpers.rs    — Shared confirm(), build_params()\n  mcp/            — MCP server, registry, and schema helpers\n  output/\n    json.rs       — JSON output\n    table.rs      — comfy-table rendering\n```\n\n\u003c/details\u003e\n\n## Development\n\n```bash\ncargo build                         # dev build\ncargo build --release               # optimized build\ncargo test                          # all tests\ncargo clippy -- -D warnings         # lint\ncargo audit -D warnings             # security advisories\ncargo fmt                           # format\n```\n\nLive smoke tests are opt-in and do not run during normal `cargo test`.\n\n```bash\nBYBIT_RUN_LIVE_PUBLIC=1 cargo test --test live_smoke\nBYBIT_RUN_LIVE_PUBLIC=1 BYBIT_RUN_LIVE_WS=1 cargo test --test live_smoke\nBYBIT_RUN_LIVE_TESTNET=1 BYBIT_TESTNET_API_KEY=... BYBIT_TESTNET_API_SECRET=... cargo test --test live_smoke\nBYBIT_RUN_LIVE_TESTNET=1 BYBIT_RUN_LIVE_WS=1 BYBIT_TESTNET_API_KEY=... BYBIT_TESTNET_API_SECRET=... cargo test --test live_smoke\nBYBIT_RUN_LIVE_EARN=1 BYBIT_TESTNET_API_KEY=... BYBIT_TESTNET_API_SECRET=... cargo test --test live_smoke live_testnet_earn_positions_smoke\n```\n\nOn PowerShell:\n\n```powershell\n$env:BYBIT_RUN_LIVE_PUBLIC = \"1\"\ncargo test --test live_smoke\n\n$env:BYBIT_RUN_LIVE_TESTNET = \"1\"\n$env:BYBIT_TESTNET_API_KEY = \"...\"\n$env:BYBIT_TESTNET_API_SECRET = \"...\"\ncargo test --test live_smoke\n```\n\n## Contributing\n\nBug reports, feature requests, and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines and repo conventions.\n\n## License \u0026 Disclaimer\n\nMIT. See [LICENSE](LICENSE).\n\nThis is unofficial community-maintained software. It interacts with the live Bybit exchange and can result in real financial transactions. Orders, withdrawals, and transfers are irreversible once processed. See [DISCLAIMER.md](DISCLAIMER.md) for full terms and risk disclosure.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdkiss%2Fbybit-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkdkiss%2Fbybit-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdkiss%2Fbybit-cli/lists"}