{"id":33314093,"url":"https://github.com/pawsengineer/polymarket-rs","last_synced_at":"2026-03-09T01:31:50.313Z","repository":{"id":323778718,"uuid":"1094654986","full_name":"pawsengineer/polymarket-rs","owner":"pawsengineer","description":"A modern, type-safe Rust client library for the Polymarket CLOB (Central Limit Order Book) and Data API.","archived":false,"fork":false,"pushed_at":"2025-12-31T04:18:57.000Z","size":129,"stargazers_count":27,"open_issues_count":2,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-01-04T05:52:47.905Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pawsengineer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-12T02:05:05.000Z","updated_at":"2026-01-03T06:12:17.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pawsengineer/polymarket-rs","commit_stats":null,"previous_names":["pawsengineer/polymarket-rs"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/pawsengineer/polymarket-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawsengineer%2Fpolymarket-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawsengineer%2Fpolymarket-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawsengineer%2Fpolymarket-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawsengineer%2Fpolymarket-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pawsengineer","download_url":"https://codeload.github.com/pawsengineer/polymarket-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawsengineer%2Fpolymarket-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30279777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T20:45:49.896Z","status":"ssl_error","status_checked_at":"2026-03-08T20:45:49.525Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-11-19T12:00:25.197Z","updated_at":"2026-03-09T01:31:50.280Z","avatar_url":"https://github.com/pawsengineer.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# polymarket-rs\n\n[![Rust](https://img.shields.io/badge/rust-1.70%2B-blue.svg)](https://www.rust-lang.org)\n[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](LICENSE)\n\n\u003e [!NOTE]\n\u003e This library is under active development and considered alpha quality.\n\u003e\n\u003e - Breaking changes may occur in future updates without prior notice\n\u003e - API signatures, types, and module structures are subject to change\n\u003e - Not recommended for production use yet\n\u003e - Use at your own risk\n\nA modern, type-safe Rust client library for the [Polymarket](https://polymarket.com) CLOB (Central Limit Order Book) and Data API.\n\nThis project is a complete rewrite of [polymarket-rs-client](https://github.com/TechieBoy/polymarket-rs-client) with improved ergonomics, additional API methods, and removal of generic type parameters for a cleaner API surface.\n\n## Features\n\n- **Full Authentication Support** - L1 (EIP-712) and L2 (HMAC) authentication\n- **WebSocket Streaming** - Real-time market data and user events with automatic reconnection\n- **Builder Pattern** - Fluent APIs for configuration and order creation\n- **Async/Await** - Built on `tokio` for high-performance async operations\n- **Decimal Precision** - Accurate financial calculations with `rust_decimal`\n- **Modular Design** - Separated clients for different operations\n- **Zero Panics** - Comprehensive error handling with custom `Result` types\n\n## Installation\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\npolymarket-rs = { git = \"https://github.com/pawsengineer/polymarket-rs.git\" }\n```\n\n## Quick Start\n\n### Client Types\n\n| Client                | Purpose                                     | Authentication            |\n| --------------------- | ------------------------------------------- | ------------------------- |\n| `ClobClient`          | CLOB market data queries                    | None                      |\n| `AuthenticatedClient` | API key management, account operations      | L1 (EIP-712) or L2 (HMAC) |\n| `TradingClient`       | Order creation, cancellation, trade queries | L2 (HMAC)                 |\n| `DataClient`          | Position and portfolio data                 | None                      |\n\n### Public Market Data\n\nQuery market data without authentication:\n\n```rust\nuse polymarket_rs::{ClobClient, TokenId};\n\nlet client = ClobClient::new(\"https://clob.polymarket.com\");\nlet token_id = TokenId::new(\"...\");\n\n// Get midpoint price, order books, spreads, etc.\nlet midpoint = client.get_midpoint(\u0026token_id).await?;\nlet book = client.get_order_book(\u0026token_id).await?;\n```\n\nSee [`examples/clob_data.rs`](examples/clob_data.rs) and [`examples/public_data.rs`](examples/public_data.rs) for complete examples.\n\n### Authenticated Trading\n\nThree-step process for authenticated trading:\n\n```rust\nuse polymarket_rs::{AuthenticatedClient, TradingClient, OrderBuilder, SignatureType};\n\n// 1. Create or derive API credentials\nlet auth_client = AuthenticatedClient::new(host, signer.clone(), chain_id, None, None);\nlet api_creds = auth_client.create_or_derive_api_key().await?;\n\n// 2. Create trading client with order builder\nlet order_builder = OrderBuilder::new(signer.clone(), Some(SignatureType::Eoa), None);\nlet trading_client = TradingClient::new(host, signer, chain_id, api_creds, order_builder);\n\n// 3. Create and post orders\nlet order_args = OrderArgs::new(token_id, price, size, Side::Buy);\ntrading_client.create_and_post_order(\u0026order_args, None, None, options, OrderType::Gtc).await?;\n```\n\n**PolyProxy \u0026 PolyGnosisSafe Wallets**: For proxy wallets, pass the proxy address to `AuthenticatedClient` and use `SignatureType::PolyGnosisSafe` in `OrderBuilder`. Proxy wallets have automatic allowance management.\n\nSee [`examples/authenticated_trading.rs`](examples/authenticated_trading.rs) for complete examples including proxy wallet setup.\n\n## WebSocket Streaming\n\nReal-time market data and user events with automatic reconnection:\n\n```rust\nuse polymarket_rs::websocket::{MarketWsClient, ReconnectingStream, ReconnectConfig};\nuse futures_util::StreamExt;\n\nlet client = MarketWsClient::new();\nlet config = ReconnectConfig::default();\n\nlet mut stream = ReconnectingStream::new(config, move || {\n    client.subscribe(token_ids.clone())\n});\n\nwhile let Some(result) = stream.next().await {\n    // Process market events\n}\n```\n\nSee [`examples/websocket_market.rs`](examples/websocket_market.rs) and [`examples/websocket_user.rs`](examples/websocket_user.rs) for complete streaming examples.\n\n## Examples\n\nRun examples from the [`examples/`](examples/) directory:\n\n```bash\n# Public market data\ncargo run --example clob_data\ncargo run --example public_data\n\n# Authenticated trading\nPRIVATE_KEY=\"0x...\" cargo run --example authenticated_trading\n\n# WebSocket streaming\ncargo run --example websocket_market\nPRIVATE_KEY=\"0x...\" cargo run --example websocket_user\n```\n\n## License\n\nLicensed under either of:\n\n- MIT license ([LICENSE-MIT](http://opensource.org/licenses/MIT))\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Disclaimer\n\nThis is an unofficial library and is not affiliated with Polymarket. Use at your own risk. Always test with small amounts first on testnet before using real funds.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpawsengineer%2Fpolymarket-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpawsengineer%2Fpolymarket-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpawsengineer%2Fpolymarket-rs/lists"}