polymarket-us
Unofficial Rust SDK for the Polymarket US Retail API.
Features
- Ed25519 request signing for
X-PM-*auth headers. - Typed async REST client for markets, orders, portfolio, and account endpoints.
- Builder-based configuration for base URLs, timeouts, and custom
reqwest::Client. - Error mapping for common HTTP status classes.
Installation
This crate is currently easiest to consume from source or git:
[]
= { = "../polymarket-us" }
= { = "1", = ["macros", "rt-multi-thread"] }
Or via git:
[]
= { = "https://github.com/mbordash/DRADIS", = "polymarket-us" }
= { = "1", = ["macros", "rt-multi-thread"] }
Authentication
Authenticated endpoints require:
POLYMARKET_US_KEY_IDPOLYMARKET_US_SECRET_KEY
POLYMARKET_US_SECRET_KEY must be Base64 that decodes to either:
- 64 bytes (keypair format, first 32 bytes are used as signing seed), or
- 32 bytes (raw Ed25519 seed).
Example:
Quick start
use ;
async
Advanced market queries
Use markets_list() for the default market feed. Use markets_list_with_query(...) when you need filters, cursors, or pagination parameters.
use PolymarketUsClient;
use Serialize;
async
If your account tier requires authenticated market access for some filters, use markets_list_authenticated_with_query(...) with the same query struct.
Endpoint coverage
Public:
healthmarkets_listmarkets_list_authenticatedmarkets_list_with_querymarkets_list_authenticated_with_query
Account / portfolio:
account_balancesportfolio_positionsportfolio_activities
Trading / orders:
place_orderplace_batched_orderscancel_trading_orderorders_createorders_openorder_retrieveorder_cancelorder_modifyorders_cancel_allorder_previeworder_close_position
Configuration
use ;
use Duration;
Error handling
use ;
async
Roadmap
- WebSocket support for real-time market data subscriptions.
- WebSocket user streams for order/fill updates.
- Reconnect and backoff helpers for long-running stream consumers.
Acknowledgements
Initial implementation originated in the DRADIS project and was extracted into this crate.
- Project link:
https://github.com/mbordash/DRADIS - Attribution is kept for provenance and maintenance history.