Updated 55 files with latest documentation changes
7.7 KiB
Documentation Index
Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt Use this file to discover all available pages before exploring further.
Builder Methods
Methods for querying orders and trades attributed to your builder code.
Overview
Builder attribution in V2 is handled natively through the order struct — you attach your builder code (a bytes32 identifier from your Builder Profile) to every order you submit. No separate client configuration is required.
const client = new ClobClient({ host: "https://clob.polymarket.com", chain: 137, signer, creds: apiCreds, signatureType, funderAddress, });
// Attach your builder code on every order const response = await client.createAndPostOrder( { tokenID: "0x...", price: 0.55, size: 100, side: Side.BUY, builderCode: process.env.POLY_BUILDER_CODE!, }, { tickSize: "0.01", negRisk: false }, );
```python Python theme={null}
from py_clob_client_v2 import ClobClient
from py_clob_client_v2 import OrderArgs, PartialCreateOrderOptions
from py_clob_client_v2.order_builder.constants import BUY
import os
client = ClobClient(
host="https://clob.polymarket.com",
chain_id=137,
key=os.getenv("PRIVATE_KEY"),
creds=creds,
signature_type=signature_type,
funder=funder,
)
# Attach your builder code on every order
response = client.create_and_post_order(
OrderArgs(
token_id="0x...",
price=0.55,
size=100,
side=BUY,
builder_code=os.environ["POLY_BUILDER_CODE"],
),
options=PartialCreateOrderOptions(tick_size="0.01", neg_risk=False),
)
Methods
getOrder
Get details for a specific order by ID.
async getOrder(orderID: string): Promise<OpenOrder>
order = client.get_order("0xb816482a...")
print(order)
getOpenOrders
Get all open orders attributed to your builder code.
async getOpenOrders(
params?: OpenOrderParams,
only_first_page?: boolean,
): Promise<OpenOrder[]>
Params
Optional. Filter by order ID. Optional. Filter by market condition ID. Optional. Filter by token ID.// All open orders for this builder
const orders = await client.getOpenOrders();
// Filtered by market
const marketOrders = await client.getOpenOrders({
market: "0xbd31dc8a...",
});
getBuilderTrades
Retrieves all trades attributed to your builder code. Use this to track which trades were routed through your platform.
async getBuilderTrades(
params?: TradeParams,
): Promise<BuilderTradesPaginatedResponse>
Params (TradeParams)
Response (BuilderTradesPaginatedResponse)
BuilderTrade fields