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

CommandDescriptionExample
marketsList live markets with filtersrm-api markets -c crypto
categoriesList all market categoriesrm-api categories
orderbookShow live orderbook for a marketrm-api orderbook 0x1234...
snapshotsGet recent snapshotsrm-api snapshots 0x1234... -l 20
summaryMarket summary statisticsrm-api summary 0x1234...
statsSystem health and crypto pricesrm-api stats
searchFuzzy search across all marketsrm-api search "fed rate"

Data Download and Analysis

CommandDescriptionExample
downloadBulk export to SQLite cache / CSV / JSONLrm-api download -c crypto --last 24h
analyzeSpread/depth/volatility analysisrm-api analyze spread -c economics
gapsDetect data gaps in cached datarm-api gaps -c crypto
backtestStrategy backtestingrm-api backtest --builtin spread-revert -m 0x...

Live Monitoring

CommandDescriptionExample
watchLive TUI dashboard with keyboard navigationrm-api watch -c crypto
streamWebSocket JSONL streaming to stdoutrm-api stream -c crypto | jq '.midPrice'
alertThreshold alerts with webhook/commandrm-api alert spread -m 0x... --above 5%

Setup and Diagnostics

CommandDescriptionExample
configManage API key and URLrm-api config --set-key rm_...
doctorHealth check (API, DB, disk, config)rm-api doctor
initScaffold a project directoryrm-api init my-project
updateCheck for CLI updatesrm-api update
completionShell completions (bash/zsh/fish)rm-api completion bash

Authentication

The CLI resolves your API key in this order:

  1. --key flag (highest priority)
  2. RM_API_KEY environment variable
  3. ~/.resolved-markets/config file (set via rm-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.

CLI Tool — API Docs | Resolved Markets