Skip to main content

Module data

Module data 

Source
Expand description

Polymarket Data API client and types.

Feature flag: data (required to use this module)

This module provides a client for interacting with the Polymarket Data API, which offers HTTP endpoints for querying user positions, trades, activity, market holders, open interest, volume data, and leaderboards.

§Overview

The Data API is a read-only HTTP API that provides access to Polymarket data. It is separate from the CLOB (Central Limit Order Book) API which handles trading.

§Available Endpoints

EndpointDescription
/Health check
/positionsGet current positions for a user
/tradesGet trades for a user or markets
/activityGet on-chain activity for a user
/holdersGet top holders for markets
/valueGet total value of a user’s positions
/closed-positionsGet closed positions for a user
/tradedGet total markets a user has traded
/oiGet open interest for markets
/live-volumeGet live volume for an event
/v1/leaderboardGet trader leaderboard rankings
/v1/builders/leaderboardGet builder leaderboard rankings
/v1/builders/volumeGet daily builder volume time-series

§Example

use polymarket_client_sdk::types::address;
use polymarket_client_sdk::data::{Client, types::request::PositionsRequest};

// Create a client with the default endpoint
let client = Client::default();

// Build a request for user positions
let request = PositionsRequest::builder()
    .user(address!("56687bf447db6ffa42ffe2204a05edaa20f55839"))
    .build();

// Fetch positions
let positions = client.positions(&request).await?;

for position in positions {
    println!("{}: {} tokens at ${:.2}",
        position.title,
        position.size,
        position.current_value
    );
}

§API Base URL

The default API endpoint is https://data-api.polymarket.com.

Re-exports§

pub use client::Client;

Modules§

client
Client for the Polymarket Data API.
types