Skip to main content

polyoxide_data/
lib.rs

1//! # polyoxide-data
2//!
3//! Rust client library for Polymarket Data API.
4//!
5//! ## Features
6//!
7//! - User data: open/closed positions, position value, trades, activity, and markets-traded counts
8//! - Market positions (`/v1/market-positions`) and token holders
9//! - Trade history across users
10//! - Leaderboards, builder stats, open interest, and live volume
11//! - Accounting snapshots (returned as ZIP bytes)
12//! - Type-safe API with idiomatic Rust patterns
13//! - Request builder pattern for flexible, composable queries
14//!
15//! ## Example
16//!
17//! ```no_run
18//! use polyoxide_data::DataApi;
19//!
20//! #[tokio::main]
21//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
22//!     // Create a new Data API client
23//!     let data = DataApi::new()?;
24//!
25//!     // Get positions for a user with fluent builder pattern
26//!     let positions = data.user("0x1234567890123456789012345678901234567890")
27//!         .list_positions()
28//!         .limit(10)
29//!         .send()
30//!         .await?;
31//!
32//!     for position in positions {
33//!         println!("Position: {} - size: {}", position.title, position.size);
34//!     }
35//!
36//!     Ok(())
37//! }
38//! ```
39
40/// Compiles the crate README as doctests so its examples are checked by CI.
41#[cfg(doctest)]
42#[doc = include_str!("../README.md")]
43struct ReadmeDoctests;
44
45pub mod api;
46pub mod client;
47pub mod error;
48pub mod types;
49
50pub use client::{DataApi, DataApiBuilder};
51pub use error::DataApiError;