> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polynode.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

> Bloomberg terminal for prediction markets. Real-time TUI dashboards and JSON output for agents.

The PolyNode CLI (`pn`) gives you instant access to every PolyNode feature from the terminal. Watch live settlements scroll by, view full-depth orderbooks with bid/ask visualization, track short-form crypto markets with countdown timers, and monitor Chainlink price feeds. Every command also supports `--json` for programmatic use by agents and scripts.

## Install

```bash theme={null}
# From source (requires Rust)
cargo install --git https://github.com/joinQuantish/polynode-cli
```

The binary is called `pn`.

## Authentication

The CLI resolves your API key in this order:

1. `--key` flag: `pn markets --key pn_live_...`
2. `POLYNODE_API_KEY` environment variable
3. `~/.config/polynode/key` file (auto-saved when you run `pn key create`)

```bash theme={null}
# Generate a free API key (auto-saves to ~/.config/polynode/key)
pn key create
```

## Commands

<img src="https://mintcdn.com/polynode/GlCT3esNSi9wuwtk/images/pn-help.png?fit=max&auto=format&n=GlCT3esNSi9wuwtk&q=85&s=35587fa1d263c6a64dd684cb5842d5ee" alt="pn --help" width="716" height="479" data-path="images/pn-help.png" />

| Command                       | Type     | Description                    |
| ----------------------------- | -------- | ------------------------------ |
| `pn key create [name]`        | REST     | Generate a new API key         |
| `pn status`                   | REST     | System status and metrics      |
| `pn markets [--count N]`      | REST     | Top markets by 24h volume      |
| `pn search <query>`           | REST     | Full-text market search        |
| `pn market <slug-or-id>`      | REST     | Single market detail           |
| `pn stream [type]`            | Live TUI | Scrolling real-time event feed |
| `pn orderbook <slug-or-id>`   | Live TUI | Full-screen bid/ask depth view |
| `pn short-form <5m\|15m\|1h>` | Live TUI | Multi-coin crypto dashboard    |
| `pn chainlink`                | Live TUI | Live Chainlink price feeds     |

Every command supports `--json` for machine-readable output.

***

## Static Commands

### Markets

View the top markets by 24h trading volume.

```bash theme={null}
pn markets --count 10
```

<img src="https://mintcdn.com/polynode/GlCT3esNSi9wuwtk/images/pn-markets.png?fit=max&auto=format&n=GlCT3esNSi9wuwtk&q=85&s=3c55f696f8589a0eef010e05032fb2ed" alt="pn markets" width="716" height="366" data-path="images/pn-markets.png" />

### Search

Full-text search across all market questions.

```bash theme={null}
pn search "bitcoin"
```

<img src="https://mintcdn.com/polynode/GlCT3esNSi9wuwtk/images/pn-search.png?fit=max&auto=format&n=GlCT3esNSi9wuwtk&q=85&s=cd69dd169fa26d6ebbf902f85513b66a" alt="pn search bitcoin" width="716" height="554" data-path="images/pn-search.png" />

### Status

System health, connection count, and state metrics.

```bash theme={null}
pn status
```

<img src="https://mintcdn.com/polynode/GlCT3esNSi9wuwtk/images/pn-status.png?fit=max&auto=format&n=GlCT3esNSi9wuwtk&q=85&s=cd457f79f8745ff6a0b63fadd4b8e63b" alt="pn status" width="716" height="385" data-path="images/pn-status.png" />

### Market Detail

Look up a single market by slug or token ID.

```bash theme={null}
pn market will-bitcoin-reach-150k-in-march-2026
```

***

## Live TUI Commands

Live commands open a full-screen terminal UI that updates in real-time. Press `q` or `Esc` to exit.

### Stream

Watch every settlement, trade, block, or oracle event as it happens.

```bash theme={null}
# All settlements
pn stream settlements

# Large trades only (> $100)
pn stream settlements --min-size 100

# Filter by wallet
pn stream settlements --wallets 0xabc...

# Other event types
pn stream trades
pn stream blocks
pn stream oracle
pn stream global
```

<img src="https://mintcdn.com/polynode/GlCT3esNSi9wuwtk/images/pn-stream.png?fit=max&auto=format&n=GlCT3esNSi9wuwtk&q=85&s=01bc416c9a2859b0012768dff9f06687" alt="pn stream settlements" width="716" height="666" data-path="images/pn-stream.png" />

Events are color-coded: yellow for pending, green for confirmed. The header shows event count and throughput rate.

### Orderbook

Full-depth live orderbook with proportional bid/ask bars. Green bars show bid depth growing left, red bars show ask depth growing right.

```bash theme={null}
pn orderbook btc-updown-5m-1774077000
pn orderbook will-bitcoin-reach-150k-in-march-2026
```

<img src="https://mintcdn.com/polynode/GlCT3esNSi9wuwtk/images/pn-orderbook.png?fit=max&auto=format&n=GlCT3esNSi9wuwtk&q=85&s=e8eed2181802812c0f692093d03c45f4" alt="pn orderbook" width="716" height="685" data-path="images/pn-orderbook.png" />

Use arrow keys to scroll deeper into the book. The footer shows midpoint, spread, total updates, and update rate.

### Short-Form Dashboard

Multi-coin dashboard for Polymarket's short-form crypto markets. Shows all 7 coins (BTC, ETH, SOL, XRP, DOGE, HYPE, BNB) with beat price, direction, odds, liquidity, volume, and a countdown timer. Auto-rotates to the next window when the current one expires.

```bash theme={null}
# 5-minute windows
pn short-form 5m

# 15-minute, specific coins
pn short-form 15m --coins btc,eth,sol

# Hourly
pn short-form 1h
```

<img src="https://mintcdn.com/polynode/GlCT3esNSi9wuwtk/images/pn-shortform.png?fit=max&auto=format&n=GlCT3esNSi9wuwtk&q=85&s=23caa11dfbbb9c5a824c6949aef0ad11" alt="pn short-form 5m" width="716" height="666" data-path="images/pn-shortform.png" />

### Chainlink Price Feeds

Live Chainlink data stream prices with bid/ask.

```bash theme={null}
pn chainlink
```

<img src="https://mintcdn.com/polynode/GlCT3esNSi9wuwtk/images/pn-chainlink.png?fit=max&auto=format&n=GlCT3esNSi9wuwtk&q=85&s=21af81b75f5bbd57c336564f39964430" alt="pn chainlink" width="716" height="685" data-path="images/pn-chainlink.png" />

***

## JSON Mode (for Agents)

Every command supports `--json` for programmatic use. Static commands output pretty-printed JSON. Streaming commands output newline-delimited JSON (NDJSON), one object per line, with no TUI.

```bash theme={null}
# Static: pretty JSON
pn markets --count 5 --json

# Streaming: NDJSON (one event per line, no TUI)
pn stream settlements --json

# Pipe to jq
pn stream settlements --json | jq '.taker_size'

# Orderbook snapshots as JSON
pn orderbook btc-updown-5m-1774077000 --json
```

This makes `pn` composable with standard Unix tools and usable as a data source for automated trading agents.

***

## Key Bindings (TUI)

| Key           | Action                      |
| ------------- | --------------------------- |
| `q` / `Esc`   | Quit                        |
| `Ctrl-C`      | Quit                        |
| `Up` / `Down` | Scroll orderbook depth      |
| `Home`        | Reset scroll to top of book |
