Metadata-Version: 2.4
Name: rtpr
Version: 0.1.0
Summary: Official Python SDK for RTPR — real-time press releases in under 500ms
Project-URL: Homepage, https://rtpr.io
Project-URL: Documentation, https://rtpr.io/docs
Project-URL: Repository, https://github.com/rtpr-io/rtpr-sdk
Project-URL: Issues, https://github.com/rtpr-io/rtpr-sdk/issues
Author-email: RTPR <support@rtpr.io>
License-Expression: MIT
Keywords: algorithmic-trading,api,financial-news,press-releases,real-time,rtpr,trading,websocket
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: httpx>=0.27.0
Requires-Dist: websockets>=12.0
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: respx>=0.21; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Description-Content-Type: text/markdown

# RTPR Python SDK

Official Python SDK for [RTPR](https://rtpr.io) — real-time press releases in under 500ms.

## Installation

```bash
pip install rtpr
```

## Quick Start

### REST API

```python
from rtpr import RtprClient

client = RtprClient("your_api_key")

# Get recent articles across all tickers
articles = client.get_articles(limit=10)
for article in articles:
    print(f"[{article.ticker}] {article.title}")

# Get articles for a specific ticker
aapl = client.get_articles_by_ticker("AAPL")
```

### WebSocket Streaming

```python
import asyncio
from rtpr import RtprWebSocket

ws = RtprWebSocket("your_api_key")

@ws.on_article
async def handle(article):
    print(f"[{article.ticker}] {article.title}")

asyncio.run(ws.connect(tickers=["AAPL", "TSLA"]))
```

### Async REST

```python
from rtpr import AsyncRtprClient

async with AsyncRtprClient("your_api_key") as client:
    articles = await client.get_articles(limit=10)
```

## API Reference

### `RtprClient(api_key, *, base_url, timeout)`

Synchronous REST client.

- `get_articles(limit=20)` — Recent articles across all tickers
- `get_articles_by_ticker(ticker, limit=50)` — Articles for a specific ticker
- `health()` — API health check

### `AsyncRtprClient(api_key, *, base_url, timeout)`

Async REST client with the same methods (all awaitable).

### `RtprWebSocket(api_key, *, ws_url, auto_reconnect)`

Real-time WebSocket streaming client.

- `connect(tickers)` — Connect and start streaming (blocking)
- `subscribe(tickers)` — Add tickers to subscription
- `unsubscribe(tickers)` — Remove tickers
- `stop()` — Disconnect
- `@on_article` — Decorator for article callbacks
- `@on_connect` — Decorator for connection callbacks
- `@on_error` — Decorator for error callbacks

### `Article`

Dataclass with fields: `ticker`, `title`, `author`, `created`, `article_body`, `exchange`, `article_body_html`, `id`, `tickers`.

## Requirements

- Python 3.9+
- `httpx` for REST
- `websockets` for WebSocket
