Update Polymarket documentation (2026-02-19)
- Added new documentation URLs from llms.txt index - Updated TARGET.md with 244 total documentation pages - Scraped new pages for trading, concepts, and API reference sections - Updated changelog and new index pages
This commit is contained in:
@@ -35,7 +35,7 @@ Public methods require the client to initialize with the host URL and Polygon ch
|
||||
)
|
||||
|
||||
# Ready to call public methods
|
||||
markets = await client.get_markets()
|
||||
markets = client.get_markets()
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
@@ -68,50 +68,121 @@ Get details for a single market by condition ID.
|
||||
async getMarket(conditionId: string): Promise<Market>
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
interface MarketToken {
|
||||
outcome: string;
|
||||
price: number;
|
||||
token_id: string;
|
||||
winner: boolean;
|
||||
}
|
||||
<ResponseField name="accepting_order_timestamp" type="string">
|
||||
Timestamp from which the market started accepting orders, or null if not set.
|
||||
</ResponseField>
|
||||
|
||||
interface Market {
|
||||
accepting_order_timestamp: string | null;
|
||||
accepting_orders: boolean;
|
||||
active: boolean;
|
||||
archived: boolean;
|
||||
closed: boolean;
|
||||
condition_id: string;
|
||||
description: string;
|
||||
enable_order_book: boolean;
|
||||
end_date_iso: string;
|
||||
fpmm: string;
|
||||
game_start_time: string;
|
||||
icon: string;
|
||||
image: string;
|
||||
is_50_50_outcome: boolean;
|
||||
maker_base_fee: number;
|
||||
market_slug: string;
|
||||
minimum_order_size: number;
|
||||
minimum_tick_size: number;
|
||||
neg_risk: boolean;
|
||||
neg_risk_market_id: string;
|
||||
neg_risk_request_id: string;
|
||||
notifications_enabled: boolean;
|
||||
question: string;
|
||||
question_id: string;
|
||||
rewards: {
|
||||
max_spread: number;
|
||||
min_size: number;
|
||||
rates: any | null;
|
||||
};
|
||||
seconds_delay: number;
|
||||
tags: string[];
|
||||
taker_base_fee: number;
|
||||
tokens: MarketToken[];
|
||||
}
|
||||
```
|
||||
<ResponseField name="accepting_orders" type="boolean">
|
||||
Whether the market is currently accepting orders.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="active" type="boolean">
|
||||
Whether the market is active.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="archived" type="boolean">
|
||||
Whether the market has been archived.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="closed" type="boolean">
|
||||
Whether the market is closed.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="condition_id" type="string">
|
||||
The unique condition ID for the market.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="description" type="string">
|
||||
Human-readable description of the market.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="enable_order_book" type="boolean">
|
||||
Whether the order book is enabled for this market.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="end_date_iso" type="string">
|
||||
ISO 8601 end date of the market.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="fpmm" type="string">
|
||||
Address of the Fixed Product Market Maker contract.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="game_start_time" type="string">
|
||||
Start time of the underlying game or event.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="icon" type="string">
|
||||
URL of the market icon image.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="image" type="string">
|
||||
URL of the market image.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="is_50_50_outcome" type="boolean">
|
||||
Whether the market has equal 50/50 outcomes.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="maker_base_fee" type="number">
|
||||
Base fee charged to makers in basis points.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="market_slug" type="string">
|
||||
URL-friendly slug identifier for the market.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="minimum_order_size" type="number">
|
||||
Minimum order size allowed in this market.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="minimum_tick_size" type="number">
|
||||
Minimum price increment allowed in this market.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="neg_risk" type="boolean">
|
||||
Whether the market uses negative risk (binary complementary tokens).
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="neg_risk_market_id" type="string">
|
||||
Negative risk market identifier, if applicable.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="neg_risk_request_id" type="string">
|
||||
Negative risk request identifier, if applicable.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="notifications_enabled" type="boolean">
|
||||
Whether notifications are enabled for this market.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="question" type="string">
|
||||
The market question text.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="question_id" type="string">
|
||||
Unique identifier for the market question.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="rewards" type="object">
|
||||
Object containing reward config: `max_spread` (number), `min_size` (number), `rates` (any)
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="seconds_delay" type="number">
|
||||
Delay in seconds before orders are processed.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="tags" type="string[]">
|
||||
List of tags associated with the market.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="taker_base_fee" type="number">
|
||||
Base fee charged to takers in basis points.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="tokens" type="MarketToken[]">
|
||||
Array of market tokens, each containing `outcome` (string), `price` (number), `token_id` (string), and `winner` (boolean).
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
@@ -123,56 +194,17 @@ Get details for multiple markets paginated.
|
||||
async getMarkets(): Promise<PaginationPayload>
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
interface PaginationPayload {
|
||||
limit: number;
|
||||
count: number;
|
||||
data: Market[];
|
||||
}
|
||||
<ResponseField name="limit" type="number">
|
||||
Maximum number of results per page.
|
||||
</ResponseField>
|
||||
|
||||
interface Market {
|
||||
accepting_order_timestamp: string | null;
|
||||
accepting_orders: boolean;
|
||||
active: boolean;
|
||||
archived: boolean;
|
||||
closed: boolean;
|
||||
condition_id: string;
|
||||
description: string;
|
||||
enable_order_book: boolean;
|
||||
end_date_iso: string;
|
||||
fpmm: string;
|
||||
game_start_time: string;
|
||||
icon: string;
|
||||
image: string;
|
||||
is_50_50_outcome: boolean;
|
||||
maker_base_fee: number;
|
||||
market_slug: string;
|
||||
minimum_order_size: number;
|
||||
minimum_tick_size: number;
|
||||
neg_risk: boolean;
|
||||
neg_risk_market_id: string;
|
||||
neg_risk_request_id: string;
|
||||
notifications_enabled: boolean;
|
||||
question: string;
|
||||
question_id: string;
|
||||
rewards: {
|
||||
max_spread: number;
|
||||
min_size: number;
|
||||
rates: any | null;
|
||||
};
|
||||
seconds_delay: number;
|
||||
tags: string[];
|
||||
taker_base_fee: number;
|
||||
tokens: MarketToken[];
|
||||
}
|
||||
<ResponseField name="count" type="number">
|
||||
Total number of markets returned.
|
||||
</ResponseField>
|
||||
|
||||
interface MarketToken {
|
||||
outcome: string;
|
||||
price: number;
|
||||
token_id: string;
|
||||
winner: boolean;
|
||||
}
|
||||
```
|
||||
<ResponseField name="data" type="Market[]">
|
||||
Array of Market objects. See `getMarket()` for the full Market structure.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
@@ -184,129 +216,38 @@ Get simplified market data paginated for faster loading.
|
||||
async getSimplifiedMarkets(): Promise<PaginationPayload>
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
interface PaginationPayload {
|
||||
limit: number;
|
||||
count: number;
|
||||
data: SimplifiedMarket[];
|
||||
}
|
||||
<ResponseField name="limit" type="number">
|
||||
Maximum number of results per page.
|
||||
</ResponseField>
|
||||
|
||||
interface SimplifiedMarket {
|
||||
accepting_orders: boolean;
|
||||
active: boolean;
|
||||
archived: boolean;
|
||||
closed: boolean;
|
||||
condition_id: string;
|
||||
rewards: {
|
||||
rates: any | null;
|
||||
min_size: number;
|
||||
max_spread: number;
|
||||
};
|
||||
tokens: SimplifiedToken[];
|
||||
}
|
||||
<ResponseField name="count" type="number">
|
||||
Total number of markets returned.
|
||||
</ResponseField>
|
||||
|
||||
interface SimplifiedToken {
|
||||
outcome: string;
|
||||
price: number;
|
||||
token_id: string;
|
||||
}
|
||||
```
|
||||
<ResponseField name="data" type="SimplifiedMarket[]">
|
||||
Array of simplified market objects, each containing `accepting_orders` (boolean), `active` (boolean), `archived` (boolean), `closed` (boolean), `condition_id` (string), `rewards` (object with `rates`, `min_size`, `max_spread`), and `tokens` (SimplifiedToken\[]) with `outcome` (string), `price` (number), `token_id` (string).
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
### getSamplingMarkets()
|
||||
|
||||
Get markets eligible for sampling/liquidity rewards.
|
||||
|
||||
```typescript Signature theme={null}
|
||||
async getSamplingMarkets(): Promise<PaginationPayload>
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
interface PaginationPayload {
|
||||
limit: number;
|
||||
count: number;
|
||||
data: Market[];
|
||||
}
|
||||
|
||||
interface Market {
|
||||
accepting_order_timestamp: string | null;
|
||||
accepting_orders: boolean;
|
||||
active: boolean;
|
||||
archived: boolean;
|
||||
closed: boolean;
|
||||
condition_id: string;
|
||||
description: string;
|
||||
enable_order_book: boolean;
|
||||
end_date_iso: string;
|
||||
fpmm: string;
|
||||
game_start_time: string;
|
||||
icon: string;
|
||||
image: string;
|
||||
is_50_50_outcome: boolean;
|
||||
maker_base_fee: number;
|
||||
market_slug: string;
|
||||
minimum_order_size: number;
|
||||
minimum_tick_size: number;
|
||||
neg_risk: boolean;
|
||||
neg_risk_market_id: string;
|
||||
neg_risk_request_id: string;
|
||||
notifications_enabled: boolean;
|
||||
question: string;
|
||||
question_id: string;
|
||||
rewards: {
|
||||
max_spread: number;
|
||||
min_size: number;
|
||||
rates: any | null;
|
||||
};
|
||||
seconds_delay: number;
|
||||
tags: string[];
|
||||
taker_base_fee: number;
|
||||
tokens: MarketToken[];
|
||||
}
|
||||
|
||||
interface MarketToken {
|
||||
outcome: string;
|
||||
price: number;
|
||||
token_id: string;
|
||||
winner: boolean;
|
||||
}
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### getSamplingSimplifiedMarkets()
|
||||
|
||||
Get simplified market data for markets eligible for sampling/liquidity rewards.
|
||||
|
||||
```typescript Signature theme={null}
|
||||
async getSamplingSimplifiedMarkets(): Promise<PaginationPayload>
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
interface PaginationPayload {
|
||||
limit: number;
|
||||
count: number;
|
||||
data: SimplifiedMarket[];
|
||||
}
|
||||
|
||||
interface SimplifiedMarket {
|
||||
accepting_orders: boolean;
|
||||
active: boolean;
|
||||
archived: boolean;
|
||||
closed: boolean;
|
||||
condition_id: string;
|
||||
rewards: {
|
||||
rates: any | null;
|
||||
min_size: number;
|
||||
max_spread: number;
|
||||
};
|
||||
tokens: SimplifiedToken[];
|
||||
}
|
||||
|
||||
interface SimplifiedToken {
|
||||
outcome: string;
|
||||
price: number;
|
||||
token_id: string;
|
||||
}
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Order Books and Prices
|
||||
@@ -315,6 +256,8 @@ interface SimplifiedToken {
|
||||
|
||||
### calculateMarketPrice()
|
||||
|
||||
Calculate the estimated price for a market order of a given size.
|
||||
|
||||
```typescript Signature theme={null}
|
||||
async calculateMarketPrice(
|
||||
tokenID: string,
|
||||
@@ -324,23 +267,25 @@ async calculateMarketPrice(
|
||||
): Promise<number>
|
||||
```
|
||||
|
||||
```typescript Params theme={null}
|
||||
enum OrderType {
|
||||
GTC = "GTC", // Good Till Cancelled
|
||||
FOK = "FOK", // Fill or Kill
|
||||
GTD = "GTD", // Good Till Date
|
||||
FAK = "FAK", // Fill and Kill
|
||||
}
|
||||
<ResponseField name="tokenID" type="string">
|
||||
The token ID to calculate the market price for.
|
||||
</ResponseField>
|
||||
|
||||
enum Side {
|
||||
BUY = "BUY",
|
||||
SELL = "SELL",
|
||||
}
|
||||
```
|
||||
<ResponseField name="side" type="Side">
|
||||
The side of the order. One of: `BUY`, `SELL`
|
||||
</ResponseField>
|
||||
|
||||
```typescript Response theme={null}
|
||||
number // calculated market price
|
||||
```
|
||||
<ResponseField name="amount" type="number">
|
||||
The size of the order to calculate price for.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="orderType" type="OrderType">
|
||||
The order type. One of: `GTC` (Good Till Cancelled), `FOK` (Fill or Kill), `GTD` (Good Till Date), `FAK` (Fill and Kill). Defaults to `FOK`.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="returns" type="number">
|
||||
The calculated estimated market price for the given order size.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
@@ -352,24 +297,41 @@ Get the order book for a specific token ID.
|
||||
async getOrderBook(tokenID: string): Promise<OrderBookSummary>
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
interface OrderBookSummary {
|
||||
market: string;
|
||||
asset_id: string;
|
||||
timestamp: string;
|
||||
bids: OrderSummary[];
|
||||
asks: OrderSummary[];
|
||||
min_order_size: string;
|
||||
tick_size: string;
|
||||
neg_risk: boolean;
|
||||
hash: string;
|
||||
}
|
||||
<ResponseField name="market" type="string">
|
||||
The market condition ID.
|
||||
</ResponseField>
|
||||
|
||||
interface OrderSummary {
|
||||
price: string;
|
||||
size: string;
|
||||
}
|
||||
```
|
||||
<ResponseField name="asset_id" type="string">
|
||||
The token/asset ID for this order book.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="timestamp" type="string">
|
||||
Timestamp of the order book snapshot.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="bids" type="OrderSummary[]">
|
||||
Array of bid entries, each with `price` (string) and `size` (string).
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="asks" type="OrderSummary[]">
|
||||
Array of ask entries, each with `price` (string) and `size` (string).
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="min_order_size" type="string">
|
||||
Minimum order size for this market.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="tick_size" type="string">
|
||||
Minimum price increment for this market.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="neg_risk" type="boolean">
|
||||
Whether the market uses negative risk.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="hash" type="string">
|
||||
Hash of the order book state.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
@@ -381,16 +343,17 @@ Get order books for multiple token IDs.
|
||||
async getOrderBooks(params: BookParams[]): Promise<OrderBookSummary[]>
|
||||
```
|
||||
|
||||
```typescript Params theme={null}
|
||||
interface BookParams {
|
||||
token_id: string;
|
||||
side: Side; // Side.BUY or Side.SELL
|
||||
}
|
||||
```
|
||||
<ResponseField name="token_id" type="string">
|
||||
The token ID to fetch the order book for.
|
||||
</ResponseField>
|
||||
|
||||
```typescript Response theme={null}
|
||||
OrderBookSummary[]
|
||||
```
|
||||
<ResponseField name="side" type="Side">
|
||||
The side of the book to query. One of: `BUY`, `SELL`
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="returns" type="OrderBookSummary[]">
|
||||
Array of OrderBookSummary objects. See `getOrderBook()` for the full structure.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
@@ -405,11 +368,9 @@ async getPrice(
|
||||
): Promise<any>
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
{
|
||||
price: string;
|
||||
}
|
||||
```
|
||||
<ResponseField name="price" type="string">
|
||||
The current best price for the requested side.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
@@ -421,23 +382,9 @@ Get the current best prices for multiple token IDs.
|
||||
async getPrices(params: BookParams[]): Promise<PricesResponse>
|
||||
```
|
||||
|
||||
```typescript Params theme={null}
|
||||
interface BookParams {
|
||||
token_id: string;
|
||||
side: Side; // Side.BUY or Side.SELL
|
||||
}
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
interface TokenPrices {
|
||||
BUY?: string;
|
||||
SELL?: string;
|
||||
}
|
||||
|
||||
type PricesResponse = {
|
||||
[tokenId: string]: TokenPrices;
|
||||
}
|
||||
```
|
||||
<ResponseField name="returns" type="PricesResponse">
|
||||
A map of token IDs to their prices. Each entry contains an optional `BUY` (string) and/or `SELL` (string) price.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
@@ -449,34 +396,23 @@ Get the midpoint price (average of best bid and best ask) for a token ID.
|
||||
async getMidpoint(tokenID: string): Promise<any>
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
{
|
||||
mid: string;
|
||||
}
|
||||
```
|
||||
<ResponseField name="mid" type="string">
|
||||
The midpoint price, calculated as the average of best bid and best ask.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
### getMidpoints()
|
||||
|
||||
Get the midpoint prices (average of best bid and best ask) for multiple token IDs.
|
||||
Get the midpoint prices for multiple token IDs.
|
||||
|
||||
```typescript Signature theme={null}
|
||||
async getMidpoints(params: BookParams[]): Promise<any>
|
||||
```
|
||||
|
||||
```typescript Params theme={null}
|
||||
interface BookParams {
|
||||
token_id: string;
|
||||
side: Side; // Side is ignored
|
||||
}
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
{
|
||||
[tokenId: string]: string;
|
||||
}
|
||||
```
|
||||
<ResponseField name="returns" type="object">
|
||||
A map of token IDs to their midpoint price strings. Each key is a token ID and its value is the midpoint price as a string.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
@@ -488,34 +424,23 @@ Get the spread (difference between best ask and best bid) for a token ID.
|
||||
async getSpread(tokenID: string): Promise<SpreadResponse>
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
interface SpreadResponse {
|
||||
spread: string;
|
||||
}
|
||||
```
|
||||
<ResponseField name="spread" type="string">
|
||||
The spread value, calculated as the difference between best ask and best bid.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
### getSpreads()
|
||||
|
||||
Get the spreads (difference between best ask and best bid) for multiple token IDs.
|
||||
Get the spreads for multiple token IDs.
|
||||
|
||||
```typescript Signature theme={null}
|
||||
async getSpreads(params: BookParams[]): Promise<SpreadsResponse>
|
||||
```
|
||||
|
||||
```typescript Params theme={null}
|
||||
interface BookParams {
|
||||
token_id: string;
|
||||
side: Side;
|
||||
}
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
type SpreadsResponse = {
|
||||
[tokenId: string]: string;
|
||||
}
|
||||
```
|
||||
<ResponseField name="returns" type="object">
|
||||
A map of token IDs to their spread strings. Each key is a token ID and its value is the spread as a string.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
@@ -527,30 +452,33 @@ Get historical price data for a token.
|
||||
async getPricesHistory(params: PriceHistoryFilterParams): Promise<MarketPrice[]>
|
||||
```
|
||||
|
||||
```typescript Params theme={null}
|
||||
interface PriceHistoryFilterParams {
|
||||
market: string; // tokenID
|
||||
startTs?: number;
|
||||
endTs?: number;
|
||||
fidelity?: number;
|
||||
interval: PriceHistoryInterval;
|
||||
}
|
||||
<ResponseField name="market" type="string">
|
||||
The token ID to fetch price history for.
|
||||
</ResponseField>
|
||||
|
||||
enum PriceHistoryInterval {
|
||||
MAX = "max",
|
||||
ONE_WEEK = "1w",
|
||||
ONE_DAY = "1d",
|
||||
SIX_HOURS = "6h",
|
||||
ONE_HOUR = "1h",
|
||||
}
|
||||
```
|
||||
<ResponseField name="startTs" type="number">
|
||||
Optional start timestamp (Unix seconds) for the price history range.
|
||||
</ResponseField>
|
||||
|
||||
```typescript Response theme={null}
|
||||
interface MarketPrice {
|
||||
t: number; // timestamp
|
||||
p: number; // price
|
||||
}
|
||||
```
|
||||
<ResponseField name="endTs" type="number">
|
||||
Optional end timestamp (Unix seconds) for the price history range.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="fidelity" type="number">
|
||||
Optional fidelity/resolution of the price history data.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="interval" type="PriceHistoryInterval">
|
||||
Time interval for the price history. One of: `max`, `1w`, `1d`, `6h`, `1h`
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="t" type="number">
|
||||
Unix timestamp of the price data point.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="p" type="number">
|
||||
Price value at the corresponding timestamp.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
@@ -566,73 +494,91 @@ Get the price of the most recent trade for a token.
|
||||
async getLastTradePrice(tokenID: string): Promise<LastTradePrice>
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
interface LastTradePrice {
|
||||
price: string;
|
||||
side: string;
|
||||
}
|
||||
```
|
||||
<ResponseField name="price" type="string">
|
||||
The price of the most recent trade.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="side" type="string">
|
||||
The side of the most recent trade.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
### getLastTradesPrices()
|
||||
|
||||
Get the price of the most recent trade for a token.
|
||||
Get the most recent trade prices for multiple tokens.
|
||||
|
||||
```typescript Signature theme={null}
|
||||
async getLastTradesPrices(params: BookParams[]): Promise<LastTradePriceWithToken[]>
|
||||
```
|
||||
|
||||
```typescript Params theme={null}
|
||||
interface BookParams {
|
||||
token_id: string;
|
||||
side: Side;
|
||||
}
|
||||
```
|
||||
<ResponseField name="price" type="string">
|
||||
The price of the most recent trade for the token.
|
||||
</ResponseField>
|
||||
|
||||
```typescript Response theme={null}
|
||||
interface LastTradePriceWithToken {
|
||||
price: string;
|
||||
side: string;
|
||||
token_id: string;
|
||||
}
|
||||
```
|
||||
<ResponseField name="side" type="string">
|
||||
The side of the most recent trade.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="token_id" type="string">
|
||||
The token ID this trade price corresponds to.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
### getMarketTradesEvents
|
||||
### getMarketTradesEvents()
|
||||
|
||||
Get recent trade events for a market.
|
||||
|
||||
```typescript Signature theme={null}
|
||||
async getMarketTradesEvents(conditionID: string): Promise<MarketTradeEvent[]>
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
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;
|
||||
}
|
||||
```
|
||||
<ResponseField name="event_type" type="string">
|
||||
The type of trade event.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="market" type="object">
|
||||
Object containing market info: `condition_id` (string), `asset_id` (string), `question` (string), `icon` (string), `slug` (string).
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="user" type="object">
|
||||
Object containing user info: `address` (string), `username` (string), `profile_picture` (string), `optimized_profile_picture` (string), `pseudonym` (string).
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="side" type="Side">
|
||||
The side of the trade. One of: `BUY`, `SELL`
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="size" type="string">
|
||||
The size of the trade.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="fee_rate_bps" type="string">
|
||||
The fee rate in basis points for the trade.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="price" type="string">
|
||||
The price at which the trade was executed.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="outcome" type="string">
|
||||
The outcome label for the traded token.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="outcome_index" type="number">
|
||||
The index of the outcome in the market.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="transaction_hash" type="string">
|
||||
The on-chain transaction hash for the trade.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="timestamp" type="string">
|
||||
The timestamp of when the trade event occurred.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
## Market Parameters
|
||||
|
||||
@@ -646,9 +592,9 @@ Get the fee rate in basis points for a token.
|
||||
async getFeeRateBps(tokenID: string): Promise<number>
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
number
|
||||
```
|
||||
<ResponseField name="returns" type="number">
|
||||
The fee rate in basis points for the specified token.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
@@ -660,9 +606,9 @@ Get the tick size (minimum price increment) for a market.
|
||||
async getTickSize(tokenID: string): Promise<TickSize>
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
type TickSize = "0.1" | "0.01" | "0.001" | "0.0001";
|
||||
```
|
||||
<ResponseField name="returns" type="string">
|
||||
The tick size for the market. One of: `0.1`, `0.01`, `0.001`, `0.0001`
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
@@ -674,9 +620,9 @@ Check if a market uses negative risk (binary complementary tokens).
|
||||
async getNegRisk(tokenID: string): Promise<boolean>
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
boolean
|
||||
```
|
||||
<ResponseField name="returns" type="boolean">
|
||||
Whether the market uses negative risk.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
@@ -690,28 +636,28 @@ Get the current server timestamp.
|
||||
async getServerTime(): Promise<number>
|
||||
```
|
||||
|
||||
```typescript Response theme={null}
|
||||
number // Unix timestamp in seconds
|
||||
```
|
||||
<ResponseField name="returns" type="number">
|
||||
Unix timestamp in seconds representing the current server time.
|
||||
</ResponseField>
|
||||
|
||||
***
|
||||
|
||||
## See Also
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="L1 Methods" icon="key" href="/developers/CLOB/clients/methods-l1">
|
||||
Private key authentication to create or derive API keys (L2 headers).
|
||||
<Card title="L1 Methods" icon="key" href="/trading/clients/l1">
|
||||
Private key authentication to create or derive API credentials.
|
||||
</Card>
|
||||
|
||||
<Card title="L2 Methods" icon="lock" href="/developers/CLOB/clients/methods-l2">
|
||||
Manage and close orders. Creating orders requires signer.
|
||||
<Card title="L2 Methods" icon="lock" href="/trading/clients/l2">
|
||||
Place orders, cancel orders, and query your trades.
|
||||
</Card>
|
||||
|
||||
<Card title="CLOB Rest API Reference" icon="hammer" href="/api-reference/orderbook/get-order-book-summary">
|
||||
Complete REST endpoint documentation
|
||||
<Card title="REST API Reference" icon="code" href="/api-reference/introduction">
|
||||
Complete REST endpoint documentation.
|
||||
</Card>
|
||||
|
||||
<Card title="Web Socket API" icon="hammer" href="/developers/CLOB/websocket/wss-overview">
|
||||
Real-time market data streaming
|
||||
<Card title="WebSocket" icon="bolt" href="/market-data/websocket/overview">
|
||||
Real-time market data streaming.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
Reference in New Issue
Block a user