Metadata-Version: 2.4
Name: oddspipe
Version: 0.1.0
Summary: Python client for the OddsPipe prediction market API
Home-page: https://oddspipe.com
Author: OddsPipe
Author-email: hello@oddspipe.com
License: MIT
Project-URL: Documentation, https://oddspipe.com/docs
Project-URL: Source, https://github.com/OddsPipe/oddspipe
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# OddsPipe Python SDK

Python client for the [OddsPipe](https://oddspipe.com) prediction market API.

## Install

```bash
pip install oddspipe
```

## Quick start

```python
from oddspipe import OddsPipe

client = OddsPipe(api_key="your-api-key")

# List top markets by volume
markets = client.markets(limit=10)
for m in markets["items"]:
    print(m["title"], m["spread"])

# Search for a market
results = client.search("Trump", platform="polymarket")

# Get OHLCV candlesticks
candles = client.candlesticks(market_id=123, interval="1h", limit=100)
for c in candles["candles"]:
    print(c["timestamp"], c["close"], c["volume"])

# Find cross-platform price divergences
spreads = client.spreads(min_spread=0.03)
for item in spreads["items"]:
    print(item["title"], item["spread"]["yes_diff"])

# Cross-platform spread for a single market
spread = client.spread(market_id=123)
print(spread["sources"])
print(spread["spread"])
```

## API reference

| Method | Endpoint | Description |
|--------|----------|-------------|
| `markets()` | `GET /v1/markets` | List markets with latest prices |
| `market(id)` | `GET /v1/markets/{id}` | Single market detail |
| `search(q)` | `GET /v1/markets/search` | Full-text search |
| `history(id)` | `GET /v1/markets/{id}/history` | Raw price snapshots |
| `candlesticks(id)` | `GET /v1/markets/{id}/candlesticks` | OHLCV candles (1m/5m/1h/1d) |
| `spread(id)` | `GET /v1/markets/{id}/spread` | Cross-platform spread |
| `spreads()` | `GET /v1/spreads` | Cross-platform price spreads |

## Error handling

```python
from oddspipe import OddsPipe, OddsPipeError

client = OddsPipe(api_key="your-key")
try:
    client.market(999999)
except OddsPipeError as e:
    print(e.status_code)  # 404
    print(e.body)         # {"detail": "Market not found"}
```
