| Crates.io | drm-exchange-polymarket |
| lib.rs | drm-exchange-polymarket |
| version | 0.1.3 |
| created_at | 2025-12-25 17:07:23.773699+00 |
| updated_at | 2025-12-28 08:42:30.145107+00 |
| description | Polymarket exchange implementation for dr-manhattan |
| homepage | |
| repository | https://github.com/gtg7784/dr-manhattan-rust |
| max_upload_size | |
| id | 2004752 |
| size | 214,776 |
Polymarket exchange implementation for dr-manhattan.
This crate provides a complete Polymarket integration including:
[dependencies]
drm-exchange-polymarket = "0.1"
use drm_core::Exchange;
use drm_exchange_polymarket::{Polymarket, PolymarketConfig};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Public API (no auth required)
let exchange = Polymarket::with_default_config()?;
// Fetch markets
let markets = exchange.fetch_markets(None).await?;
for market in markets.iter().take(5) {
println!("{}: {:?}", market.question, market.prices);
}
Ok(())
}
For trading operations, you need to provide your Ethereum private key:
use drm_exchange_polymarket::{Polymarket, PolymarketConfig};
let config = PolymarketConfig::new()
.with_private_key("0x...")
.with_funder("0x...");
let exchange = Polymarket::new(config)?;
exchange.init_trading().await?;
// Now you can create orders, cancel orders, etc.
use drm_exchange_polymarket::PolymarketWebSocket;
use drm_core::WebSocketClient;
let ws = PolymarketWebSocket::new();
let mut stream = ws.subscribe_orderbook("token_id").await?;
while let Some(orderbook) = stream.next().await {
println!("Bids: {:?}, Asks: {:?}", orderbook.bids, orderbook.asks);
}
| Feature | Status |
|---|---|
| Fetch markets | ✅ |
| Fetch orderbook | ✅ |
| Create orders | ✅ |
| Cancel orders | ✅ |
| Fetch positions | ✅ |
| Fetch balance | ✅ |
| WebSocket orderbook | ✅ |
This crate is part of the dr-manhattan-rust project, a Rust port of guzus/dr-manhattan.
MIT