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

# Stream Quickstart

> Connect to the hypernode WebSocket stream in 30 seconds

## 1. Get an API key

[Sign up at polynode.dev](https://polynode.dev) to get an API key. Keys are prefixed with `pn_live_`.

If you already have a polynode account on the Growth plan (\$200/mo) or above, your existing key works on hypernode automatically.

## 2. Connect

```bash theme={null}
wscat -c "wss://hyper.polynode.dev/ws?key=pn_live_YOUR_KEY"
```

## 3. Subscribe

Send a subscribe message to start receiving events:

```json theme={null}
{"action": "subscribe", "filters": {"action_types": ["order", "fill"]}}
```

You'll immediately start receiving every new order and fill on HyperLiquid:

```json theme={null}
{"type":"order","consensus":"confirmed","asset":"BTC","user":"0x9e74a6a1...",
 "data":{"coin":"BTC","side":"B","px":"74400.0","sz":"0.20146","oid":380660788366,"tif":"Alo"}}

{"type":"fill","consensus":"confirmed","asset":"HYPE","user":"0x34827044...",
 "data":{"coin":"HYPE","side":"A","px":"22.608","sz":"442.0","dir":"Close Short","closedPnl":"0.92"}}
```

## Common subscriptions

**All orders and fills (recommended starting point):**

```json theme={null}
{"action": "subscribe", "filters": {"action_types": ["order", "fill"]}}
```

**Only BTC activity:**

```json theme={null}
{"action": "subscribe", "filters": {"assets": ["BTC"]}}
```

**Track a specific wallet across all markets:**

```json theme={null}
{"action": "subscribe", "filters": {"addresses": ["0xd071d6d6ea52f5aa34b79e47f908ee48c8215837"]}}
```

**Pre-consensus cancels only (early signal):**

```json theme={null}
{"action": "subscribe", "filters": {"action_types": ["cancel", "cancelByCloid", "batchModify"]}}
```

**Full firehose (everything, \~6,500 events/sec):**

```json theme={null}
{"action": "subscribe"}
```

## TypeScript

```typescript theme={null}
import WebSocket from "ws";

const ws = new WebSocket("wss://hyper.polynode.dev/ws?key=pn_live_YOUR_KEY");

ws.on("open", () => {
  ws.send(JSON.stringify({
    action: "subscribe",
    filters: { action_types: ["order", "fill"] }
  }));
});

ws.on("message", (raw) => {
  const event = JSON.parse(raw.toString());

  if (event.type === "fill") {
    console.log(`FILL: ${event.asset} ${event.data.side === "B" ? "BUY" : "SELL"} ${event.data.sz}@${event.data.px}`);
    console.log(`  PnL: ${event.data.closedPnl} | Fee: ${event.data.fee} ${event.data.feeToken}`);
  }

  if (event.type === "order") {
    console.log(`ORDER: ${event.asset} ${event.data.side === "B" ? "BUY" : "SELL"} ${event.data.sz}@${event.data.px} [${event.data.tif}]`);
  }
});
```

## Python

```python theme={null}
import json
import websocket

def on_message(ws, message):
    event = json.loads(message)
    if "action" in event:
        return  # subscription ack

    if event["type"] == "fill":
        d = event["data"]
        print(f"FILL: {event['asset']} {d['sz']}@{d['px']} {d['dir']} PnL={d['closedPnl']}")

    if event["type"] == "order":
        d = event["data"]
        print(f"ORDER: {event['asset']} {d['side']} {d['sz']}@{d['px']} [{d['tif']}]")

def on_open(ws):
    ws.send(json.dumps({
        "action": "subscribe",
        "filters": {"action_types": ["order", "fill"]}
    }))

ws = websocket.WebSocketApp(
    "wss://hyper.polynode.dev/ws?key=pn_live_YOUR_KEY",
    on_open=on_open,
    on_message=on_message,
)
ws.run_forever()
```

## Next steps

* [Event Format](/api/events) — all fields and event types
* [Filters](/api/filters) — narrow the stream to exactly what you need
* [Authentication](/api/authentication) — API key tiers and limits
* [Exchange API](/rest/overview) — REST endpoints for trading and market data
