> ## 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.15.0,<0.16"
```

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 |

> [card] [V3 API](https://docs.polynode.dev/sdks/python/v3-api.md)
>
> Call any registered V3 operation.

> [card] [Settlement stream](https://docs.polynode.dev/sdks/python/websocket.md)
>
> Subscribe with replay and overflow visibility.

> [card] [Short-form and TWAP](https://docs.polynode.dev/sdks/python/short-form.md)
>
> Rotate with the correct Chainlink window.

> [card] [PN1 orderbook](https://docs.polynode.dev/sdks/python/orderbook.md)
>
> Maintain fail-closed local state.

> [card] [Perps stream](https://docs.polynode.dev/sdks/python/perps.md)
>
> Subscribe to tickers, books, trades, and klines.

> [card] [Trading and fees](https://docs.polynode.dev/sdks/python/trading.md)
>
> Use the current V2 defaults safely.

> [card] [Connect Wallet to order](https://docs.polynode.dev/sdks/user-owned-web-app.md)
>
> Use Python behind a browser-signing flow.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.