polyte-clob
Rust client library for Polymarket CLOB (Central Limit Order Book) API.
The CLOB API enables trading operations on Polymarket, including order creation, signing, posting, and account management.
More information about this crate can be found in the crate documentation.
Features
- Account Management: Check balances, allowances, and trade history
- Order Management: List and cancel orders
- Market Data: Get order books, prices, and market information
Installation
cargo add polyte-clob
Usage
Setup
use ;
async
Account Configuration
The Account abstraction provides multiple ways to load credentials:
use ;
// Option 1: From environment variables
// Reads: POLYMARKET_PRIVATE_KEY, POLYMARKET_API_KEY,
// POLYMARKET_API_SECRET, POLYMARKET_API_PASSPHRASE
let account = from_env?;
// Option 2: From a JSON file
let account = from_file?;
// Option 3: Direct construction
let credentials = Credentials ;
let account = new?;
Place an Order
use ;
let params = CreateOrderParams ;
// Single method to create, sign, and post order
let response = clob.place_order.await?;
if response.success else
License
This project is licensed under the MIT License.