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