CLI Tool
Install and use the Resolved Markets CLI for terminal-based access to prediction market data.
Installation
Install from GitHub Packages:
# 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/resolved-markets # Configure your API key rm-api config --set-key YOUR_API_KEY # Verify installation rm-api doctor
Or install from source:
git clone https://github.com/Elcara-HQ/HighFidelity_OrderbookTracker.git cd HighFidelity_OrderbookTracker/packages/cli pnpm install && pnpm build npm link
Commands Reference
Data Queries
| 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" |
Data Download and Analysis
| Command | Description | Example |
|---|---|---|
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... |
Live Monitoring
| Command | Description | Example |
|---|---|---|
watch | Live TUI dashboard with keyboard navigation | rm-api watch -c crypto |
stream | WebSocket JSONL streaming to stdout | rm-api stream -c crypto | jq '.midPrice' |
alert | Threshold alerts with webhook/command | rm-api alert spread -m 0x... --above 5% |
Setup and Diagnostics
| Command | Description | Example |
|---|---|---|
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:
--keyflag (highest priority)RM_API_KEYenvironment variable~/.resolved-markets/configfile (set viarm-api config --set-key)
Output Formats
All data commands support --json for raw JSON output, making the CLI pipe-friendly:
# Pipe to jq rm-api markets -c sports --json | jq '.[].label' # Stream to file rm-api stream -c crypto > orderbook.jsonl # Export CSV rm-api download -c weather --format csv --stdout > weather.csv
Local Cache
Downloaded data is stored in a SQLite database at ~/.resolved-markets/data.db. The download command supports incremental sync — it resumes from the last downloaded timestamp. The analyze, backtest, replay, and gaps commands read from this local cache for fast offline access.