Market Data Types
MarketPrice
Represents a price point in time for a market.
interface MarketPrice {
t: number; // timestamp
p: number; // price
}
Unix timestamp in seconds
Price at the given timestamp
Example
const pricePoint: MarketPrice = {
t: 1735689600,
p: 0.52
};
OrderBookSummary
Complete order book summary for a market.
interface OrderBookSummary {
market: string;
asset_id: string;
timestamp: string;
bids: OrderSummary[];
asks: OrderSummary[];
min_order_size: string;
tick_size: string;
neg_risk: boolean;
last_trade_price: string;
hash: string;
}
Asset/token ID for the outcome
Timestamp of the order book snapshot
Array of bid orders (buy orders)
Array of ask orders (sell orders)
Minimum order size for this market
Tick size for price increments
Whether this is a negative risk market
Price of the last executed trade
Hash of the order book state
Example
const orderBook: OrderBookSummary = {
market: "0xabc...",
asset_id: "0x123...",
timestamp: "2025-01-01T00:00:00Z",
bids: [
{ price: "0.51", size: "100" },
{ price: "0.50", size: "200" }
],
asks: [
{ price: "0.52", size: "150" },
{ price: "0.53", size: "100" }
],
min_order_size: "1",
tick_size: "0.01",
neg_risk: false,
last_trade_price: "0.52",
hash: "0xdef..."
};
OrderSummary
Price level summary in an order book.
interface OrderSummary {
price: string;
size: string;
}
Total size available at this price level
Trade
Represents a completed trade.
interface Trade {
id: string;
taker_order_id: string;
market: string;
asset_id: string;
side: Side;
size: string;
fee_rate_bps: string;
price: string;
status: string;
match_time: string;
last_update: string;
outcome: string;
bucket_index: number;
owner: string;
maker_address: string;
maker_orders: MakerOrder[];
transaction_hash: string;
trader_side: "TAKER" | "MAKER";
}
Asset/token ID being traded
Side of the trade (BUY or SELL)
Timestamp when the trade was matched
Outcome name (e.g., “Yes”, “No”)
Array of maker orders that filled this trade
Blockchain transaction hash
trader_side
'TAKER' | 'MAKER'
required
Which side the trader was on (TAKER or MAKER)
Example
const trade: Trade = {
id: "0x789...",
taker_order_id: "0x456...",
market: "0xabc...",
asset_id: "0x123...",
side: Side.BUY,
size: "50",
fee_rate_bps: "5",
price: "0.52",
status: "MATCHED",
match_time: "2025-01-01T00:00:00Z",
last_update: "2025-01-01T00:00:01Z",
outcome: "Yes",
bucket_index: 123,
owner: "0xowner...",
maker_address: "0xmaker...",
maker_orders: [],
transaction_hash: "0xtx...",
trader_side: "TAKER"
};
MarketTradeEvent
Real-time trade event with market and user information.
interface MarketTradeEvent {
event_type: string;
market: {
condition_id: string;
asset_id: string;
question: string;
icon: string;
slug: string;
};
user: {
address: string;
username: string;
profile_picture: string;
optimized_profile_picture: string;
pseudonym: string;
};
side: Side;
size: string;
fee_rate_bps: string;
price: string;
outcome: string;
outcome_index: number;
transaction_hash: string;
timestamp: string;
}
Market information including condition ID, asset ID, question, icon, and slug
User information including address, username, profile pictures, and pseudonym
Query Parameters
TradeParams
Filter parameters for querying trades.
interface TradeParams {
id?: string;
maker_address?: string;
market?: string;
asset_id?: string;
before?: string;
after?: string;
}
Filter by market condition ID
Get trades before this cursor
Get trades after this cursor
Example
const params: TradeParams = {
market: "0xabc...",
maker_address: "0x123...",
after: "cursor_123"
};
PriceHistoryFilterParams
Filter parameters for querying price history.
interface PriceHistoryFilterParams {
market?: string;
startTs?: number;
endTs?: number;
fidelity?: number;
interval?: PriceHistoryInterval;
}
enum PriceHistoryInterval {
MAX = "max",
ONE_WEEK = "1w",
ONE_DAY = "1d",
SIX_HOURS = "6h",
ONE_HOUR = "1h"
}
Start timestamp (Unix seconds)
End timestamp (Unix seconds)
Number of data points to return
Time interval for price aggregation
Example
const params: PriceHistoryFilterParams = {
market: "0xabc...",
startTs: 1735689600,
endTs: 1735776000,
interval: PriceHistoryInterval.ONE_HOUR
};
BookParams
Parameters for fetching order book by side.
interface BookParams {
token_id: string;
side: Side;
}
Order book side (BUY or SELL)
Configuration Types
TickSizes
Mapping of token IDs to their tick sizes.
interface TickSizes {
[tokenId: string]: TickSize;
}
type TickSize = "0.1" | "0.01" | "0.001" | "0.0001";
Example
const tickSizes: TickSizes = {
"0x123...": "0.01",
"0x456...": "0.001"
};
NegRisk
Mapping of token IDs to their negative risk status.
interface NegRisk {
[tokenId: string]: boolean;
}
Example
const negRisk: NegRisk = {
"0x123...": false,
"0x456...": true
};
RoundConfig
Rounding configuration for order parameters.
interface RoundConfig {
readonly price: number;
readonly size: number;
readonly amount: number;
}
Number of decimal places for price
Number of decimal places for size
Number of decimal places for amount
Enums
Chain
Supported blockchain networks.
enum Chain {
POLYGON = 137,
AMOY = 80002
}
Polygon mainnet (chain ID: 137)
Polygon Amoy testnet (chain ID: 80002)
Example
import { Chain } from "@polymarket/clob-client";
const network = Chain.POLYGON;
AssetType
Types of assets that can be traded.
enum AssetType {
COLLATERAL = "COLLATERAL",
CONDITIONAL = "CONDITIONAL"
}
Collateral token (e.g., USDC)
Conditional token (outcome tokens)
Generic pagination response wrapper.
interface PaginationPayload {
readonly limit: number;
readonly count: number;
readonly next_cursor: string;
readonly data: any[];
}
Maximum number of items per page
Number of items in the current page
Cursor for fetching the next page
Example
const response: PaginationPayload = {
limit: 50,
count: 25,
next_cursor: "cursor_abc123",
data: [/* ... */]
};