Metadata-Version: 2.4
Name: omnibook
Version: 1.1.0
Summary: Official Python SDK for the Omnibook prediction market exchange
Project-URL: Homepage, https://omnibook.xyz
Project-URL: Documentation, https://docs.omnibook.xyz/sdk/python
Project-URL: Repository, https://github.com/OmniBook-HQ/python-sdk-v1
Project-URL: Issues, https://github.com/OmniBook-HQ/python-sdk-v1/issues
Author-email: Raeth AI <devs@omnibook.xyz>
License-Expression: MIT
License-File: LICENSE
Keywords: exchange,omnibook,prediction-markets,sdk,trading
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 :: Investment
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: websockets>=12.0
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: respx>=0.21; extra == 'dev'
Description-Content-Type: text/markdown

# Omnibook Python SDK

Official Python client for the [Omnibook](https://omnibook.xyz) prediction market
exchange. Sign up, create an API key, install this package, and trade.

```bash
pip install omnibook
```

```python
from omnibook import Client

client = Client(api_key="<alphanumeric-api-key>", api_secret="<64-char-hex-secret>")

status = client.get_exchange_status()
rounds = client.get_rounds(limit=5)
order = client.place_order(
    client_order_id="42",
    market_id=66,
    side="buy",
    outcome="yes",
    type="limit",
    tick=47,
    qty=10,
    tif="gtc",
    post_only=True,
)
```

## Prerequisites

1. Sign in at [omnibook.xyz](https://omnibook.xyz).
2. Deposit USDC (bot keys cannot withdraw).
3. Create a key under **Settings → API keys**. Copy the **API key** and **secret**
   (the secret is shown once).

Docs: [docs.omnibook.xyz/sdk/python](https://docs.omnibook.xyz/sdk/python)

## Environments

| Env | REST | WebSocket |
| --- | --- | --- |
| Production (default) | `https://api.omnibook.xyz` | `wss://api.omnibook.xyz/v1/ws` |
| Local | `http://127.0.0.1:9104` | `ws://127.0.0.1:9105/v1/ws` |

```python
client = Client(
    api_key="...",
    api_secret="...",
    base_url="http://127.0.0.1:9104",
    ws_url="ws://127.0.0.1:9105/v1/ws",
)
```

## Sync and async

```python
from omnibook import Client, AsyncClient

# Sync
with Client(api_key=..., api_secret=...) as client:
    print(client.get_balance())

# Async
async with AsyncClient(api_key=..., api_secret=...) as client:
    print(await client.get_balance())
```

## WebSocket

```python
from omnibook import Client

with Client(api_key=..., api_secret=...) as client:
    with client.websocket() as ws:
        ws.subscribe(channels=["rounds", "oracle", "user"])
        ws.subscribe(channels=["orderbook_delta", "trades"], market_ids=[66])
        for msg in ws:
            print(msg)
```

## Auth note

Every request is HMAC-SHA256 signed. Settings hands you a **64-character hex**
secret (32 raw bytes). Pass that string (or a legacy base64 secret) to
`api_secret` — the SDK hex-/base64-decodes it to the raw HMAC key for you.

## Tests

```bash
pip install -e ".[dev]"
pytest                     # unit tests (mocked)
OMNIBOOK_RUN_INTEGRATION=1 \
  OMNIBOOK_API_KEY=... \
  OMNIBOOK_API_SECRET=... \
  pytest -m integration    # live venue
```

## License

MIT
