> ## 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.

# Polynode SDKs

> Install an official Polynode SDK and use V3 data, settlement streams, Chainlink TWAP markets, PN1 orderbooks, and perps.

Polynode has official SDKs for TypeScript, Python, and Rust. Each SDK covers the same core product surfaces:

* the complete V3 API, including combos and perps data
* the real-time settlement stream
* the managed orderbook stream, including optional PN1 integrity checks
* the V3 perps WebSocket
* short-form crypto markets with the correct Chainlink price window

The examples in this section are tested against these published versions:

| Language             | Package                                                      | Current version | Runtime             |
| -------------------- | ------------------------------------------------------------ | --------------: | ------------------- |
| TypeScript / Node.js | [`polynode-sdk`](https://www.npmjs.com/package/polynode-sdk) |        `0.14.2` | Node.js 18+         |
| Python               | [`polynode`](https://pypi.org/project/polynode/)             |        `0.14.1` | Python 3.10+        |
| Rust                 | [`polynode`](https://crates.io/crates/polynode)              |        `0.17.1` | Tokio async runtime |

<Note>
  Use these versions or newer. Older releases do not contain the complete V3 registry, the managed perps stream, reconnect-aware settlement delivery, and PN1 orderbook integrity described here.
</Note>

## Install

<Tabs>
  <Tab title="TypeScript">
    ```bash theme={null}
    npm install polynode-sdk ws
    ```

    Both ESM `import` and CommonJS `require` are supported.
  </Tab>

  <Tab title="Python">
    ```bash theme={null}
    python -m pip install --upgrade "polynode>=0.14.1"
    ```
  </Tab>

  <Tab title="Rust">
    ```toml theme={null}
    [dependencies]
    polynode = "0.17.1"
    tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
    ```
  </Tab>
</Tabs>

Create an API key at [polynode.dev](https://polynode.dev), then keep it in a server-side environment variable:

```bash theme={null}
export POLYNODE_API_KEY="pn_live_..."
```

<Warning>
  Do not embed a Polynode API key or wallet private key in browser code, mobile bundles, source control, screenshots, or logs.
</Warning>

## First request

This reads V3 platform statistics and does not change any data.

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    import { PolyNode } from 'polynode-sdk';

    const apiKey = process.env.POLYNODE_API_KEY;
    if (!apiKey) throw new Error('Set POLYNODE_API_KEY');

    const pn = new PolyNode({ apiKey });
    const stats = await pn.v3.stats();
    console.log(stats);
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import os
    from polynode import PolyNode

    with PolyNode(api_key=os.environ["POLYNODE_API_KEY"]) as pn:
        stats = pn.v3.execute("GET /v3/stats")
        print(stats)
    ```
  </Tab>

  <Tab title="Rust">
    ```rust theme={null}
    use polynode::{PolyNodeClient, V3RequestOptions};

    #[tokio::main]
    async fn main() -> polynode::Result<()> {
        let api_key = std::env::var("POLYNODE_API_KEY")
            .expect("Set POLYNODE_API_KEY");
        let client = PolyNodeClient::new(api_key)?;
        let stats = client
            .v3()
            .execute_named("GET /v3/stats", V3RequestOptions::default())
            .await?;
        println!("{stats:#}");
        Ok(())
    }
    ```
  </Tab>
</Tabs>

## Choose a surface

<CardGroup cols={2}>
  <Card title="V3 API" icon="database" href="/sdks/v3-api">
    Query wallets, trades, positions, combos, fees, builders, webhooks, and perps through the complete 120-operation registry.
  </Card>

  <Card title="Settlement stream" icon="bolt" href="/sdks/websocket-streaming">
    Receive pending settlements and confirmation updates with typed events, filters, reconnect replay, and observable overflow.
  </Card>

  <Card title="Short-form and TWAP" icon="clock" href="/sdks/short-form">
    Follow 5-minute, 15-minute, 1-hour, and 4-hour crypto markets as their slugs and Chainlink windows rotate.
  </Card>

  <Card title="Orderbook stream" icon="layer-group" href="/sdks/orderbook">
    Consume raw books or maintain verified local state with PN1 sequence and checksum validation.
  </Card>

  <Card title="Perps stream" icon="chart-line" href="/sdks/perps">
    Stream tickers, best bid/offer, complete books, trades, statistics, and 1-minute or 1-hour candles.
  </Card>

  <Card title="Trading and fees" icon="arrow-right-arrow-left" href="/sdks/trading">
    Place current V2 orders, configure builder attribution, and understand which fee fields belong on the wire.
  </Card>

  <Card title="Connect Wallet to order" icon="browser" href="/sdks/user-owned-web-app">
    Add a secure user-owned flow with browser signing, an encrypted vault, and zero builder attribution.
  </Card>
</CardGroup>

## Core parity

| Capability                                     | TypeScript         | Python             | Rust                       |
| ---------------------------------------------- | ------------------ | ------------------ | -------------------------- |
| Complete V3 registry                           | `pn.v3.operations` | `pn.v3.operations` | `client.v3().operations()` |
| Execute any registered V3 route                | `pn.v3.execute()`  | `pn.v3.execute()`  | `execute_named()`          |
| Settlement reconnect cursor and overlap dedupe | Yes                | Yes                | Yes                        |
| Unknown additive events remain available       | Yes                | Yes                | Yes                        |
| 5m / 15m / 1h / 4h managed market rotation     | Yes                | Yes                | Yes                        |
| Explicit Chainlink 30s / 60s TWAP filters      | Yes                | Yes                | Yes                        |
| PN1 orderbook integrity                        | Yes                | Yes                | Yes                        |
| Managed V3 perps WebSocket                     | Yes                | Yes                | Yes                        |
| Current V2 trading default                     | Yes                | Yes                | Yes, `trading` feature     |

Some optional helpers are intentionally language-specific. The SQLite local cache is currently available in TypeScript and Rust; trading dependencies are optional in Python and Rust. Those differences do not affect the core surfaces above.

## Three different WebSockets

The SDKs expose separate clients because the streams have different protocols and state:

| Stream    | Use it for                                                            | SDK entry point                                                      |
| --------- | --------------------------------------------------------------------- | -------------------------------------------------------------------- |
| Events    | settlements, confirmations, wallet activity, combos, Chainlink prices | `pn.ws` / `client.stream(...)`                                       |
| Orderbook | prediction-market depth and trades                                    | `pn.orderbook`, `OrderbookEngine`, or `client.orderbook_stream(...)` |
| Perps     | perps tickers, BBO, books, trades, statistics, klines                 | `pn.perps` / `client.perps_stream()`                                 |

Do not send an event-stream subscription to the orderbook or perps socket. Each guide starts from the correct client and includes shutdown code.

## Next steps

<CardGroup cols={3}>
  <Card title="TypeScript" icon="js" href="/sdks/ts/overview">
    Node.js setup and complete examples.
  </Card>

  <Card title="Python" icon="python" href="/sdks/python/overview">
    Synchronous REST and asynchronous streams.
  </Card>

  <Card title="Rust" icon="rust" href="/sdks/rust/overview">
    Tokio clients, typed events, and feature flags.
  </Card>
</CardGroup>

If you prefer HTTP or raw WebSockets, use the [API overview](/api-reference/overview), [event WebSocket guide](/websocket/overview), [orderbook protocol](/orderbook/overview), and [perps API](/perps/overview).
