> For the complete documentation index, see [llms.txt](https://resolvedmarkets.com/llms.txt). Every docs page is also served as Markdown: append `.md` to its URL or send `Accept: text/markdown`.

## CLI Tool

Install and use the Resolved Markets CLI (`rm-api`) for terminal access to prediction market data.

### Installation

```bash
# Add GitHub Packages registry for @elcara-hq scope
echo "@elcara-hq:registry=https://npm.pkg.github.com" >> ~/.npmrc

# Install globally
npm install -g @elcara-hq/resolvedmarkets-cli

# Configure your API key
rm-api config --set-key YOUR_API_KEY

# Verify installation
rm-api doctor
```

### Commands

| Command | Description | Example |
| --- | --- | --- |
| `markets` | List live markets with filters | `rm-api markets -c crypto` |
| `categories` | List all market categories | `rm-api categories` |
| `orderbook` | Show live orderbook for a market | `rm-api orderbook 0x1234...` |
| `snapshots` | Get recent snapshots | `rm-api snapshots 0x1234... -l 20` |
| `summary` | Market summary statistics | `rm-api summary 0x1234...` |
| `stats` | System health and crypto prices | `rm-api stats` |
| `search` | Fuzzy search across all markets | `rm-api search "fed rate"` |
| `download` | Bulk export to SQLite cache / CSV / JSONL | `rm-api download -c crypto --last 24h` |
| `analyze` | Spread/depth/volatility analysis | `rm-api analyze spread -c economics` |
| `gaps` | Detect data gaps in cached data | `rm-api gaps -c crypto` |
| `backtest` | Strategy backtesting | `rm-api backtest --builtin spread-revert -m 0x...` |
| `watch` | Live TUI dashboard | `rm-api watch -c crypto` |
| `stream` | WebSocket JSONL streaming to stdout | `rm-api stream -c crypto > orderbook.jsonl` |
| `alert` | Threshold alerts with webhook/command | `rm-api alert spread -m 0x... --above 5%` |
| `config` | Manage API key and URL | `rm-api config --set-key rm_...` |
| `doctor` | Health check (API, DB, disk, config) | `rm-api doctor` |
| `init` | Scaffold a project directory | `rm-api init my-project` |
| `update` | Check for CLI updates | `rm-api update` |
| `completion` | Shell completions (bash/zsh/fish) | `rm-api completion bash` |

### Authentication

The CLI resolves your API key in this order: the `--key` flag, then the `RM_API_KEY` environment variable, then `~/.resolved-markets/config` (set with `rm-api config --set-key`).

### Output and local cache

All data commands accept `--json` for raw JSON output. Downloaded data is stored in SQLite at `~/.resolved-markets/data.db`. `download` resumes from the last downloaded timestamp, and `analyze`, `backtest`, `replay` and `gaps` read from this cache.
