PolyEdge Rust SDK
Official Rust SDK for PolyEdge — Ultra-Low-Latency Polymarket Mempool Trade Streaming & Real-Time On-Chain Analytics API.
Engineered for Polymarket copy-trading bots, professional traders, and prediction market builders. Capture pending trades pre-block and track smart money with institutional-grade on-chain analytics.
Key Features
- 4 First-Class Namespaces: Aligned with OpenAPI 3.1:
client.streams(): Real-time SSE trade streaming, sessions & filter management.client.analytics(): Polymarket trade attribution, trader leaderboards, market settlement audit.client.account(): User profile, API keys, request telemetry, and ledger.client.subscription(): Pricing tier catalog, upgrade quotes, and promo codes.
- Async Streaming with Tokio & Reqwest:
- 45s Keep-Alive Watchdog: Native read-timeout detection automatically cleans up dead socket half-open connections.
- Atomic
Last-Event-IDResumption: Seamlessly captures buffered trades on reconnection. - Fail-Fast for Fatal Errors: Immediate non-retry bailout on HTTP 401/403/404.
- Standard Futures Stream: Implements
futures_util::Stream<Item = Result<LiveTransaction, StreamError>>.
- Pre-Block Polymarket Trade Streaming: Peered with 100+ Polygon nodes to capture pending Polymarket trades pre-block. The World's Fastest — verify yourself.
Installation
Add to Cargo.toml:
[]
= "1.1.0"
= { = "1", = ["full"] }
= "0.3"
Or via cargo add:
Quick Start
1. Initialize Client & Query Analytics
use PolyEdgeClient;
use env;
async
2. Real-Time Mempool SSE Trade Stream
use StreamExt;
use PolyEdgeClient;
use env;
async
Complete API Service Reference (28 Methods)
1. Streams Service (client.streams())
| Method | HTTP | Description |
|---|---|---|
connect(stream_id) |
GET /streams/{id} (SSE) |
Connect to ultra-low-latency real-time SSE mempool trade stream |
list().await |
GET /streams |
List all configured data streams |
create(&req).await |
POST /streams |
Provision a new targeted filter stream (tags, addresses, series) |
get(id).await |
GET /streams/{id} |
Get stream metadata and configuration by ID |
update_metadata(id, &req).await |
PUT /streams/{id}/meta |
Update stream name and description |
update_subscription(id, &req).await |
PUT /streams/{id}/subscription |
Hot-reload market filters (addresses, tags, series) on active stream |
delete(id).await |
DELETE /streams/{id} |
Delete stream by ID |
get_active_sessions().await |
GET /sessions |
List all active live SSE connections across streams |
disconnect_session(&conn_id).await |
DELETE /sessions/{id} |
Disconnect one of your active SSE connections by conn_id |
get_session_history(limit, offset).await |
GET /sessions/history |
Query historical SSE connection logs and durations |
2. Analytics Service (client.analytics())
| Method | HTTP | Description |
|---|---|---|
get_leaderboard(limit, offset).await |
GET /v2/analytics/leaderboard |
Top profitable traders ranked by realized PnL, volume, and ROI |
get_trader(address).await |
GET /v2/traders/{address} |
Comprehensive trader intelligence profile, taker tier, and top tags |
get_trader_hourly_stats(address).await |
GET /v2/traders/{address}/hourly_stats |
24-hour hourly trading PnL and volume breakdown |
get_trader_markets(addr, limit, offset).await |
GET /v2/traders/{address}/markets |
Historical market positions and settled outcomes by trader |
get_trader_market_orders(addr, id, ...).await |
GET /v2/traders/{address}/markets/{id}/orders |
Order fill details for a specific trader in a specific market |
get_market(id).await |
GET /v2/markets/{id} |
Prediction market detail, top 20 earners, and volume attribution |
get_deposits(limit, offset).await |
GET /v2/analytics/deposits |
60-day aggregated trader deposit summaries (>= 100 pUSD) |
3. Account Service (client.account())
| Method | HTTP | Description |
|---|---|---|
get_profile().await |
GET /v2/user/me |
Current user profile, active tier, and deposit balance |
list_keys().await |
GET /v2/user/keys |
List all active API keys and statuses |
create_key(&req).await |
POST /v2/user/keys |
Generate a new API key with custom name |
update_key(key, &req).await |
PATCH /v2/user/keys/{key} |
Enable, disable, or rename an API key |
delete_key(key).await |
DELETE /v2/user/keys/{key} |
Revoke and delete an API key |
get_ledger(limit, offset).await |
GET /v2/user/ledger |
Balance ledger transaction records |
get_telemetry().await |
GET /v2/user/telemetry |
Daily request count and per-endpoint usage telemetry |
4. Subscription Service (client.subscription())
| Method | HTTP | Description |
|---|---|---|
list_tiers().await |
GET /v2/tiers |
Public tier catalog, feature allowances, and pricing specifications |
get_quote(&req).await |
POST /v2/user/subscribe/quote |
Calculate quote for plan upgrade or billing cycle change |
subscribe(&req).await |
POST /v2/user/subscribe |
Purchase or upgrade tier subscription |
validate_promo_code(&req).await |
POST /v2/user/promo-codes/validate |
Validate promotional discount code |
License
MIT © 2026 PolyEdge Labs