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

# Python SDK

> Install polynode 0.14 and make a first V3 request from Python.

`polynode` provides synchronous and asynchronous V3 clients plus async event, orderbook, short-form, and perps streams.

## Install

```bash theme={null}
python -m pip install --upgrade "polynode>=0.14.1,<0.15"
```

Python 3.10 or newer is required. Keep your API key outside source control:

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

## First request

```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)
```

Use `AsyncPolyNode` in an async application:

```python theme={null}
import asyncio
import os
from polynode import AsyncPolyNode

async def main() -> None:
    async with AsyncPolyNode(api_key=os.environ["POLYNODE_API_KEY"]) as pn:
        stats = await pn.v3.execute("GET /v3/stats")
        print(stats)

asyncio.run(main())
```

## Client surfaces

| Entry point             | Use it for                                                             |
| ----------------------- | ---------------------------------------------------------------------- |
| `pn.v3`                 | Complete V3 API registry                                               |
| `pn.ws`                 | Settlements, confirmations, Chainlink prices, combos, and other events |
| `pn.orderbook`          | Raw orderbook messages                                                 |
| `OrderbookEngine(...)`  | Managed local books and PN1 integrity                                  |
| `pn.perps`              | Managed V3 perps WebSocket                                             |
| `pn.ws.short_form(...)` | Rotating 5m, 15m, 1h, and 4h crypto markets                            |
| `PolyNodeTrader(...)`   | Current V2 order and position operations                               |

<CardGroup cols={2}>
  <Card title="V3 API" icon="database" href="/sdks/python/v3-api">Call any registered V3 operation.</Card>
  <Card title="Settlement stream" icon="bolt" href="/sdks/python/websocket">Subscribe with replay and overflow visibility.</Card>
  <Card title="Short-form and TWAP" icon="clock" href="/sdks/python/short-form">Rotate with the correct Chainlink window.</Card>
  <Card title="PN1 orderbook" icon="book-open" href="/sdks/python/orderbook">Maintain fail-closed local state.</Card>
  <Card title="Perps stream" icon="chart-line" href="/sdks/python/perps">Subscribe to tickers, books, trades, and klines.</Card>
  <Card title="Trading and fees" icon="arrow-right-arrow-left" href="/sdks/python/trading">Use the current V2 defaults safely.</Card>
  <Card title="Connect Wallet to order" icon="browser" href="/sdks/user-owned-web-app">Use Python behind a browser-signing flow.</Card>
</CardGroup>
