Metadata-Version: 2.4
Name: polynode
Version: 0.7.1
Summary: Python SDK for the PolyNode real-time prediction market data platform
Project-URL: Homepage, https://polynode.dev
Project-URL: Documentation, https://docs.polynode.dev
Author-email: PolyNode <josh@quantish.live>
License: MIT
Keywords: polymarket,polynode,prediction-markets,trading,websocket
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic>=2.0
Requires-Dist: websockets>=12.0
Provides-Extra: all
Requires-Dist: aiosqlite>=0.20; extra == 'all'
Requires-Dist: eth-account>=0.13; extra == 'all'
Requires-Dist: web3>=7.0; extra == 'all'
Provides-Extra: cache
Requires-Dist: aiosqlite>=0.20; extra == 'cache'
Provides-Extra: trading
Requires-Dist: eth-account>=0.13; extra == 'trading'
Requires-Dist: web3>=7.0; extra == 'trading'
Description-Content-Type: text/markdown

# polynode

Python SDK for the [PolyNode](https://polynode.dev) real-time prediction market data platform.

## Install

```bash
pip install polynode
```

For trading support:
```bash
pip install polynode[trading]
```

## Quick Start

### REST API

```python
from polynode import PolyNode

with PolyNode(api_key="pn_live_...") as pn:
    status = pn.status()
    markets = pn.markets(count=10)
    settlements = pn.recent_settlements(count=5)
```

### Async REST

```python
import asyncio
from polynode import AsyncPolyNode

async def main():
    async with AsyncPolyNode(api_key="pn_live_...") as pn:
        status = await pn.status()
        markets = await pn.markets(count=10)

asyncio.run(main())
```

### WebSocket Streaming

```python
import asyncio
from polynode import AsyncPolyNode

async def main():
    async with AsyncPolyNode(api_key="pn_live_...") as pn:
        sub = await pn.ws.subscribe("settlements").min_size(1000).send()

        async for event in sub:
            print(event.event_type, event.market_title, event.taker_price)

asyncio.run(main())
```

### Orderbook

```python
import asyncio
from polynode import OrderbookEngine

async def main():
    engine = OrderbookEngine(api_key="pn_live_...")
    await engine.subscribe(["token_id_1", "token_id_2"])

    engine.on("ready", lambda: print(f"Tracking {engine.size} books"))
    engine.on("update", lambda u: print(f"{u.asset_id}: {engine.midpoint(u.asset_id)}"))

asyncio.run(main())
```

### Trading

```python
import asyncio
from polynode.trading import PolyNodeTrader, TraderConfig, OrderParams

async def main():
    trader = PolyNodeTrader(TraderConfig(polynode_key="pn_live_..."))
    status = await trader.ensure_ready("0xYourPrivateKey...")

    result = await trader.order(OrderParams(
        token_id="...",
        side="BUY",
        price=0.55,
        size=100,
    ))
    print(result)

    trader.close()

asyncio.run(main())
```

## Documentation

Full docs at [docs.polynode.dev](https://docs.polynode.dev)
