Update Polymarket documentation - March 30, 2026

Updated 229 documentation pages reflecting latest official docs changes:
- API Reference: authentication, rate-limits, clients-sdks, market-data endpoints
- Developers: CLOB, Gamma Markets, RTDS, Sports Websocket, Builders, CTF
- Trading: fees, bridge, orders, orderbook, clients
- Polymarket Learn: get-started guides, deposits, trading
- Builders: tiers, api-keys, profile, examples, order-attribution
- Quickstart: overview, first-order, websocket guides
- Concepts: markets-events, prices-orderbook, resolution
- Market Makers: getting-started, trading, liquidity-rewards
- Resources: error-codes, contract-addresses, blockchain-data
This commit is contained in:
Etherdrake
2026-03-30 12:53:20 +02:00
parent 240ece03cc
commit 50a13414c0
229 changed files with 7322 additions and 935 deletions
+76 -1
View File
@@ -25,6 +25,12 @@ All cancel endpoints require [L2 authentication](/trading/overview#authenticatio
# {"canceled": ["0xb816482a..."], "not_canceled": {}}
```
```rust Rust theme={null}
let resp = client.cancel_order("0xb816482a...").await?;
println!("{:?}", resp);
// CancelOrdersResponse { canceled: ["0xb816482a..."], not_canceled: {} }
```
```bash REST theme={null}
curl -X DELETE "https://clob.polymarket.com/order" \
-H "Content-Type: application/json" \
@@ -53,6 +59,10 @@ All cancel endpoints require [L2 authentication](/trading/overview#authenticatio
])
```
```rust Rust theme={null}
let resp = client.cancel_orders(&["0xb816482a...", "0xc927593b..."]).await?;
```
```bash REST theme={null}
curl -X DELETE "https://clob.polymarket.com/orders" \
-H "Content-Type: application/json" \
@@ -80,6 +90,10 @@ Cancel every open order across all markets:
resp = client.cancel_all()
```
```rust Rust theme={null}
let resp = client.cancel_all_orders().await?;
```
```bash REST theme={null}
curl -X DELETE "https://clob.polymarket.com/cancel-all" \
-H "POLY_ADDRESS: ..." \
@@ -111,6 +125,16 @@ Cancel all orders for a specific market, optionally filtered to a single token.
)
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::request::CancelMarketOrderRequest;
let request = CancelMarketOrderRequest::builder()
.market("0xbd31dc8a...".parse()?)
.asset_id("52114319501245...".parse()?)
.build();
let resp = client.cancel_market_orders(&request).await?;
```
```bash REST theme={null}
curl -X DELETE "https://clob.polymarket.com/cancel-market-orders" \
-H "Content-Type: application/json" \
@@ -149,6 +173,11 @@ This is a fallback mechanism — API cancellation is instant while onchain cance
order = client.get_order("0xb816482a...")
print(order["status"], order["size_matched"])
```
```rust Rust theme={null}
let order = client.order("0xb816482a...").await?;
println!("{:?} {}", order.status, order.size_matched);
```
</CodeGroup>
### Get Open Orders
@@ -182,6 +211,19 @@ Retrieve all open orders, optionally filtered by market or token:
OpenOrderParams(market="0xbd31dc8a...")
)
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::request::OrdersRequest;
// All open orders
let orders = client.orders(&OrdersRequest::default(), None).await?;
// Filtered by market
let request = OrdersRequest::builder()
.market("0xbd31dc8a...".parse()?)
.build();
let market_orders = client.orders(&request, None).await?;
```
</CodeGroup>
### OpenOrder Object
@@ -238,11 +280,24 @@ When an order is matched, it creates a trade. Trades progress through these stat
TradeParams(market="0xbd31dc8a...")
)
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::request::TradesRequest;
// All trades
let trades = client.trades(&TradesRequest::default(), None).await?;
// Filtered by market
let request = TradesRequest::builder()
.market("0xbd31dc8a...".parse()?)
.build();
let market_trades = client.trades(&request, None).await?;
```
</CodeGroup>
Additional filter parameters: `id`, `maker_address`, `asset_id`, `before`, `after`.
For large result sets, use the paginated variant:
The Rust SDK uses cursor-based pagination via the `next_cursor` parameter:
<CodeGroup>
```typescript TypeScript theme={null}
@@ -253,6 +308,15 @@ For large result sets, use the paginated variant:
```python Python theme={null}
page = client.get_trades_paginated(TradeParams(market="0xbd31dc8a..."))
```
```rust Rust theme={null}
// First page
let page = client.trades(&request, None).await?;
println!("{} trades, cursor: {}", page.data.len(), page.next_cursor);
// Next page
let page2 = client.trades(&request, Some(page.next_cursor)).await?;
```
</CodeGroup>
### Trade Object
@@ -312,6 +376,14 @@ Check if your resting orders are eligible for [maker rebates](/market-makers/mak
OrdersScoringParams(orderIds=["0x...", "0x..."])
)
```
```rust Rust theme={null}
// Single order
let scoring = client.is_order_scoring("0x...").await?;
// Multiple orders
let batch = client.are_orders_scoring(&["0x...", "0x..."]).await?;
```
</CodeGroup>
***
@@ -327,3 +399,6 @@ Check if your resting orders are eligible for [maker rebates](/market-makers/mak
Understand fee structures and maker rebates
</Card>
</CardGroup>
Built with [Mintlify](https://mintlify.com).
+83 -1
View File
@@ -71,6 +71,11 @@ Retrieve the tick size for a market using the SDK:
tick_size = client.get_tick_size(token_id)
# Returns: "0.1" | "0.01" | "0.001" | "0.0001"
```
```rust Rust theme={null}
let resp = client.tick_size(token_id).await?;
// resp.minimum_tick_size: TickSize::Tenth | Hundredth | Thousandth | TenThousandth
```
</CodeGroup>
<Tip>
@@ -114,6 +119,21 @@ Multi-outcome events (e.g., "Who will win the election?" with 3+ candidates) use
}
)
```
```rust Rust theme={null}
// The Rust SDK auto-detects neg risk from the token ID — no flag needed.
// The order builder fetches neg_risk and uses the correct exchange contract.
let order = client
.limit_order()
.token_id("TOKEN_ID".parse()?)
.price(dec!(0.50))
.size(dec!(10))
.side(Side::Buy)
.build()
.await?;
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
```
</CodeGroup>
You can check whether a market uses negative risk via the SDK or the market object's `neg_risk` field:
@@ -126,6 +146,10 @@ You can check whether a market uses negative risk via the SDK or the market obje
```python Python theme={null}
is_neg_risk = client.get_neg_risk(token_id)
```
```rust Rust theme={null}
let is_neg_risk = client.neg_risk(token_id).await?;
```
</CodeGroup>
***
@@ -165,7 +189,7 @@ $$
## Querying Orders
All query endpoints require [L2 authentication](/api-reference/authentication).
All query endpoints require [L2 authentication](/api-reference/authentication). [Builder-authenticated](/trading/clients/builder) clients can also query orders attributed to their builder account using the same methods.
### Get a Single Order
@@ -181,6 +205,11 @@ Retrieve details for a specific order by its ID:
order = client.get_order("0xb816482a...")
print(order)
```
```rust Rust theme={null}
let order = client.order("0xb816482a...").await?;
println!("{order:?}");
```
</CodeGroup>
### Get Open Orders
@@ -216,6 +245,25 @@ Retrieve your open orders, optionally filtered by market or asset:
)
)
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::request::OrdersRequest;
// All open orders
let orders = client.orders(&OrdersRequest::default(), None).await?;
// Filtered by market
let request = OrdersRequest::builder()
.market("0xbd31dc8a...".parse()?)
.build();
let market_orders = client.orders(&request, None).await?;
// Filtered by asset
let request = OrdersRequest::builder()
.asset_id("52114319501245...".parse()?)
.build();
let asset_orders = client.orders(&request, None).await?;
```
</CodeGroup>
### OpenOrder Object
@@ -325,6 +373,19 @@ Retrieve your trades with the SDK:
)
)
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::request::TradesRequest;
// All trades
let trades = client.trades(&TradesRequest::default(), None).await?;
// Filtered by market
let request = TradesRequest::builder()
.market("0xbd31dc8a...".parse()?)
.build();
let market_trades = client.trades(&request, None).await?;
```
</CodeGroup>
***
@@ -352,6 +413,15 @@ The heartbeat endpoint maintains session liveness for order safety. If a valid h
heartbeat_id = resp["heartbeat_id"]
time.sleep(5)
```
```rust Rust theme={null}
// With the `heartbeats` feature, auto-send in background:
Client::start_heartbeats(&mut client)?;
// Or manually:
let resp = client.post_heartbeat(None).await?; // None for first call
let resp = client.post_heartbeat(Some(resp.heartbeat_id)).await?;
```
</CodeGroup>
* On each request, include the most recent `heartbeat_id` you received. For your first request, use an empty string.
@@ -388,6 +458,15 @@ Check if your resting orders are eligible for [maker rebates](/market-makers/mak
OrdersScoringParams(orderIds=["0x...", "0x..."])
)
```
```rust Rust theme={null}
// Single order
let scoring = client.is_order_scoring("0x...").await?;
println!("Scoring: {}", scoring.scoring);
// Multiple orders
let batch = client.are_orders_scoring(&["0x...", "0x..."]).await?;
```
</CodeGroup>
***
@@ -461,3 +540,6 @@ The operator's privileges are limited to order matching and ensuring correct ord
Cancel single, multiple, or all orders
</Card>
</CardGroup>
Built with [Mintlify](https://mintlify.com).
@@ -80,9 +80,29 @@ The simplest way to place a limit order — create, sign, and submit in one call
print("Order ID:", response["orderID"])
print("Status:", response["status"])
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::Side;
use polymarket_client_sdk::types::dec;
let token_id = "TOKEN_ID".parse()?;
let order = client
.limit_order()
.token_id(token_id)
.price(dec!(0.50))
.size(dec!(10))
.side(Side::Buy)
.build()
.await?;
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
println!("Order ID: {}", response.order_id);
println!("Status: {:?}", response.status);
```
</CodeGroup>
### Two-Step: Sign Then Submit
### Two-Step Sign Then Submit
For more control, you can separate signing from submission. This is useful for batch orders or custom submission logic:
@@ -121,11 +141,27 @@ For more control, you can separate signing from submission. This is useful for b
# Step 2: Submit to the CLOB
response = client.post_order(signed_order, OrderType.GTC)
```
```rust Rust theme={null}
// Step 1: Create order (auto-fetches tick size, neg risk, fee rate)
let order = client
.limit_order()
.token_id("TOKEN_ID".parse()?)
.price(dec!(0.50))
.size(dec!(10))
.side(Side::Buy)
.build()
.await?;
// Step 2: Sign and submit separately
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
```
</CodeGroup>
***
## GTD Orders (Expiring)
## GTD Orders
GTD orders auto-expire at a specified time. Useful for quoting around known events.
@@ -168,6 +204,24 @@ GTD orders auto-expire at a specified time. Useful for quoting around known even
order_type=OrderType.GTD
)
```
```rust Rust theme={null}
use chrono::{TimeDelta, Utc};
use polymarket_client_sdk::clob::types::OrderType;
let order = client
.limit_order()
.token_id("TOKEN_ID".parse()?)
.price(dec!(0.50))
.size(dec!(10))
.side(Side::Buy)
.order_type(OrderType::GTD)
.expiration(Utc::now() + TimeDelta::hours(1))
.build()
.await?;
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
```
</CodeGroup>
<Note>
@@ -235,6 +289,38 @@ Market orders execute immediately against resting liquidity using FOK or FAK typ
)
client.post_order(sell_order, OrderType.FOK)
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::{Amount, OrderType, Side};
let token_id = "TOKEN_ID".parse()?;
// FOK BUY: spend exactly $100 or cancel entirely
let buy = client
.market_order()
.token_id(token_id)
.amount(Amount::usdc(dec!(100))?)
.price(dec!(0.50)) // worst-price limit (slippage protection)
.side(Side::Buy)
.order_type(OrderType::FOK)
.build()
.await?;
let signed = client.sign(&signer, buy).await?;
client.post_order(signed).await?;
// FOK SELL: sell exactly 200 shares or cancel entirely
let sell = client
.market_order()
.token_id(token_id)
.amount(Amount::shares(dec!(200))?)
.price(dec!(0.45)) // worst-price limit (slippage protection)
.side(Side::Sell)
.order_type(OrderType::FOK)
.build()
.await?;
let signed = client.sign(&signer, sell).await?;
client.post_order(signed).await?;
```
</CodeGroup>
* **FOK** — fill entirely or cancel the whole order
@@ -270,6 +356,20 @@ For convenience, `createAndPostMarketOrder` handles creation, signing, and submi
order_type=OrderType.FOK,
)
```
```rust Rust theme={null}
let order = client
.market_order()
.token_id("TOKEN_ID".parse()?)
.amount(Amount::usdc(dec!(100))?)
.price(dec!(0.50))
.side(Side::Buy)
.order_type(OrderType::FOK)
.build()
.await?;
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
```
</CodeGroup>
***
@@ -286,6 +386,20 @@ Post-only orders guarantee you're always the maker. If the order would match imm
```python Python theme={null}
response = client.post_order(signed_order, OrderType.GTC, post_only=True)
```
```rust Rust theme={null}
let order = client
.limit_order()
.token_id("TOKEN_ID".parse()?)
.price(dec!(0.50))
.size(dec!(10))
.side(Side::Buy)
.post_only(true)
.build()
.await?;
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
```
</CodeGroup>
* Only works with **GTC** and **GTD** order types
@@ -356,6 +470,31 @@ Place up to **15 orders** in a single request:
),
])
```
```rust Rust theme={null}
let token_id = "TOKEN_ID".parse()?;
let bid = client
.limit_order()
.token_id(token_id)
.price(dec!(0.48))
.size(dec!(500))
.side(Side::Buy)
.build()
.await?;
let ask = client
.limit_order()
.token_id(token_id)
.price(dec!(0.52))
.size(dec!(500))
.side(Side::Sell)
.build()
.await?;
let signed_bid = client.sign(&signer, bid).await?;
let signed_ask = client.sign(&signer, ask).await?;
let response = client.post_orders(vec![signed_bid, signed_ask]).await?;
```
</CodeGroup>
***
@@ -383,6 +522,11 @@ Your order price must conform to the market's tick size, or the order is rejecte
```python Python theme={null}
tick_size = client.get_tick_size("TOKEN_ID")
```
```rust Rust theme={null}
let token_id = "TOKEN_ID".parse()?;
let tick_size = client.tick_size(token_id).await?;
```
</CodeGroup>
### Negative Risk
@@ -397,11 +541,16 @@ Multi-outcome events (3+ outcomes) use the Neg Risk CTF Exchange. Pass `negRisk:
```python Python theme={null}
is_neg_risk = client.get_neg_risk("TOKEN_ID")
```
```rust Rust theme={null}
let token_id = "TOKEN_ID".parse()?;
let is_neg_risk = client.neg_risk(token_id).await?;
```
</CodeGroup>
<Tip>
Both values are also available on the market object: `minimum_tick_size` and
`neg_risk`.
`neg_risk`. In Rust, the order builder auto-fetches both — you don't need to look them up manually.
</Tip>
***
@@ -513,6 +662,18 @@ The heartbeat endpoint maintains session liveness. If a valid heartbeat is not r
heartbeat_id = resp["heartbeat_id"]
time.sleep(5)
```
```rust Rust theme={null}
// With the `heartbeats` feature, the Rust SDK can auto-send heartbeats
// in a background task — no manual loop needed:
Client::start_heartbeats(&mut client)?;
// ... your trading logic ...
client.stop_heartbeats().await?;
// Or send manually:
let resp = client.post_heartbeat(None).await?; // None for first call
let resp = client.post_heartbeat(Some(resp.heartbeat_id)).await?;
```
</CodeGroup>
* Include the most recent `heartbeat_id` in each request. Use an empty string for the first request.
@@ -531,3 +692,6 @@ The heartbeat endpoint maintains session liveness. If a valid heartbeat is not r
Attribute orders to your builder account for volume credit
</Card>
</CardGroup>
Built with [Mintlify](https://mintlify.com).
+167 -3
View File
@@ -80,9 +80,29 @@ The simplest way to place a limit order — create, sign, and submit in one call
print("Order ID:", response["orderID"])
print("Status:", response["status"])
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::Side;
use polymarket_client_sdk::types::dec;
let token_id = "TOKEN_ID".parse()?;
let order = client
.limit_order()
.token_id(token_id)
.price(dec!(0.50))
.size(dec!(10))
.side(Side::Buy)
.build()
.await?;
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
println!("Order ID: {}", response.order_id);
println!("Status: {:?}", response.status);
```
</CodeGroup>
### Two-Step: Sign Then Submit
### Two-Step Sign Then Submit
For more control, you can separate signing from submission. This is useful for batch orders or custom submission logic:
@@ -121,11 +141,27 @@ For more control, you can separate signing from submission. This is useful for b
# Step 2: Submit to the CLOB
response = client.post_order(signed_order, OrderType.GTC)
```
```rust Rust theme={null}
// Step 1: Create order (auto-fetches tick size, neg risk, fee rate)
let order = client
.limit_order()
.token_id("TOKEN_ID".parse()?)
.price(dec!(0.50))
.size(dec!(10))
.side(Side::Buy)
.build()
.await?;
// Step 2: Sign and submit separately
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
```
</CodeGroup>
***
## GTD Orders (Expiring)
## GTD Orders
GTD orders auto-expire at a specified time. Useful for quoting around known events.
@@ -168,6 +204,24 @@ GTD orders auto-expire at a specified time. Useful for quoting around known even
order_type=OrderType.GTD
)
```
```rust Rust theme={null}
use chrono::{TimeDelta, Utc};
use polymarket_client_sdk::clob::types::OrderType;
let order = client
.limit_order()
.token_id("TOKEN_ID".parse()?)
.price(dec!(0.50))
.size(dec!(10))
.side(Side::Buy)
.order_type(OrderType::GTD)
.expiration(Utc::now() + TimeDelta::hours(1))
.build()
.await?;
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
```
</CodeGroup>
<Note>
@@ -235,6 +289,38 @@ Market orders execute immediately against resting liquidity using FOK or FAK typ
)
client.post_order(sell_order, OrderType.FOK)
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::{Amount, OrderType, Side};
let token_id = "TOKEN_ID".parse()?;
// FOK BUY: spend exactly $100 or cancel entirely
let buy = client
.market_order()
.token_id(token_id)
.amount(Amount::usdc(dec!(100))?)
.price(dec!(0.50)) // worst-price limit (slippage protection)
.side(Side::Buy)
.order_type(OrderType::FOK)
.build()
.await?;
let signed = client.sign(&signer, buy).await?;
client.post_order(signed).await?;
// FOK SELL: sell exactly 200 shares or cancel entirely
let sell = client
.market_order()
.token_id(token_id)
.amount(Amount::shares(dec!(200))?)
.price(dec!(0.45)) // worst-price limit (slippage protection)
.side(Side::Sell)
.order_type(OrderType::FOK)
.build()
.await?;
let signed = client.sign(&signer, sell).await?;
client.post_order(signed).await?;
```
</CodeGroup>
* **FOK** — fill entirely or cancel the whole order
@@ -270,6 +356,20 @@ For convenience, `createAndPostMarketOrder` handles creation, signing, and submi
order_type=OrderType.FOK,
)
```
```rust Rust theme={null}
let order = client
.market_order()
.token_id("TOKEN_ID".parse()?)
.amount(Amount::usdc(dec!(100))?)
.price(dec!(0.50))
.side(Side::Buy)
.order_type(OrderType::FOK)
.build()
.await?;
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
```
</CodeGroup>
***
@@ -286,6 +386,20 @@ Post-only orders guarantee you're always the maker. If the order would match imm
```python Python theme={null}
response = client.post_order(signed_order, OrderType.GTC, post_only=True)
```
```rust Rust theme={null}
let order = client
.limit_order()
.token_id("TOKEN_ID".parse()?)
.price(dec!(0.50))
.size(dec!(10))
.side(Side::Buy)
.post_only(true)
.build()
.await?;
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
```
</CodeGroup>
* Only works with **GTC** and **GTD** order types
@@ -356,6 +470,31 @@ Place up to **15 orders** in a single request:
),
])
```
```rust Rust theme={null}
let token_id = "TOKEN_ID".parse()?;
let bid = client
.limit_order()
.token_id(token_id)
.price(dec!(0.48))
.size(dec!(500))
.side(Side::Buy)
.build()
.await?;
let ask = client
.limit_order()
.token_id(token_id)
.price(dec!(0.52))
.size(dec!(500))
.side(Side::Sell)
.build()
.await?;
let signed_bid = client.sign(&signer, bid).await?;
let signed_ask = client.sign(&signer, ask).await?;
let response = client.post_orders(vec![signed_bid, signed_ask]).await?;
```
</CodeGroup>
***
@@ -383,6 +522,11 @@ Your order price must conform to the market's tick size, or the order is rejecte
```python Python theme={null}
tick_size = client.get_tick_size("TOKEN_ID")
```
```rust Rust theme={null}
let token_id = "TOKEN_ID".parse()?;
let tick_size = client.tick_size(token_id).await?;
```
</CodeGroup>
### Negative Risk
@@ -397,11 +541,16 @@ Multi-outcome events (3+ outcomes) use the Neg Risk CTF Exchange. Pass `negRisk:
```python Python theme={null}
is_neg_risk = client.get_neg_risk("TOKEN_ID")
```
```rust Rust theme={null}
let token_id = "TOKEN_ID".parse()?;
let is_neg_risk = client.neg_risk(token_id).await?;
```
</CodeGroup>
<Tip>
Both values are also available on the market object: `minimum_tick_size` and
`neg_risk`.
`neg_risk`. In Rust, the order builder auto-fetches both — you don't need to look them up manually.
</Tip>
***
@@ -513,6 +662,18 @@ The heartbeat endpoint maintains session liveness. If a valid heartbeat is not r
heartbeat_id = resp["heartbeat_id"]
time.sleep(5)
```
```rust Rust theme={null}
// With the `heartbeats` feature, the Rust SDK can auto-send heartbeats
// in a background task — no manual loop needed:
Client::start_heartbeats(&mut client)?;
// ... your trading logic ...
client.stop_heartbeats().await?;
// Or send manually:
let resp = client.post_heartbeat(None).await?; // None for first call
let resp = client.post_heartbeat(Some(resp.heartbeat_id)).await?;
```
</CodeGroup>
* Include the most recent `heartbeat_id` in each request. Use an empty string for the first request.
@@ -531,3 +692,6 @@ The heartbeat endpoint maintains session liveness. If a valid heartbeat is not r
Attribute orders to your builder account for volume credit
</Card>
</CardGroup>
Built with [Mintlify](https://mintlify.com).
@@ -71,6 +71,11 @@ Retrieve the tick size for a market using the SDK:
tick_size = client.get_tick_size(token_id)
# Returns: "0.1" | "0.01" | "0.001" | "0.0001"
```
```rust Rust theme={null}
let resp = client.tick_size(token_id).await?;
// resp.minimum_tick_size: TickSize::Tenth | Hundredth | Thousandth | TenThousandth
```
</CodeGroup>
<Tip>
@@ -114,6 +119,21 @@ Multi-outcome events (e.g., "Who will win the election?" with 3+ candidates) use
}
)
```
```rust Rust theme={null}
// The Rust SDK auto-detects neg risk from the token ID — no flag needed.
// The order builder fetches neg_risk and uses the correct exchange contract.
let order = client
.limit_order()
.token_id("TOKEN_ID".parse()?)
.price(dec!(0.50))
.size(dec!(10))
.side(Side::Buy)
.build()
.await?;
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
```
</CodeGroup>
You can check whether a market uses negative risk via the SDK or the market object's `neg_risk` field:
@@ -126,6 +146,10 @@ You can check whether a market uses negative risk via the SDK or the market obje
```python Python theme={null}
is_neg_risk = client.get_neg_risk(token_id)
```
```rust Rust theme={null}
let is_neg_risk = client.neg_risk(token_id).await?;
```
</CodeGroup>
***
@@ -165,7 +189,7 @@ $$
## Querying Orders
All query endpoints require [L2 authentication](/api-reference/authentication).
All query endpoints require [L2 authentication](/api-reference/authentication). [Builder-authenticated](/trading/clients/builder) clients can also query orders attributed to their builder account using the same methods.
### Get a Single Order
@@ -181,6 +205,11 @@ Retrieve details for a specific order by its ID:
order = client.get_order("0xb816482a...")
print(order)
```
```rust Rust theme={null}
let order = client.order("0xb816482a...").await?;
println!("{order:?}");
```
</CodeGroup>
### Get Open Orders
@@ -216,6 +245,25 @@ Retrieve your open orders, optionally filtered by market or asset:
)
)
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::request::OrdersRequest;
// All open orders
let orders = client.orders(&OrdersRequest::default(), None).await?;
// Filtered by market
let request = OrdersRequest::builder()
.market("0xbd31dc8a...".parse()?)
.build();
let market_orders = client.orders(&request, None).await?;
// Filtered by asset
let request = OrdersRequest::builder()
.asset_id("52114319501245...".parse()?)
.build();
let asset_orders = client.orders(&request, None).await?;
```
</CodeGroup>
### OpenOrder Object
@@ -325,6 +373,19 @@ Retrieve your trades with the SDK:
)
)
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::request::TradesRequest;
// All trades
let trades = client.trades(&TradesRequest::default(), None).await?;
// Filtered by market
let request = TradesRequest::builder()
.market("0xbd31dc8a...".parse()?)
.build();
let market_trades = client.trades(&request, None).await?;
```
</CodeGroup>
***
@@ -352,6 +413,15 @@ The heartbeat endpoint maintains session liveness for order safety. If a valid h
heartbeat_id = resp["heartbeat_id"]
time.sleep(5)
```
```rust Rust theme={null}
// With the `heartbeats` feature, auto-send in background:
Client::start_heartbeats(&mut client)?;
// Or manually:
let resp = client.post_heartbeat(None).await?; // None for first call
let resp = client.post_heartbeat(Some(resp.heartbeat_id)).await?;
```
</CodeGroup>
* On each request, include the most recent `heartbeat_id` you received. For your first request, use an empty string.
@@ -388,6 +458,15 @@ Check if your resting orders are eligible for [maker rebates](/market-makers/mak
OrdersScoringParams(orderIds=["0x...", "0x..."])
)
```
```rust Rust theme={null}
// Single order
let scoring = client.is_order_scoring("0x...").await?;
println!("Scoring: {}", scoring.scoring);
// Multiple orders
let batch = client.are_orders_scoring(&["0x...", "0x..."]).await?;
```
</CodeGroup>
***
@@ -461,3 +540,6 @@ The operator's privileges are limited to order matching and ensuring correct ord
Cancel single, multiple, or all orders
</Card>
</CardGroup>
Built with [Mintlify](https://mintlify.com).
+83 -1
View File
@@ -71,6 +71,11 @@ Retrieve the tick size for a market using the SDK:
tick_size = client.get_tick_size(token_id)
# Returns: "0.1" | "0.01" | "0.001" | "0.0001"
```
```rust Rust theme={null}
let resp = client.tick_size(token_id).await?;
// resp.minimum_tick_size: TickSize::Tenth | Hundredth | Thousandth | TenThousandth
```
</CodeGroup>
<Tip>
@@ -114,6 +119,21 @@ Multi-outcome events (e.g., "Who will win the election?" with 3+ candidates) use
}
)
```
```rust Rust theme={null}
// The Rust SDK auto-detects neg risk from the token ID — no flag needed.
// The order builder fetches neg_risk and uses the correct exchange contract.
let order = client
.limit_order()
.token_id("TOKEN_ID".parse()?)
.price(dec!(0.50))
.size(dec!(10))
.side(Side::Buy)
.build()
.await?;
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
```
</CodeGroup>
You can check whether a market uses negative risk via the SDK or the market object's `neg_risk` field:
@@ -126,6 +146,10 @@ You can check whether a market uses negative risk via the SDK or the market obje
```python Python theme={null}
is_neg_risk = client.get_neg_risk(token_id)
```
```rust Rust theme={null}
let is_neg_risk = client.neg_risk(token_id).await?;
```
</CodeGroup>
***
@@ -165,7 +189,7 @@ $$
## Querying Orders
All query endpoints require [L2 authentication](/api-reference/authentication).
All query endpoints require [L2 authentication](/api-reference/authentication). [Builder-authenticated](/trading/clients/builder) clients can also query orders attributed to their builder account using the same methods.
### Get a Single Order
@@ -181,6 +205,11 @@ Retrieve details for a specific order by its ID:
order = client.get_order("0xb816482a...")
print(order)
```
```rust Rust theme={null}
let order = client.order("0xb816482a...").await?;
println!("{order:?}");
```
</CodeGroup>
### Get Open Orders
@@ -216,6 +245,25 @@ Retrieve your open orders, optionally filtered by market or asset:
)
)
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::request::OrdersRequest;
// All open orders
let orders = client.orders(&OrdersRequest::default(), None).await?;
// Filtered by market
let request = OrdersRequest::builder()
.market("0xbd31dc8a...".parse()?)
.build();
let market_orders = client.orders(&request, None).await?;
// Filtered by asset
let request = OrdersRequest::builder()
.asset_id("52114319501245...".parse()?)
.build();
let asset_orders = client.orders(&request, None).await?;
```
</CodeGroup>
### OpenOrder Object
@@ -325,6 +373,19 @@ Retrieve your trades with the SDK:
)
)
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::request::TradesRequest;
// All trades
let trades = client.trades(&TradesRequest::default(), None).await?;
// Filtered by market
let request = TradesRequest::builder()
.market("0xbd31dc8a...".parse()?)
.build();
let market_trades = client.trades(&request, None).await?;
```
</CodeGroup>
***
@@ -352,6 +413,15 @@ The heartbeat endpoint maintains session liveness for order safety. If a valid h
heartbeat_id = resp["heartbeat_id"]
time.sleep(5)
```
```rust Rust theme={null}
// With the `heartbeats` feature, auto-send in background:
Client::start_heartbeats(&mut client)?;
// Or manually:
let resp = client.post_heartbeat(None).await?; // None for first call
let resp = client.post_heartbeat(Some(resp.heartbeat_id)).await?;
```
</CodeGroup>
* On each request, include the most recent `heartbeat_id` you received. For your first request, use an empty string.
@@ -388,6 +458,15 @@ Check if your resting orders are eligible for [maker rebates](/market-makers/mak
OrdersScoringParams(orderIds=["0x...", "0x..."])
)
```
```rust Rust theme={null}
// Single order
let scoring = client.is_order_scoring("0x...").await?;
println!("Scoring: {}", scoring.scoring);
// Multiple orders
let batch = client.are_orders_scoring(&["0x...", "0x..."]).await?;
```
</CodeGroup>
***
@@ -461,3 +540,6 @@ The operator's privileges are limited to order matching and ensuring correct ord
Cancel single, multiple, or all orders
</Card>
</CardGroup>
Built with [Mintlify](https://mintlify.com).
@@ -71,6 +71,11 @@ Retrieve the tick size for a market using the SDK:
tick_size = client.get_tick_size(token_id)
# Returns: "0.1" | "0.01" | "0.001" | "0.0001"
```
```rust Rust theme={null}
let resp = client.tick_size(token_id).await?;
// resp.minimum_tick_size: TickSize::Tenth | Hundredth | Thousandth | TenThousandth
```
</CodeGroup>
<Tip>
@@ -114,6 +119,21 @@ Multi-outcome events (e.g., "Who will win the election?" with 3+ candidates) use
}
)
```
```rust Rust theme={null}
// The Rust SDK auto-detects neg risk from the token ID — no flag needed.
// The order builder fetches neg_risk and uses the correct exchange contract.
let order = client
.limit_order()
.token_id("TOKEN_ID".parse()?)
.price(dec!(0.50))
.size(dec!(10))
.side(Side::Buy)
.build()
.await?;
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
```
</CodeGroup>
You can check whether a market uses negative risk via the SDK or the market object's `neg_risk` field:
@@ -126,6 +146,10 @@ You can check whether a market uses negative risk via the SDK or the market obje
```python Python theme={null}
is_neg_risk = client.get_neg_risk(token_id)
```
```rust Rust theme={null}
let is_neg_risk = client.neg_risk(token_id).await?;
```
</CodeGroup>
***
@@ -165,7 +189,7 @@ $$
## Querying Orders
All query endpoints require [L2 authentication](/api-reference/authentication).
All query endpoints require [L2 authentication](/api-reference/authentication). [Builder-authenticated](/trading/clients/builder) clients can also query orders attributed to their builder account using the same methods.
### Get a Single Order
@@ -181,6 +205,11 @@ Retrieve details for a specific order by its ID:
order = client.get_order("0xb816482a...")
print(order)
```
```rust Rust theme={null}
let order = client.order("0xb816482a...").await?;
println!("{order:?}");
```
</CodeGroup>
### Get Open Orders
@@ -216,6 +245,25 @@ Retrieve your open orders, optionally filtered by market or asset:
)
)
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::request::OrdersRequest;
// All open orders
let orders = client.orders(&OrdersRequest::default(), None).await?;
// Filtered by market
let request = OrdersRequest::builder()
.market("0xbd31dc8a...".parse()?)
.build();
let market_orders = client.orders(&request, None).await?;
// Filtered by asset
let request = OrdersRequest::builder()
.asset_id("52114319501245...".parse()?)
.build();
let asset_orders = client.orders(&request, None).await?;
```
</CodeGroup>
### OpenOrder Object
@@ -325,6 +373,19 @@ Retrieve your trades with the SDK:
)
)
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::request::TradesRequest;
// All trades
let trades = client.trades(&TradesRequest::default(), None).await?;
// Filtered by market
let request = TradesRequest::builder()
.market("0xbd31dc8a...".parse()?)
.build();
let market_trades = client.trades(&request, None).await?;
```
</CodeGroup>
***
@@ -352,6 +413,15 @@ The heartbeat endpoint maintains session liveness for order safety. If a valid h
heartbeat_id = resp["heartbeat_id"]
time.sleep(5)
```
```rust Rust theme={null}
// With the `heartbeats` feature, auto-send in background:
Client::start_heartbeats(&mut client)?;
// Or manually:
let resp = client.post_heartbeat(None).await?; // None for first call
let resp = client.post_heartbeat(Some(resp.heartbeat_id)).await?;
```
</CodeGroup>
* On each request, include the most recent `heartbeat_id` you received. For your first request, use an empty string.
@@ -388,6 +458,15 @@ Check if your resting orders are eligible for [maker rebates](/market-makers/mak
OrdersScoringParams(orderIds=["0x...", "0x..."])
)
```
```rust Rust theme={null}
// Single order
let scoring = client.is_order_scoring("0x...").await?;
println!("Scoring: {}", scoring.scoring);
// Multiple orders
let batch = client.are_orders_scoring(&["0x...", "0x..."]).await?;
```
</CodeGroup>
***
@@ -461,3 +540,6 @@ The operator's privileges are limited to order matching and ensuring correct ord
Cancel single, multiple, or all orders
</Card>
</CardGroup>
Built with [Mintlify](https://mintlify.com).
+83 -1
View File
@@ -71,6 +71,11 @@ Retrieve the tick size for a market using the SDK:
tick_size = client.get_tick_size(token_id)
# Returns: "0.1" | "0.01" | "0.001" | "0.0001"
```
```rust Rust theme={null}
let resp = client.tick_size(token_id).await?;
// resp.minimum_tick_size: TickSize::Tenth | Hundredth | Thousandth | TenThousandth
```
</CodeGroup>
<Tip>
@@ -114,6 +119,21 @@ Multi-outcome events (e.g., "Who will win the election?" with 3+ candidates) use
}
)
```
```rust Rust theme={null}
// The Rust SDK auto-detects neg risk from the token ID — no flag needed.
// The order builder fetches neg_risk and uses the correct exchange contract.
let order = client
.limit_order()
.token_id("TOKEN_ID".parse()?)
.price(dec!(0.50))
.size(dec!(10))
.side(Side::Buy)
.build()
.await?;
let signed = client.sign(&signer, order).await?;
let response = client.post_order(signed).await?;
```
</CodeGroup>
You can check whether a market uses negative risk via the SDK or the market object's `neg_risk` field:
@@ -126,6 +146,10 @@ You can check whether a market uses negative risk via the SDK or the market obje
```python Python theme={null}
is_neg_risk = client.get_neg_risk(token_id)
```
```rust Rust theme={null}
let is_neg_risk = client.neg_risk(token_id).await?;
```
</CodeGroup>
***
@@ -165,7 +189,7 @@ $$
## Querying Orders
All query endpoints require [L2 authentication](/api-reference/authentication).
All query endpoints require [L2 authentication](/api-reference/authentication). [Builder-authenticated](/trading/clients/builder) clients can also query orders attributed to their builder account using the same methods.
### Get a Single Order
@@ -181,6 +205,11 @@ Retrieve details for a specific order by its ID:
order = client.get_order("0xb816482a...")
print(order)
```
```rust Rust theme={null}
let order = client.order("0xb816482a...").await?;
println!("{order:?}");
```
</CodeGroup>
### Get Open Orders
@@ -216,6 +245,25 @@ Retrieve your open orders, optionally filtered by market or asset:
)
)
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::request::OrdersRequest;
// All open orders
let orders = client.orders(&OrdersRequest::default(), None).await?;
// Filtered by market
let request = OrdersRequest::builder()
.market("0xbd31dc8a...".parse()?)
.build();
let market_orders = client.orders(&request, None).await?;
// Filtered by asset
let request = OrdersRequest::builder()
.asset_id("52114319501245...".parse()?)
.build();
let asset_orders = client.orders(&request, None).await?;
```
</CodeGroup>
### OpenOrder Object
@@ -325,6 +373,19 @@ Retrieve your trades with the SDK:
)
)
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::types::request::TradesRequest;
// All trades
let trades = client.trades(&TradesRequest::default(), None).await?;
// Filtered by market
let request = TradesRequest::builder()
.market("0xbd31dc8a...".parse()?)
.build();
let market_trades = client.trades(&request, None).await?;
```
</CodeGroup>
***
@@ -352,6 +413,15 @@ The heartbeat endpoint maintains session liveness for order safety. If a valid h
heartbeat_id = resp["heartbeat_id"]
time.sleep(5)
```
```rust Rust theme={null}
// With the `heartbeats` feature, auto-send in background:
Client::start_heartbeats(&mut client)?;
// Or manually:
let resp = client.post_heartbeat(None).await?; // None for first call
let resp = client.post_heartbeat(Some(resp.heartbeat_id)).await?;
```
</CodeGroup>
* On each request, include the most recent `heartbeat_id` you received. For your first request, use an empty string.
@@ -388,6 +458,15 @@ Check if your resting orders are eligible for [maker rebates](/market-makers/mak
OrdersScoringParams(orderIds=["0x...", "0x..."])
)
```
```rust Rust theme={null}
// Single order
let scoring = client.is_order_scoring("0x...").await?;
println!("Scoring: {}", scoring.scoring);
// Multiple orders
let batch = client.are_orders_scoring(&["0x...", "0x..."]).await?;
```
</CodeGroup>
***
@@ -461,3 +540,6 @@ The operator's privileges are limited to order matching and ensuring correct ord
Cancel single, multiple, or all orders
</Card>
</CardGroup>
Built with [Mintlify](https://mintlify.com).