Install
Add to yourCargo.toml:
Quick Start
REST Methods
All endpoints are async methods onPolyNodeClient:
WebSocket Streaming
Open a stream and subscribe with the builder pattern:Consuming Events
Subscription Filters
All filters from the Subscriptions & Filters page are supported:Subscription Types
Multiple Subscriptions
Subscriptions stack on the same connection:Compression
Zlib compression is enabled by default for all WebSocket connections (~50% bandwidth savings). Binary frames are transparently decompressed withflate2.
Auto-Reconnect
Enabled by default with exponential backoff:Cleanup
Local Cache
Store trades and positions in a local SQLite database. Enable thecache feature:
Configuration
Error Handling
Orderbook Streaming
The SDK includes a dedicated orderbook stream for real-time book data fromob.polynode.dev. This is a separate WebSocket connection from the event stream, with its own URL, protocol, and message format.
Connect and Subscribe
Consuming Messages
Batches are flattened automatically.next() yields individual ObMessage items:
LocalOrderbook Helper
Maintain a sorted local copy of the book:Options
Custom URL
Cleanup
OrderbookEngine
TheOrderbookEngine is a higher-level wrapper around the orderbook stream. It manages one WebSocket connection, maintains local state for all subscribed tokens, and lets you create filtered views that only deliver updates for specific token subsets.

