Kwery CLI
76 commands. JSON, CSV, or table output. Designed to pipe into Python, pandas, and shell scripts.
Install
npm install -g kwery-cli
Setup
kwery login your_api_key_here # saves key to ~/.config/kwery/config.json
kwery limits # verify connection + show plan
💡Persistent key
The key persists across sessions. Run kwery logout to clear it.
Quick Examples
# Polymarket candles to CSV
kwery polymarket candles --token-id 0x123abc --interval 1h --format csv > btc_pm.csv
# Kalshi prices as JSON
kwery kalshi prices --market-id BTCUSD-23DEC --interval 1h
# Binance funding with date range
kwery binance funding --symbol BTCUSDT --start 2024-01-01 --end 2024-03-01
# Binance liquidations — long side only
kwery binance liquidations --symbol BTCUSDT --side long
# Pipe to Python
kwery kalshi prices --market-id BTCUSD-23DEC --format csv | python3 analyze.py
# Check data ingestion health
kwery status
All Commands
account
| Command | Args | Description |
|---|
kwery login <key> | API key | Save API key to config |
kwery logout | — | Remove saved API key |
kwery limits | — | Show plan limits and credit balance |
discovery
| Command | Args | Description |
|---|
kwery sources | — | List all available data sources |
kwery status | — | API health check |
kwery markets | --query, --source | Search markets across all platforms |
kwery market <id> | Market ID | Get metadata for a single market |
polymarket
| Command | Args | Description |
|---|
kwery polymarket markets | --query, --limit | List/search Polymarket markets |
kwery polymarket market <id> | Market ID | Get a single market |
kwery polymarket candles | --token-id, --market-id, --interval | OHLCV candles |
kwery polymarket trades | --token-id, --market-id | Raw trade history |
kwery polymarket snapshots | --token-id, --interval | Order book snapshot series |
kwery polymarket snapshot-at | --token-id, --time or --interval | Order book at a point in time |
kalshi
| Command | Args | Description |
|---|
kwery kalshi markets | --query, --limit | List/search Kalshi markets |
kwery kalshi prices | --market-id, --interval | Price history (cents, 0–100) |
kwery kalshi orderbook | --market-id | Current order book |
kwery kalshi snapshots | --market-id, --interval | Order book snapshot series |
kwery kalshi snapshot-at | --market-id, --time or --interval | Order book at a point in time |
hyperliquid
| Command | Args | Description |
|---|
kwery hyperliquid markets | — | List Hyperliquid perp markets |
kwery hyperliquid candles | --symbol, --interval | OHLCV candles |
kwery hyperliquid trades | --symbol | Raw trade history |
kwery hyperliquid funding | --symbol | Funding rate history |
kwery hyperliquid oi | --symbol | Open interest history |
kwery hyperliquid snapshots | --symbol, --interval | Order book snapshot series |
kwery hyperliquid snapshot-at | --symbol, --time or --interval | Order book at a point in time |
binance
| Command | Args | Description |
|---|
kwery binance candles | --symbol, --interval, --source | Spot or futures OHLCV |
kwery chainlink candles | --symbol, --interval | Chainlink oracle price candles |
kwery binance ticker | --symbol | 1-second ticker |
kwery binance flow | --symbol | Spot buy/sell flow (buy_ratio) |
kwery binance funding | --symbol | Futures funding rate history |
kwery binance oi | --symbol | Open interest history |
kwery binance liquidations | --symbol, --side | Liquidation history |
config
| Command | Description |
|---|
kwery config set <key> <value> | Set a config value |
kwery config get <key> | Get a config value |
kwery config list | Show all config values |
kwery config reset | Reset config to defaults |
Universal Flags
| Flag | Type | Default | Description |
|---|
--format | json|csv|table | json | Output format |
--limit | number | 500 | Max rows per page |
--start | ISO 8601 | — | Start timestamp (inclusive) |
--end | ISO 8601 | — | End timestamp |
--after | string | — | Cursor for next page |
Output Formats
All three formats from the same command:
# JSON (default)
kwery binance funding --symbol BTCUSDT
# CSV — pipe to file
kwery binance funding --symbol BTCUSDT --format csv > funding.csv
# ASCII table — terminal viewing
kwery binance funding --symbol BTCUSDT --format table
JSON — one object with a data array and a meta object containing next_cursor.
CSV — headers on the first line. Pipe to a file with > or directly into Python.
Table — ASCII-formatted for terminal viewing. Not suitable for piping.
Pagination
Fetch all pages with a shell loop:
CURSOR=""
while true; do
RESULT=$(kwery kalshi prices --market-id BTCUSD-23DEC --limit 500 ${CURSOR:+--after $CURSOR} --format json)
echo "$RESULT" >> all_prices.jsonl
CURSOR=$(echo "$RESULT" | jq -r '.meta.next_cursor')
[ "$CURSOR" = "null" ] && break
done
Error Reference
| Exit code | Meaning |
|---|
0 | Success |
1 | API error (check stderr for message) |
1 | No API key found — run kwery login your_api_key_here |
Links
- MCP Server — Use Kwery tools directly in Claude
- Skills — Reasoning guides for Claude workflows
- npm —
kwery-cli package