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:
AI Agent
2026-02-19 14:31:02 +01:00
parent 81f77eff3c
commit b2a29fe51f
250 changed files with 33306 additions and 9659 deletions
+157 -65
View File
@@ -8,9 +8,7 @@
## Client Initialization
Builder methods require the client to initialize with a separate authentication setup using
builder configs acquired from [Polymarket.com](https://polymarket.com/settings?tab=builder)
and the `@polymarket/builder-signing-sdk` package.
Builder methods require the client to initialize with a separate builder config using credentials acquired from [Polymarket.com](https://polymarket.com/settings?tab=builder) and the `@polymarket/builder-signing-sdk` package.
<Tabs>
<Tab title="Local Builder Credentials">
@@ -31,7 +29,7 @@ and the `@polymarket/builder-signing-sdk` package.
"https://clob.polymarket.com",
137,
signer,
apiCreds, // The user's API credentials generated from L1 authentication
apiCreds, // User's API credentials from L1 authentication
signatureType,
funderAddress,
undefined,
@@ -57,7 +55,7 @@ and the `@polymarket/builder-signing-sdk` package.
host="https://clob.polymarket.com",
chain_id=137,
key=os.getenv("PRIVATE_KEY"),
creds=creds, # The user's API credentials generated from L1 authentication
creds=creds, # User's API credentials from L1 authentication
signature_type=signature_type,
funder=funder,
builder_config=builder_config
@@ -73,14 +71,14 @@ and the `@polymarket/builder-signing-sdk` package.
import { BuilderConfig } from "@polymarket/builder-signing-sdk";
const builderConfig = new BuilderConfig({
remoteBuilderConfig: {url: "http://localhost:3000/sign"}
remoteBuilderConfig: { url: "http://localhost:3000/sign" }
});
const clobClient = new ClobClient(
"https://clob.polymarket.com",
137,
signer,
apiCreds, // The user's API credentials generated from L1 authentication
apiCreds, // User's API credentials from L1 authentication
signatureType,
funder,
undefined,
@@ -89,7 +87,7 @@ and the `@polymarket/builder-signing-sdk` package.
);
```
```typescript Python theme={null}
```python Python theme={null}
from py_clob_client.client import ClobClient
from py_builder_signing_sdk.config import BuilderConfig, RemoteBuilderConfig
import os
@@ -104,7 +102,7 @@ and the `@polymarket/builder-signing-sdk` package.
host="https://clob.polymarket.com",
chain_id=137,
key=os.getenv("PRIVATE_KEY"),
creds=creds, # The user's API credentials generated from L1 authentication
creds=creds, # User's API credentials from L1 authentication
signature_type=signature_type,
funder=funder,
builder_config=builder_config
@@ -115,7 +113,7 @@ and the `@polymarket/builder-signing-sdk` package.
</Tabs>
<Info>
[More information on builder signing](/developers/builders/order-attribution)
See [Order Attribution](/trading/orders/attribution) for more information on builder signing.
</Info>
***
@@ -126,8 +124,7 @@ and the `@polymarket/builder-signing-sdk` package.
### getBuilderTrades()
Retrieves all trades attributed to your builder account.
This method allows builders to track which trades were routed through your platform.
Retrieves all trades attributed to your builder account. Use this to track which trades were routed through your platform.
```typescript Signature theme={null}
async getBuilderTrades(
@@ -135,81 +132,176 @@ async getBuilderTrades(
): Promise<BuilderTradesPaginatedResponse>
```
```typescript Params theme={null}
interface TradeParams {
id?: string;
maker_address?: string;
market?: string;
asset_id?: string;
before?: string;
after?: string;
}
```
**Params (`TradeParams`)**
```typescript Response theme={null}
interface BuilderTradesPaginatedResponse {
trades: BuilderTrade[];
next_cursor: string;
limit: number;
count: number;
}
<ResponseField name="id" type="string">
Optional. Filter trades by trade ID.
</ResponseField>
interface BuilderTrade {
id: string;
tradeType: string;
takerOrderHash: string;
builder: string;
market: string;
assetId: string;
side: string;
size: string;
sizeUsdc: string;
price: string;
status: string;
outcome: string;
outcomeIndex: number;
owner: string;
maker: string;
transactionHash: string;
matchTime: string;
bucketIndex: number;
fee: string;
feeUsdc: string;
err_msg?: string | null;
createdAt: string | null;
updatedAt: string | null;
}
```
<ResponseField name="maker_address" type="string">
Optional. Filter trades by maker address.
</ResponseField>
<ResponseField name="market" type="string">
Optional. Filter trades by market condition ID.
</ResponseField>
<ResponseField name="asset_id" type="string">
Optional. Filter trades by asset (token) ID.
</ResponseField>
<ResponseField name="before" type="string">
Optional. Return trades created before this cursor value.
</ResponseField>
<ResponseField name="after" type="string">
Optional. Return trades created after this cursor value.
</ResponseField>
**Response (`BuilderTradesPaginatedResponse`)**
<ResponseField name="trades" type="BuilderTrade[]">
Array of trades attributed to the builder account.
</ResponseField>
<ResponseField name="next_cursor" type="string">
Cursor string for fetching the next page of results.
</ResponseField>
<ResponseField name="limit" type="number">
Maximum number of trades returned per page.
</ResponseField>
<ResponseField name="count" type="number">
Total number of trades returned in this response.
</ResponseField>
**`BuilderTrade` fields**
<ResponseField name="id" type="string">
Unique identifier for the trade.
</ResponseField>
<ResponseField name="tradeType" type="string">
Type of the trade.
</ResponseField>
<ResponseField name="takerOrderHash" type="string">
Hash of the taker order associated with this trade.
</ResponseField>
<ResponseField name="builder" type="string">
Address of the builder who attributed this trade.
</ResponseField>
<ResponseField name="market" type="string">
Condition ID of the market this trade belongs to.
</ResponseField>
<ResponseField name="assetId" type="string">
Token ID of the asset traded.
</ResponseField>
<ResponseField name="side" type="string">
Side of the trade (e.g. BUY or SELL).
</ResponseField>
<ResponseField name="size" type="string">
Size of the trade in shares.
</ResponseField>
<ResponseField name="sizeUsdc" type="string">
Size of the trade denominated in USDC.
</ResponseField>
<ResponseField name="price" type="string">
Price at which the trade was executed.
</ResponseField>
<ResponseField name="status" type="string">
Current status of the trade.
</ResponseField>
<ResponseField name="outcome" type="string">
Outcome label associated with the traded asset.
</ResponseField>
<ResponseField name="outcomeIndex" type="number">
Index of the outcome within the market.
</ResponseField>
<ResponseField name="owner" type="string">
Address of the order owner (taker).
</ResponseField>
<ResponseField name="maker" type="string">
Address of the maker in the trade.
</ResponseField>
<ResponseField name="transactionHash" type="string">
On-chain transaction hash for the trade.
</ResponseField>
<ResponseField name="matchTime" type="string">
Timestamp when the trade was matched.
</ResponseField>
<ResponseField name="bucketIndex" type="number">
Bucket index used for trade grouping.
</ResponseField>
<ResponseField name="fee" type="string">
Fee charged for the trade in shares.
</ResponseField>
<ResponseField name="feeUsdc" type="string">
Fee charged for the trade denominated in USDC.
</ResponseField>
<ResponseField name="err_msg" type="string | null">
Optional. Error message if the trade encountered an issue, otherwise null.
</ResponseField>
<ResponseField name="createdAt" type="string | null">
Timestamp when the trade record was created, or null if unavailable.
</ResponseField>
<ResponseField name="updatedAt" type="string | null">
Timestamp when the trade record was last updated, or null if unavailable.
</ResponseField>
***
### revokeBuilderApiKey()
Revokes the builder API key used to authenticate the current request.
After revocation, the key can no longer be used to make builder-authenticated requests.
Revokes the builder API key used to authenticate the current request. After revocation, the key can no longer be used for builder-authenticated requests.
```typescript Signature theme={null}
async revokeBuilderApiKey(): Promise<any>
```
<ResponseField name="returns" type="any">
Response from the revocation request.
</ResponseField>
***
## See Also
<CardGroup cols={2}>
<Card title="Builders Program Introduction" icon="hammer" href="/developers/builders/builder-intro">
Learn the benefits, how to implement, and more.
<Card title="Builders Program" icon="hammer" href="/builders/overview">
Learn about the Builders Program and its benefits.
</Card>
<Card title="Implement Builders Signing" icon="key" href="/developers/builders/order-attribution">
Attribute orders to you, and pre-requisite to using the Relayer Client.
<Card title="Order Attribution" icon="key" href="/trading/orders/attribution">
Attribute orders to your builder account.
</Card>
<Card title="Relayer Client" icon="globe" href="/developers/builders/relayer-client">
The relayer executes other gasless transactions for your users, on your app.
<Card title="L2 Methods" icon="lock" href="/trading/clients/l2">
Place and manage orders with API credentials.
</Card>
<Card title="Full Example Implementations" icon="puzzle" href="/developers/builders/examples">
Complete Next.js examples integrated with embedded wallets (Privy, Magic, Turnkey, wagmi)
<Card title="Gasless Transactions" icon="gas-pump" href="/trading/gasless">
Execute onchain operations without paying gas.
</Card>
</CardGroup>
+227 -117
View File
@@ -43,13 +43,13 @@ L1 methods require the client to initialize with a signer.
)
# Ready to create user API credentials
api_key = await client.create_api_key()
api_key = client.create_api_key()
```
</Tab>
</Tabs>
<Warning>
**Security:** Never commit private keys to version control. Always use environment variables or secure key management systems.
Never commit private keys to version control. Always use environment variables or a secure key management system.
</Warning>
***
@@ -60,68 +60,75 @@ L1 methods require the client to initialize with a signer.
### createApiKey()
Creates a new API key (L2 credentials) for the wallet signer. This generates a new set of credentials that can be used for L2 authenticated requests.
Each wallet can only have one active API key at a time. Creating a new key invalidates the previous one.
Creates a new API key (L2 credentials) for the wallet signer. Each wallet can only have one active API key at a time — creating a new key invalidates the previous one.
```typescript Signature theme={null}
async createApiKey(nonce?: number): Promise<ApiKeyCreds>
```
```typescript Params theme={null}
`nonce` (optional): Custom nonce for deterministic key generation. If not provided, a default derivation is used.
```
<ResponseField name="nonce" type="number">
Optional custom nonce for deterministic key generation. Optional.
</ResponseField>
```typescript Response theme={null}
interface ApiKeyCreds {
apiKey: string;
secret: string;
passphrase: string;
}
```
<ResponseField name="apiKey" type="string">
The generated API key string.
</ResponseField>
<ResponseField name="secret" type="string">
The secret associated with the API key.
</ResponseField>
<ResponseField name="passphrase" type="string">
The passphrase associated with the API key.
</ResponseField>
***
### deriveApiKey()
Derives an existing API key (L2 credentials) using a specific nonce. If you've already created API credentials with a particular nonce, this method will return the same credentials again.
Derives an existing API key using a specific nonce. If you've already created credentials with a particular nonce, this returns the same credentials.
```typescript Signature theme={null}
async deriveApiKey(nonce?: number): Promise<ApiKeyCreds>
```
```typescript Params theme={null}
`nonce` (optional): Custom nonce for deterministic key generation. If not provided, a default derivation is used.
```
<ResponseField name="nonce" type="number">
The nonce used when originally creating the key. Optional.
</ResponseField>
```typescript Response theme={null}
interface ApiKeyCreds {
apiKey: string;
secret: string;
passphrase: string;
}
```
<ResponseField name="apiKey" type="string">
The derived API key string.
</ResponseField>
<ResponseField name="secret" type="string">
The secret associated with the API key.
</ResponseField>
<ResponseField name="passphrase" type="string">
The passphrase associated with the API key.
</ResponseField>
***
### createOrDeriveApiKey()
Convenience method that attempts to derive an API key with the default nonce, or creates a new one if it doesn't exist. This is the recommended method for initial setup if you're unsure if credentials already exist.
Convenience method that attempts to derive an API key with the default nonce, or creates a new one if it doesn't exist. **Recommended for initial setup.**
```typescript Signature theme={null}
async createOrDeriveApiKey(nonce?: number): Promise<ApiKeyCreds>
```
```typescript Params theme={null}
`nonce` (optional): Custom nonce for deterministic key generation. If not provided, a default derivation is used.
```
<ResponseField name="apiKey" type="string">
The API key string, either derived or newly created.
</ResponseField>
```typescript Response theme={null}
interface ApiKeyCreds {
apiKey: string;
secret: string;
passphrase: string;
}
```
<ResponseField name="secret" type="string">
The secret associated with the API key.
</ResponseField>
<ResponseField name="passphrase" type="string">
The passphrase associated with the API key.
</ResponseField>
***
@@ -129,9 +136,7 @@ interface ApiKeyCreds {
### createOrder()
Create and sign a limit order locally without posting it to the CLOB.
Use this when you want to sign orders in advance or implement custom order submission logic.
Place order via L2 methods postOrder or postOrders.
Create and sign a limit order locally without posting it to the CLOB. Use this when you want to sign orders in advance or implement custom submission logic. Submit via [`postOrder()`](/trading/clients/l2#postorder) or [`postOrders()`](/trading/clients/l2#postorders).
```typescript Signature theme={null}
async createOrder(
@@ -140,49 +145,103 @@ async createOrder(
): Promise<SignedOrder>
```
```typescript Params theme={null}
interface UserOrder {
tokenID: string;
price: number;
size: number;
side: Side;
feeRateBps?: number;
nonce?: number;
expiration?: number;
taker?: string;
}
<ResponseField name="tokenID" type="string">
The token ID of the market outcome to trade.
</ResponseField>
interface CreateOrderOptions {
tickSize: TickSize;
negRisk?: boolean;
}
```
<ResponseField name="price" type="number">
The limit price for the order.
</ResponseField>
```typescript Response theme={null}
interface SignedOrder {
salt: string;
maker: string;
signer: string;
taker: string;
tokenId: string;
makerAmount: string;
takerAmount: string;
side: number; // 0 = BUY, 1 = SELL
expiration: string;
nonce: string;
feeRateBps: string;
signatureType: number;
signature: string;
}
```
<ResponseField name="size" type="number">
The size (number of shares) for the order.
</ResponseField>
<ResponseField name="side" type="Side">
The side of the order (buy or sell).
</ResponseField>
<ResponseField name="feeRateBps" type="number">
Optional fee rate in basis points. Optional.
</ResponseField>
<ResponseField name="nonce" type="number">
Optional nonce for the order. Optional.
</ResponseField>
<ResponseField name="expiration" type="number">
Optional expiration timestamp for the order. Optional.
</ResponseField>
<ResponseField name="taker" type="string">
Optional taker address for the order. Optional.
</ResponseField>
<ResponseField name="tickSize" type="TickSize">
The tick size used for order validation (CreateOrderOptions).
</ResponseField>
<ResponseField name="negRisk" type="boolean">
Optional flag for negative risk markets (CreateOrderOptions). Optional.
</ResponseField>
<ResponseField name="salt" type="string">
A random salt value for the signed order.
</ResponseField>
<ResponseField name="maker" type="string">
The maker's address.
</ResponseField>
<ResponseField name="signer" type="string">
The signer's address.
</ResponseField>
<ResponseField name="taker" type="string">
The taker's address in the signed order.
</ResponseField>
<ResponseField name="tokenId" type="string">
The token ID in the signed order.
</ResponseField>
<ResponseField name="makerAmount" type="string">
The maker amount as a string.
</ResponseField>
<ResponseField name="takerAmount" type="string">
The taker amount as a string.
</ResponseField>
<ResponseField name="side" type="number">
The side of the order as a number (0 = BUY, 1 = SELL).
</ResponseField>
<ResponseField name="expiration" type="string">
The expiration timestamp as a string.
</ResponseField>
<ResponseField name="nonce" type="string">
The nonce as a string.
</ResponseField>
<ResponseField name="feeRateBps" type="string">
The fee rate in basis points as a string.
</ResponseField>
<ResponseField name="signatureType" type="number">
The type identifier for the signature scheme used.
</ResponseField>
<ResponseField name="signature" type="string">
The cryptographic signature of the order.
</ResponseField>
***
### createMarketOrder()
Create and sign a market order locally without posting it to the CLOB.
Use this when you want to sign orders in advance or implement custom order submission logic.
Place orders via L2 methods postOrder or postOrders.
Create and sign a market order locally without posting it to the CLOB. Submit via [`postOrder()`](/trading/clients/l2#postorder) or [`postOrders()`](/trading/clients/l2#postorders).
```typescript Signature theme={null}
async createMarketOrder(
@@ -191,36 +250,89 @@ async createMarketOrder(
): Promise<SignedOrder>
```
```typescript Params theme={null}
interface UserMarketOrder {
tokenID: string;
amount: number; // BUY: dollar amount, SELL: number of shares
side: Side;
price?: number; // Optional price limit
feeRateBps?: number;
nonce?: number;
taker?: string;
orderType?: OrderType.FOK | OrderType.FAK;
}
```
<ResponseField name="tokenID" type="string">
The token ID of the market outcome to trade.
</ResponseField>
```typescript Response theme={null}
interface SignedOrder {
salt: string;
maker: string;
signer: string;
taker: string;
tokenId: string;
makerAmount: string;
takerAmount: string;
side: number; // 0 = BUY, 1 = SELL
expiration: string;
nonce: string;
feeRateBps: string;
signatureType: number;
signature: string;
}
```
<ResponseField name="amount" type="number">
The order amount. For BUY orders this is a dollar amount; for SELL orders this is the number of shares.
</ResponseField>
<ResponseField name="side" type="Side">
The side of the order (buy or sell).
</ResponseField>
<ResponseField name="price" type="number">
Optional price limit for the market order. Optional.
</ResponseField>
<ResponseField name="feeRateBps" type="number">
Optional fee rate in basis points. Optional.
</ResponseField>
<ResponseField name="nonce" type="number">
Optional nonce for the order. Optional.
</ResponseField>
<ResponseField name="taker" type="string">
Optional taker address for the order. Optional.
</ResponseField>
<ResponseField name="orderType" type="OrderType.FOK | OrderType.FAK">
Optional order type, either FOK (Fill-Or-Kill) or FAK (Fill-And-Kill). Optional.
</ResponseField>
<ResponseField name="salt" type="string">
A random salt value for the signed order.
</ResponseField>
<ResponseField name="maker" type="string">
The maker's address.
</ResponseField>
<ResponseField name="signer" type="string">
The signer's address.
</ResponseField>
<ResponseField name="taker" type="string">
The taker's address in the signed order.
</ResponseField>
<ResponseField name="tokenId" type="string">
The token ID in the signed order.
</ResponseField>
<ResponseField name="makerAmount" type="string">
The maker amount as a string.
</ResponseField>
<ResponseField name="takerAmount" type="string">
The taker amount as a string.
</ResponseField>
<ResponseField name="side" type="number">
The side of the order as a number (0 = BUY, 1 = SELL).
</ResponseField>
<ResponseField name="expiration" type="string">
The expiration timestamp as a string.
</ResponseField>
<ResponseField name="nonce" type="string">
The nonce as a string.
</ResponseField>
<ResponseField name="feeRateBps" type="string">
The fee rate in basis points as a string.
</ResponseField>
<ResponseField name="signatureType" type="number">
The type identifier for the signature scheme used.
</ResponseField>
<ResponseField name="signature" type="string">
The cryptographic signature of the order.
</ResponseField>
***
@@ -232,7 +344,7 @@ interface SignedOrder {
**Solution:**
* Verify your private key is a valid hex string (starts with "0x")
* Verify your private key is a valid hex string (starts with `0x`)
* Ensure you're using the correct key for the intended address
* Check that the key has proper permissions
</Accordion>
@@ -249,9 +361,7 @@ interface SignedOrder {
<Accordion title="Error: Invalid Funder Address">
Your funder address is incorrect or doesn't match your wallet.
**Solution:** Check your Polymarket profile address at [polymarket.com/settings](https://polymarket.com/settings).
If it does not exist or user has never logged into Polymarket.com, deploy it first before creating L2 authentication.
**Solution:** Check your proxy wallet address at [polymarket.com/settings](https://polymarket.com/settings). If it doesn't exist, the user has never logged in to Polymarket.com — deploy the proxy wallet first before creating L2 credentials.
</Accordion>
<Accordion title="Lost API credentials but have nonce">
@@ -262,7 +372,7 @@ interface SignedOrder {
</Accordion>
<Accordion title="Lost both credentials and nonce">
Unfortunately, there's no way to recover lost API credentials without the nonce. You'll need to create new credentials:
There's no way to recover lost credentials without the nonce. Create new ones:
```typescript theme={null}
// Create fresh credentials with a new nonce
@@ -277,19 +387,19 @@ interface SignedOrder {
## See Also
<CardGroup cols={2}>
<Card title="Understand CLOB Authentication" icon="shield" href="/developers/CLOB/authentication">
Deep dive into L1 and L2 authentication
<Card title="Authentication" icon="shield" href="/api-reference/authentication">
Deep dive into L1 and L2 authentication.
</Card>
<Card title="CLOB Quickstart Guide" icon="hammer" href="/developers/CLOB/quickstart">
Initialize the CLOB quickly and place your first order.
<Card title="Trading Quickstart" icon="bolt" href="/trading/quickstart">
Initialize the client and place your first order.
</Card>
<Card title="Public Methods" icon="globe" href="/developers/CLOB/clients/methods-l2">
Access market data, orderbooks, and prices.
<Card title="Public Methods" icon="globe" href="/trading/clients/public">
Access market data, orderbooks, and prices without auth.
</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 and manage orders with API credentials.
</Card>
</CardGroup>
+454 -332
View File
@@ -4,13 +4,11 @@
# L2 Methods
> These methods require user API credentials (L2 headers). Use these for placing trades and managing user's positions.
***
> These methods require user API credentials (L2 headers). Use these for placing trades and managing your positions.
## Client Initialization
L2 methods require the client to initialize with the signer, signatureType, user API credentials, and funder.
L2 methods require the client to initialize with a signer, signature type, API credentials, and funder address.
<Tabs>
<Tab title="TypeScript">
@@ -18,7 +16,7 @@ L2 methods require the client to initialize with the signer, signatureType, user
import { ClobClient } from "@polymarket/clob-client";
import { Wallet } from "ethers";
const signer = new Wallet(process.env.PRIVATE_KEY)
const signer = new Wallet(process.env.PRIVATE_KEY);
const apiCreds = {
apiKey: process.env.API_KEY,
@@ -31,11 +29,11 @@ L2 methods require the client to initialize with the signer, signatureType, user
137,
signer,
apiCreds,
2, // Deployed Safe proxy wallet
process.env.FUNDER_ADDRESS // Address of deployed Safe proxy wallet
2, // GNOSIS_SAFE
process.env.FUNDER_ADDRESS
);
// Ready to send authenticated requests to the CLOB API!
// Ready to send authenticated requests
const order = await client.postOrder(signedOrder);
```
</Tab>
@@ -57,12 +55,12 @@ L2 methods require the client to initialize with the signer, signatureType, user
chain_id=137,
key=os.getenv("PRIVATE_KEY"),
creds=api_creds,
signature_type=2, # Deployed Safe proxy wallet
funder=os.getenv("FUNDER_ADDRESS") # Address of deployed Safe proxy wallet
signature_type=2, # GNOSIS_SAFE
funder=os.getenv("FUNDER_ADDRESS")
)
# Ready to send authenticated requests to the CLOB API!
order = await client.post_order(signed_order)
# Ready to send authenticated requests
order = client.post_order(signed_order)
```
</Tab>
</Tabs>
@@ -75,8 +73,7 @@ L2 methods require the client to initialize with the signer, signatureType, user
### createAndPostOrder()
A convenience method that creates, prompts signature, and posts an order in a single call.
Use when you want to buy/sell at a specific price and can wait.
Convenience method that creates, signs, and posts a limit order in a single call. Use when you want to buy or sell at a specific price.
```typescript Signature theme={null}
async createAndPostOrder(
@@ -86,44 +83,83 @@ async createAndPostOrder(
): Promise<OrderResponse>
```
```typescript Params theme={null}
interface UserOrder {
tokenID: string;
price: number;
size: number;
side: Side;
feeRateBps?: number;
nonce?: number;
expiration?: number;
taker?: string;
}
**Params**
type CreateOrderOptions = {
tickSize: TickSize;
negRisk?: boolean;
}
<ResponseField name="tokenID" type="string">
The token ID of the outcome to trade.
</ResponseField>
type TickSize = "0.1" | "0.01" | "0.001" | "0.0001";
```
<ResponseField name="price" type="number">
The limit price for the order.
</ResponseField>
```typescript Response theme={null}
interface OrderResponse {
success: boolean;
errorMsg: string;
orderID: string;
transactionsHashes: string[];
status: string;
takingAmount: string;
makingAmount: string;
}
```
<ResponseField name="size" type="number">
The size of the order.
</ResponseField>
<ResponseField name="side" type="Side">
The side of the order (buy or sell).
</ResponseField>
<ResponseField name="feeRateBps" type="number">
Optional fee rate in basis points.
</ResponseField>
<ResponseField name="nonce" type="number">
Optional nonce for the order.
</ResponseField>
<ResponseField name="expiration" type="number">
Optional expiration timestamp for the order.
</ResponseField>
<ResponseField name="taker" type="string">
Optional taker address.
</ResponseField>
<ResponseField name="tickSize" type="TickSize">
Tick size for the order. One of `"0.1"`, `"0.01"`, `"0.001"`, `"0.0001"`.
</ResponseField>
<ResponseField name="negRisk" type="boolean">
Optional. Whether the market uses negative risk.
</ResponseField>
**Response**
<ResponseField name="success" type="boolean">
Whether the order was successfully placed.
</ResponseField>
<ResponseField name="errorMsg" type="string">
Error message if the order was not successful.
</ResponseField>
<ResponseField name="orderID" type="string">
The ID of the placed order.
</ResponseField>
<ResponseField name="transactionsHashes" type="string[]">
Array of transaction hashes associated with the order.
</ResponseField>
<ResponseField name="status" type="string">
The current status of the order.
</ResponseField>
<ResponseField name="takingAmount" type="string">
The amount being taken in the order.
</ResponseField>
<ResponseField name="makingAmount" type="string">
The amount being made in the order.
</ResponseField>
***
### createAndPostMarketOrder()
A convenience method that creates, prompts signature, and posts an order in a single call.
Use when you want to buy/sell right now at whatever the market price is.
Convenience method that creates, signs, and posts a market order in a single call. Use when you want to buy or sell at the current market price.
```typescript Signature theme={null}
async createAndPostMarketOrder(
@@ -133,103 +169,109 @@ async createAndPostMarketOrder(
): Promise<OrderResponse>
```
```typescript Params theme={null}
interface UserMarketOrder {
tokenID: string;
amount: number;
side: Side;
price?: number;
feeRateBps?: number;
nonce?: number;
taker?: string;
orderType?: OrderType.FOK | OrderType.FAK;
}
**Params**
type CreateOrderOptions = {
tickSize: TickSize;
negRisk?: boolean;
}
<ResponseField name="tokenID" type="string">
The token ID of the outcome to trade.
</ResponseField>
type TickSize = "0.1" | "0.01" | "0.001" | "0.0001";
```
<ResponseField name="amount" type="number">
The amount for the market order.
</ResponseField>
```typescript Response theme={null}
interface OrderResponse {
success: boolean;
errorMsg: string;
orderID: string;
transactionsHashes: string[];
status: string;
takingAmount: string;
makingAmount: string;
}
```
<ResponseField name="side" type="Side">
The side of the order (buy or sell).
</ResponseField>
<ResponseField name="price" type="number">
Optional price hint for the market order.
</ResponseField>
<ResponseField name="feeRateBps" type="number">
Optional fee rate in basis points.
</ResponseField>
<ResponseField name="nonce" type="number">
Optional nonce for the order.
</ResponseField>
<ResponseField name="taker" type="string">
Optional taker address.
</ResponseField>
<ResponseField name="orderType" type="OrderType.FOK | OrderType.FAK">
Optional order type override. Defaults to FOK.
</ResponseField>
**Response**
<ResponseField name="success" type="boolean">
Whether the order was successfully placed.
</ResponseField>
<ResponseField name="errorMsg" type="string">
Error message if the order was not successful.
</ResponseField>
<ResponseField name="orderID" type="string">
The ID of the placed order.
</ResponseField>
<ResponseField name="transactionsHashes" type="string[]">
Array of transaction hashes associated with the order.
</ResponseField>
<ResponseField name="status" type="string">
The current status of the order.
</ResponseField>
<ResponseField name="takingAmount" type="string">
The amount being taken in the order.
</ResponseField>
<ResponseField name="makingAmount" type="string">
The amount being made in the order.
</ResponseField>
***
### postOrder()
Posts a pre-signed and created order to the CLOB.
Posts a pre-signed order to the CLOB. Use with [`createOrder()`](/trading/clients/l1#createorder) or [`createMarketOrder()`](/trading/clients/l1#createmarketorder) from L1 methods.
```typescript Signature theme={null}
async postOrder(
order: SignedOrder,
orderType?: OrderType, // Defaults to GTC
postOnly?: boolean, // Defaults to false
postOnly?: boolean, // Defaults to false
): Promise<OrderResponse>
```
```typescript Params theme={null}
order: SignedOrder // Pre-signed order from createOrder() or createMarketOrder()
orderType?: OrderType // Optional, defaults to GTC
postOnly?: boolean // Optional, defaults to false
```
```typescript Response theme={null}
interface OrderResponse {
success: boolean;
errorMsg: string;
orderID: string;
transactionsHashes: string[];
status: string;
takingAmount: string;
makingAmount: string;
}
```
***
### postOrders()
Posts up to 15 pre-signed and created orders in a single batch.
Posts up to 15 pre-signed orders in a single batch.
```typescript theme={null}
```typescript Signature theme={null}
async postOrders(
args: PostOrdersArgs[],
): Promise<OrderResponse[]>
```
```typescript Params theme={null}
interface PostOrdersArgs {
order: SignedOrder;
orderType: OrderType;
postOnly?: boolean; // Defaults to false
}
```
**Params**
```typescript Response theme={null}
OrderResponse[] // Array of OrderResponse objects
<ResponseField name="order" type="SignedOrder">
The pre-signed order to post.
</ResponseField>
interface OrderResponse {
success: boolean;
errorMsg: string;
orderID: string;
transactionsHashes: string[];
status: string;
takingAmount: string;
makingAmount: string;
}
```
<ResponseField name="orderType" type="OrderType">
The order type (e.g. GTC, FOK, FAK).
</ResponseField>
<ResponseField name="postOnly" type="boolean">
Optional. Whether to post the order as post-only. Defaults to false.
</ResponseField>
***
@@ -241,12 +283,15 @@ Cancels a single open order.
async cancelOrder(orderID: string): Promise<CancelOrdersResponse>
```
```typescript Response theme={null}
interface CancelOrdersResponse {
canceled: string[];
not_canceled: Record<string, any>;
}
```
**Response**
<ResponseField name="canceled" type="string[]">
Array of order IDs that were successfully canceled.
</ResponseField>
<ResponseField name="not_canceled" type="Record<string, any>">
Map of order IDs to reasons why they could not be canceled.
</ResponseField>
***
@@ -258,17 +303,6 @@ Cancels multiple orders in a single batch.
async cancelOrders(orderIDs: string[]): Promise<CancelOrdersResponse>
```
```typescript Params theme={null}
orderIDs: string[];
```
```typescript Response theme={null}
interface CancelOrdersResponse {
canceled: string[];
not_canceled: Record<string, any>;
}
```
***
### cancelAll()
@@ -276,14 +310,7 @@ interface CancelOrdersResponse {
Cancels all open orders.
```typescript Signature theme={null}
async cancelAll(): Promise<CancelResponse>
```
```typescript Response theme={null}
interface CancelOrdersResponse {
canceled: string[];
not_canceled: Record<string, any>;
}
async cancelAll(): Promise<CancelOrdersResponse>
```
***
@@ -298,19 +325,15 @@ async cancelMarketOrders(
): Promise<CancelOrdersResponse>
```
```typescript Parameters theme={null}
interface OrderMarketCancelParams {
market?: string;
asset_id?: string;
}
```
**Params**
```typescript Response theme={null}
interface CancelOrdersResponse {
canceled: string[];
not_canceled: Record<string, any>;
}
```
<ResponseField name="market" type="string">
Optional. The market condition ID to cancel orders for.
</ResponseField>
<ResponseField name="asset_id" type="string">
Optional. The token ID to cancel orders for.
</ResponseField>
***
@@ -320,31 +343,73 @@ interface CancelOrdersResponse {
### getOrder()
Get details for a specific order.
Get details for a specific order by ID.
```typescript Signature theme={null}
async getOrder(orderID: string): Promise<OpenOrder>
```
```typescript Response theme={null}
interface OpenOrder {
id: string;
status: string;
owner: string;
maker_address: string;
market: string;
asset_id: string;
side: string;
original_size: string;
size_matched: string;
price: string;
associate_trades: string[];
outcome: string;
created_at: number;
expiration: string;
order_type: string;
}
```
**Response**
<ResponseField name="id" type="string">
The unique order ID.
</ResponseField>
<ResponseField name="status" type="string">
The current status of the order.
</ResponseField>
<ResponseField name="owner" type="string">
The API key of the order owner.
</ResponseField>
<ResponseField name="maker_address" type="string">
The on-chain address of the order maker.
</ResponseField>
<ResponseField name="market" type="string">
The market condition ID the order belongs to.
</ResponseField>
<ResponseField name="asset_id" type="string">
The token ID the order is for.
</ResponseField>
<ResponseField name="side" type="string">
The side of the order (BUY or SELL).
</ResponseField>
<ResponseField name="original_size" type="string">
The original size of the order when it was placed.
</ResponseField>
<ResponseField name="size_matched" type="string">
The amount of the order that has been matched so far.
</ResponseField>
<ResponseField name="price" type="string">
The limit price of the order.
</ResponseField>
<ResponseField name="associate_trades" type="string[]">
Array of trade IDs associated with this order.
</ResponseField>
<ResponseField name="outcome" type="string">
The outcome label for the order's token.
</ResponseField>
<ResponseField name="created_at" type="number">
Unix timestamp of when the order was created.
</ResponseField>
<ResponseField name="expiration" type="string">
The expiration time of the order.
</ResponseField>
<ResponseField name="order_type" type="string">
The order type (e.g. GTC, FOK, FAK, GTD).
</ResponseField>
***
@@ -356,40 +421,22 @@ Get all your open orders.
async getOpenOrders(
params?: OpenOrderParams,
only_first_page?: boolean,
): Promise<OpenOrdersResponse>
): Promise<OpenOrder[]>
```
```typescript Params theme={null}
interface OpenOrderParams {
id?: string; // Order ID
market?: string; // Market condition ID
asset_id?: string; // Token ID
}
**Params**
only_first_page?: boolean // Defaults to false
```
<ResponseField name="id" type="string">
Optional. Filter by order ID.
</ResponseField>
```typescript Response theme={null}
type OpenOrdersResponse = OpenOrder[];
<ResponseField name="market" type="string">
Optional. Filter by market condition ID.
</ResponseField>
interface OpenOrder {
id: string;
status: string;
owner: string;
maker_address: string;
market: string;
asset_id: string;
side: string;
original_size: string;
size_matched: string;
price: string;
associate_trades: string[];
outcome: string;
created_at: number;
expiration: string;
order_type: string;
}
```
<ResponseField name="asset_id" type="string">
Optional. Filter by token ID.
</ResponseField>
***
@@ -404,53 +451,141 @@ async getTrades(
): Promise<Trade[]>
```
```typescript Params theme={null}
interface TradeParams {
id?: string;
maker_address?: string;
market?: string;
asset_id?: string;
before?: string;
after?: string;
}
**Params**
only_first_page?: boolean // Defaults to false
```
<ResponseField name="id" type="string">
Optional. Filter by trade ID.
</ResponseField>
```typescript Response theme={null}
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";
}
<ResponseField name="maker_address" type="string">
Optional. Filter by maker address.
</ResponseField>
interface MakerOrder {
order_id: string;
owner: string;
maker_address: string;
matched_amount: string;
price: string;
fee_rate_bps: string;
asset_id: string;
outcome: string;
side: Side;
}
```
<ResponseField name="market" type="string">
Optional. Filter by market condition ID.
</ResponseField>
<ResponseField name="asset_id" type="string">
Optional. Filter by token ID.
</ResponseField>
<ResponseField name="before" type="string">
Optional. Return trades before this timestamp.
</ResponseField>
<ResponseField name="after" type="string">
Optional. Return trades after this timestamp.
</ResponseField>
**Response**
<ResponseField name="id" type="string">
The unique trade ID.
</ResponseField>
<ResponseField name="taker_order_id" type="string">
The order ID of the taker side.
</ResponseField>
<ResponseField name="market" type="string">
The market condition ID for the trade.
</ResponseField>
<ResponseField name="asset_id" type="string">
The token ID for the trade.
</ResponseField>
<ResponseField name="side" type="Side">
The side of the trade (BUY or 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.
</ResponseField>
<ResponseField name="price" type="string">
The price at which the trade was matched.
</ResponseField>
<ResponseField name="status" type="string">
The current status of the trade.
</ResponseField>
<ResponseField name="match_time" type="string">
The time at which the trade was matched.
</ResponseField>
<ResponseField name="last_update" type="string">
The time of the last update to this trade.
</ResponseField>
<ResponseField name="outcome" type="string">
The outcome label for the traded token.
</ResponseField>
<ResponseField name="bucket_index" type="number">
The bucket index for the trade.
</ResponseField>
<ResponseField name="owner" type="string">
The API key of the trade owner.
</ResponseField>
<ResponseField name="maker_address" type="string">
The on-chain address of the maker.
</ResponseField>
<ResponseField name="maker_orders" type="MakerOrder[]">
Array of maker order objects that participated in this trade. Each `MakerOrder` contains the following fields:
</ResponseField>
<ResponseField name="maker_orders[].order_id" type="string">
The maker order ID.
</ResponseField>
<ResponseField name="maker_orders[].owner" type="string">
The API key of the maker order owner.
</ResponseField>
<ResponseField name="maker_orders[].maker_address" type="string">
The on-chain address of the maker order maker.
</ResponseField>
<ResponseField name="maker_orders[].matched_amount" type="string">
The amount matched for this maker order.
</ResponseField>
<ResponseField name="maker_orders[].price" type="string">
The price of the maker order.
</ResponseField>
<ResponseField name="maker_orders[].fee_rate_bps" type="string">
The fee rate in basis points for the maker order.
</ResponseField>
<ResponseField name="maker_orders[].asset_id" type="string">
The token ID for the maker order.
</ResponseField>
<ResponseField name="maker_orders[].outcome" type="string">
The outcome label for the maker order's token.
</ResponseField>
<ResponseField name="maker_orders[].side" type="Side">
The side of the maker order (BUY or SELL).
</ResponseField>
<ResponseField name="transaction_hash" type="string">
The on-chain transaction hash for the trade.
</ResponseField>
<ResponseField name="trader_side" type="&#x22;TAKER&#x22; | &#x22;MAKER&#x22;">
Whether the authenticated user is the taker or a maker in this trade.
</ResponseField>
***
@@ -464,24 +599,19 @@ async getTradesPaginated(
): Promise<TradesPaginatedResponse>
```
```typescript Params theme={null}
interface TradeParams {
id?: string;
maker_address?: string;
market?: string;
asset_id?: string;
before?: string;
after?: string;
}
```
**Response**
```typescript Response theme={null}
interface TradesPaginatedResponse {
trades: Trade[];
limit: number;
count: number;
}
```
<ResponseField name="trades" type="Trade[]">
Array of trade objects for the current page.
</ResponseField>
<ResponseField name="limit" type="number">
The maximum number of trades returned per page.
</ResponseField>
<ResponseField name="count" type="number">
The total number of trades matching the query.
</ResponseField>
***
@@ -499,24 +629,25 @@ async getBalanceAllowance(
): Promise<BalanceAllowanceResponse>
```
```typescript Params theme={null}
interface BalanceAllowanceParams {
asset_type: AssetType;
token_id?: string;
}
**Params**
enum AssetType {
COLLATERAL = "COLLATERAL",
CONDITIONAL = "CONDITIONAL",
}
```
<ResponseField name="asset_type" type="AssetType">
The type of asset to query. One of `"COLLATERAL"` or `"CONDITIONAL"`.
</ResponseField>
```typescript Response theme={null}
interface BalanceAllowanceResponse {
balance: string;
allowance: string;
}
```
<ResponseField name="token_id" type="string">
Optional. The token ID to query (required when `asset_type` is `CONDITIONAL`).
</ResponseField>
**Response**
<ResponseField name="balance" type="string">
The current balance for the specified asset.
</ResponseField>
<ResponseField name="allowance" type="string">
The current allowance for the specified asset.
</ResponseField>
***
@@ -530,21 +661,11 @@ async updateBalanceAllowance(
): Promise<void>
```
```typescript Params theme={null}
interface BalanceAllowanceParams {
asset_type: AssetType;
token_id?: string;
}
enum AssetType {
COLLATERAL = "COLLATERAL",
CONDITIONAL = "CONDITIONAL",
}
```
***
## API Key Management (L2)
## API Key Management
***
### getApiKeys()
@@ -554,17 +675,11 @@ Get all API keys associated with your account.
async getApiKeys(): Promise<ApiKeysResponse>
```
```typescript Response theme={null}
interface ApiKeysResponse {
apiKeys: ApiKeyCreds[];
}
**Response**
interface ApiKeyCreds {
key: string;
secret: string;
passphrase: string;
}
```
<ResponseField name="apiKeys" type="ApiKeyCreds[]">
Array of API key credential objects associated with the account.
</ResponseField>
***
@@ -572,9 +687,7 @@ interface ApiKeyCreds {
Deletes (revokes) the currently authenticated API key.
**TypeScript Signature:**
```typescript theme={null}
```typescript Signature theme={null}
async deleteApiKey(): Promise<any>
```
@@ -586,30 +699,39 @@ async deleteApiKey(): Promise<any>
### getNotifications()
Retrieves all event notifications for the L2 authenticated user.
Records are removed automatically after 48 hours or if manually removed via dropNotifications().
Retrieves all event notifications for the authenticated user. Records are automatically removed after 48 hours.
```typescript Signature theme={null}
public async getNotifications(): Promise<Notification[]>
async getNotifications(): Promise<Notification[]>
```
```typescript Response theme={null}
interface Notification {
id: number; // Unique notification ID
owner: string; // User's L2 credential apiKey or empty string for global notifications
payload: any; // Type-specific payload data
timestamp?: number; // Unix timestamp
type: number; // Notification type (see type mapping below)
}
```
**Response**
**Notification Type Mapping**
<ResponseField name="id" type="number">
Unique notification ID.
</ResponseField>
<ResponseField name="owner" type="string">
The user's API key, or an empty string for global notifications.
</ResponseField>
<ResponseField name="payload" type="any">
Type-specific payload data for the notification.
</ResponseField>
<ResponseField name="timestamp" type="number">
Optional Unix timestamp of when the notification was created.
</ResponseField>
<ResponseField name="type" type="number">
Notification type (see below).
</ResponseField>
| Name | Value | Description |
| ------------------ | ----- | ---------------------------------------- |
| Order Cancellation | 1 | User's order was canceled |
| Order Fill | 2 | User's order was filled (maker or taker) |
| Market Resolved | 4 | Market was resolved |
| Order Cancellation | `1` | User's order was canceled |
| Order Fill | `2` | User's order was filled (maker or taker) |
| Market Resolved | `4` | Market was resolved |
***
@@ -618,33 +740,33 @@ interface Notification {
Mark notifications as read/dismissed.
```typescript Signature theme={null}
public async dropNotifications(params?: DropNotificationParams): Promise<void>
async dropNotifications(params?: DropNotificationParams): Promise<void>
```
```typescript Params theme={null}
interface DropNotificationParams {
ids: string[]; // Array of notification IDs to mark as read
}
```
**Params**
<ResponseField name="ids" type="string[]">
Array of notification IDs to dismiss.
</ResponseField>
***
## See Also
<CardGroup cols={2}>
<Card title="Understand CLOB Authentication" icon="shield" href="/developers/CLOB/authentication">
Deep dive into L1 and L2 authentication
<Card title="Authentication" icon="shield" href="/api-reference/authentication">
Deep dive into L1 and L2 authentication.
</Card>
<Card title="Public Methods" icon="globe" href="/developers/CLOB/clients/methods-l2">
Access market data, orderbooks, and prices.
<Card title="L1 Methods" icon="key" href="/trading/clients/l1">
Sign orders and derive API credentials with your private key.
</Card>
<Card title="L1 Methods" icon="lock" href="/developers/CLOB/clients/methods-l2">
Private key authentication to create or derive API keys (L2 headers)
<Card title="Public Methods" icon="globe" href="/trading/clients/public">
Read market data and orderbooks without auth.
</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>
+86 -224
View File
@@ -2,234 +2,96 @@
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Methods Overview
# Clients & SDKs
> CLOB client methods require different levels of authentication. This reference is organized by what credentials you need to call each method.
> Official open-source libraries for interacting with Polymarket
Polymarket provides official open-source clients in TypeScript, Python, and Rust. All three support the full CLOB API including market data, order management, and authentication.
## Installation
<CodeGroup>
```bash TypeScript theme={null}
npm install @polymarket/clob-client ethers@5
```
```bash Python theme={null}
pip install py-clob-client
```
```bash Rust theme={null}
cargo add polymarket-client-sdk
```
</CodeGroup>
## Quick Example
<CodeGroup>
```typescript TypeScript theme={null}
import { ClobClient } from "@polymarket/clob-client";
const client = new ClobClient(
"https://clob.polymarket.com",
137,
signer,
apiCreds,
);
const markets = await client.getMarkets();
```
```python Python theme={null}
from py_clob_client.client import ClobClient
client = ClobClient(
"https://clob.polymarket.com",
key=private_key,
chain_id=137,
creds=api_creds,
)
markets = client.get_markets()
```
</CodeGroup>
## Source Code
| Language | Package | Repository |
| ---------- | ------------------------- | ------------------------------------------------------------------------------------ |
| TypeScript | `@polymarket/clob-client` | [github.com/Polymarket/clob-client](https://github.com/Polymarket/clob-client) |
| Python | `py-clob-client` | [github.com/Polymarket/py-clob-client](https://github.com/Polymarket/py-clob-client) |
| Rust | `polymarket-client-sdk` | [github.com/Polymarket/rs-clob-client](https://github.com/Polymarket/rs-clob-client) |
Each repository includes working examples in the `/examples` directory.
## Builder SDKs
If you're building an app through the [Builder Program](/builders/overview), additional signing SDKs are available:
| Language | Package | Repository |
| ---------- | --------------------------------- | ---------------------------------------------------------------------------------------------------- |
| TypeScript | `@polymarket/builder-signing-sdk` | [github.com/Polymarket/builder-signing-sdk](https://github.com/Polymarket/builder-signing-sdk) |
| Python | `py_builder_signing_sdk` | [github.com/Polymarket/py-builder-signing-sdk](https://github.com/Polymarket/py-builder-signing-sdk) |
See [Order Attribution](/trading/orders/attribution) for usage details.
## Relayer SDK
For [gasless transactions](/trading/gasless) using proxy wallets, the relayer client handles submitting transactions through Polymarket's relayer:
| Language | Package | Repository |
| ---------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| TypeScript | `@polymarket/builder-relayer-client` | [github.com/Polymarket/builder-relayer-client](https://github.com/Polymarket/builder-relayer-client) |
| Python | `py-builder-relayer-client` | [github.com/Polymarket/py-builder-relayer-client](https://github.com/Polymarket/py-builder-relayer-client) |
## Next Steps
<CardGroup cols={2}>
<Card title="Public Methods" icon="globe" href="/developers/CLOB/clients/methods-public">
Access market data, orderbooks, and prices.
<Card title="Quickstart" icon="rocket" href="/quickstart">
Set up your client and place your first order.
</Card>
<Card title="L1 Methods" icon="key" href="/developers/CLOB/clients/methods-l1">
Private key authentication to create or derive API keys (L2 headers).
</Card>
<Card title="L2 Methods" icon="lock" href="/developers/CLOB/clients/methods-l2">
Manage and close orders. Creating orders requires signer.
</Card>
<Card title="Builder Program Methods" icon="hammer" href="/developers/CLOB/clients/methods-builder">
Builder-specific operations for those in the Builders Program.
</Card>
</CardGroup>
***
## Client Initialization by Use Case
<Tabs>
<Tab title="Get Market Data">
<CodeGroup>
```typescript TypeScript theme={null}
// No signer or credentials needed
const client = new ClobClient(
"https://clob.polymarket.com",
137
);
// All public methods available
const markets = await client.getMarkets();
const book = await client.getOrderBook(tokenId);
const price = await client.getPrice(tokenId, "BUY");
```
```python Python theme={null}
# No signer or credentials needed
client = new ClobClient(
host="https://clob.polymarket.com",
chain_id=137
)
# All public methods available
markets = client.get_markets()
book = client.get_order_book()
price = client.get_price()
```
</CodeGroup>
</Tab>
<Tab title="Generate User API Credentials">
<CodeGroup>
```typescript TypeScript theme={null}
// Create client with signer
const client = new ClobClient(
"https://clob.polymarket.com",
137,
signer
);
// All public and L1 methods available
const newCreds = createApiKey();
const derivedCreds = deriveApiKey();
const creds = createOrDeriveApiKey();
```
```python Python theme={null}
# Create client with signer
client = new ClobClient(
host="https://clob.polymarket.com",
chain_id=137
key="private_key"
)
# All public and L1 methods available
new_creds = client.create_api_key()
derived_creds = client.derive_api_key()
creds = client.create_or_derive_api_key()
```
</CodeGroup>
</Tab>
<Tab title="Create and Post Order">
<CodeGroup>
```typescript TypeScript theme={null}
// Create client with signer and creds
const client = new ClobClient(
"https://clob.polymarket.com",
137,
signer,
creds,
2, // Indicates Gnosis Safe proxy
funder // Safe wallet address holding funds
);
// All public, L1, and L2 methods available
const order = await client.createOrder({ /* ... */ });
const result = await client.postOrder(order);
const trades = await client.getTrades();
```
```python Python theme={null}
# Create client with signer and creds
const client = new ClobClient(
host="https://clob.polymarket.com",
chain_id=137,
key="private_key",
creds=creds,
signature_type=2, // Indicates Gnosis Safe proxy
funder="funder_address" // Safe wallet address holding funds
)
# All public, L1, and L2 methods available
order = client.create_order({ /* ... */ })
result = client.post_order(order)
trades = client.get_trades()
```
</CodeGroup>
</Tab>
<Tab title="Get Builders Orders">
<CodeGroup>
```typescript TypeScript theme={null}
// Create client with builder's authentication headers
import { BuilderConfig, BuilderApiKeyCreds } from "@polymarket/builder-signing-sdk";
const builderCreds: BuilderApiKeyCreds = {
key: process.env.POLY_BUILDER_API_KEY!,
secret: process.env.POLY_BUILDER_SECRET!,
passphrase: process.env.POLY_BUILDER_PASSPHRASE!
};
const builderConfig: BuilderConfig = {
localBuilderCreds: builderCreds
};
const client = new ClobClient(
"https://clob.polymarket.com",
137,
signer,
creds, // User's API credentials
2,
funder,
undefined,
false,
builderConfig // Builder's API credentials
);
// You can call all methods including builder methods
const builderTrades = await client.getBuilderTrades();
```
```python Python theme={null}
# Create client with builder's authentication headers
from py_clob_client.client import ClobClient
from py_clob_client.clob_types import ApiCreds
from py_builder_signing_sdk.config import BuilderConfig, BuilderApiKeyCreds
builder_creds = BuilderApiKeyCreds(
key="POLY_BUILDER_API_KEY",
secret="POLY_BUILDER_SECRET,
passphrase="POLY_BUILDER_PASSPHRASE"
)
builder_config = BuilderConfig(
local_builder_creds=builder_creds
)
client = ClobClient(
host="https://clob.polymarket.com",
chain_id=137,
key="private_key",
creds=creds, # User's API credentials
signature_type=2,
funder=funder_address,
builder_config=builder_config # Builder's API credentials
)
# You can call all methods including builder methods
builder_trades = client.get_builder_trades()
```
</CodeGroup>
Learn more about the Builders Program and Relay Client here
</Tab>
</Tabs>
***
## Resources
<CardGroup cols={3}>
<Card title="TypeScript Client" icon="github" href="https://github.com/Polymarket/clob-client">
Open source TypeScript client on GitHub
</Card>
<Card title="Python Client" icon="github" href="https://github.com/Polymarket/py-clob-client">
Open source Python client for GitHub
</Card>
<Card title="Rust Client" icon="github" href="https://github.com/Polymarket/rs-clob-client">
Open source Rust client on GitHub
</Card>
<Card title="TypeScript Examples" icon="code" href="https://github.com/Polymarket/clob-client/tree/main/examples">
TypeScript client method examples
</Card>
<Card title="Python Examples" icon="python" href="https://github.com/Polymarket/py-clob-client/tree/main/examples">
Python client method examples
</Card>
<Card title="Rust Examples" icon="rust" href="https://github.com/Polymarket/rs-clob-client/tree/main/examples">
Rust client method examples
</Card>
<Card title="CLOB Rest API Reference" icon="hammer" href="/api-reference/orderbook/get-order-book-summary">
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="Authentication" icon="lock" href="/api-reference/authentication">
Understand L1/L2 auth and API credentials.
</Card>
</CardGroup>
+331 -385
View File
@@ -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>