docs: sync Polymarket documentation (2026-05-03)

Updated 55 files with latest documentation changes
This commit is contained in:
Etherdrake
2026-05-03 14:55:37 +02:00
parent 3695c0249e
commit a54a713360
58 changed files with 799 additions and 637 deletions
@@ -37,14 +37,14 @@ Builder attribution in V2 is handled natively through the order struct — you a
```
```python Python theme={null}
from py_clob_client.client import ClobClient
from py_clob_client.clob_types import OrderArgs
from py_clob_client.order_builder.constants import BUY
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=137,
chain_id=137,
key=os.getenv("PRIVATE_KEY"),
creds=creds,
signature_type=signature_type,
@@ -60,7 +60,7 @@ Builder attribution in V2 is handled natively through the order struct — you a
side=BUY,
builder_code=os.environ["POLY_BUILDER_CODE"],
),
options={"tick_size": "0.01", "neg_risk": False},
options=PartialCreateOrderOptions(tick_size="0.01", neg_risk=False),
)
```
</CodeGroup>
+47 -7
View File
@@ -14,9 +14,11 @@ L1 methods require the client to initialize with a signer.
<Tab title="TypeScript">
```typescript theme={null}
import { ClobClient } from "@polymarket/clob-client-v2";
import { Wallet } from "ethers";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
const signer = new Wallet(process.env.PRIVATE_KEY);
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const signer = createWalletClient({ account, transport: http() });
const client = new ClobClient({
host: "https://clob.polymarket.com",
@@ -31,14 +33,14 @@ L1 methods require the client to initialize with a signer.
<Tab title="Python">
```python theme={null}
from py_clob_client.client import ClobClient
from py_clob_client_v2 import ClobClient
import os
private_key = os.getenv("PRIVATE_KEY")
client = ClobClient(
host="https://clob.polymarket.com",
chain=137,
chain_id=137,
key=private_key # Signer required for L1 methods
)
@@ -134,6 +136,13 @@ async createOrDeriveApiKey(nonce?: number): Promise<ApiKeyCreds>
## Order Signing
<Note>
In CLOB V2, `expiration` is still accepted in order payloads for GTD/order
expiry handling, but it is not part of the EIP-712 signed order struct. The
signed struct uses `timestamp`, `metadata`, and `builder` instead of the V1
`expiration`, `nonce`, `feeRateBps`, and `taker` fields.
</Note>
### 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 submission logic. Submit via [`postOrder()`](/trading/clients/l2#postorder) or [`postOrders()`](/trading/clients/l2#postorders).
@@ -162,7 +171,8 @@ async createOrder(
</ResponseField>
<ResponseField name="expiration" type="number">
Optional expiration timestamp for the order. Optional.
Optional expiration timestamp included in the order payload for GTD/order
expiry handling. This is not part of the CLOB V2 EIP-712 signed order struct.
</ResponseField>
<ResponseField name="tickSize" type="TickSize">
@@ -202,7 +212,22 @@ async createOrder(
</ResponseField>
<ResponseField name="expiration" type="string">
The expiration timestamp as a string.
The expiration timestamp included in the order payload. This is not part of
the CLOB V2 EIP-712 signed order struct.
</ResponseField>
<ResponseField name="timestamp" type="string">
Order creation timestamp in milliseconds, used for order uniqueness in CLOB
V2.
</ResponseField>
<ResponseField name="metadata" type="string">
Reserved `bytes32` metadata field.
</ResponseField>
<ResponseField name="builder" type="string">
Builder code (`bytes32`) for attribution, or zero if no builder code is
attached.
</ResponseField>
<ResponseField name="signatureType" type="number">
@@ -275,7 +300,22 @@ async createMarketOrder(
</ResponseField>
<ResponseField name="expiration" type="string">
The expiration timestamp as a string.
The expiration timestamp included in the order payload. This is not part of
the CLOB V2 EIP-712 signed order struct.
</ResponseField>
<ResponseField name="timestamp" type="string">
Order creation timestamp in milliseconds, used for order uniqueness in CLOB
V2.
</ResponseField>
<ResponseField name="metadata" type="string">
Reserved `bytes32` metadata field.
</ResponseField>
<ResponseField name="builder" type="string">
Builder code (`bytes32`) for attribution, or zero if no builder code is
attached.
</ResponseField>
<ResponseField name="signatureType" type="number">
+8 -6
View File
@@ -14,12 +14,14 @@ L2 methods require the client to initialize with a signer, signature type, API c
<Tab title="TypeScript">
```typescript theme={null}
import { ClobClient } from "@polymarket/clob-client-v2";
import { Wallet } from "ethers";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
const signer = new Wallet(process.env.PRIVATE_KEY);
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const signer = createWalletClient({ account, transport: http() });
const apiCreds = {
apiKey: process.env.API_KEY,
key: process.env.API_KEY,
secret: process.env.SECRET,
passphrase: process.env.PASSPHRASE,
};
@@ -40,8 +42,8 @@ L2 methods require the client to initialize with a signer, signature type, API c
<Tab title="Python">
```python theme={null}
from py_clob_client.client import ClobClient
from py_clob_client.clob_types import ApiCreds
from py_clob_client_v2 import ClobClient
from py_clob_client_v2 import ApiCreds
import os
api_creds = ApiCreds(
@@ -52,7 +54,7 @@ L2 methods require the client to initialize with a signer, signature type, API c
client = ClobClient(
host="https://clob.polymarket.com",
chain=137,
chain_id=137,
key=os.getenv("PRIVATE_KEY"),
creds=api_creds,
signature_type=2, # GNOSIS_SAFE
@@ -12,7 +12,7 @@ Polymarket provides official open-source clients in TypeScript, Python, and Rust
<CodeGroup>
```bash TypeScript theme={null}
npm install @polymarket/clob-client-v2 ethers@5
npm install @polymarket/clob-client-v2 viem
```
```bash Python theme={null}
@@ -20,7 +20,7 @@ Polymarket provides official open-source clients in TypeScript, Python, and Rust
```
```bash Rust theme={null}
cargo add polymarket-client-sdk
cargo add polymarket_client_sdk_v2 --features clob
```
</CodeGroup>
@@ -41,12 +41,12 @@ Polymarket provides official open-source clients in TypeScript, Python, and Rust
```
```python Python theme={null}
from py_clob_client.client import ClobClient
from py_clob_client_v2 import ClobClient
client = ClobClient(
"https://clob.polymarket.com",
key=private_key,
chain=137,
chain_id=137,
creds=api_creds,
)
@@ -54,7 +54,7 @@ Polymarket provides official open-source clients in TypeScript, Python, and Rust
```
```rust Rust theme={null}
use polymarket_client_sdk::clob::{Client, Config};
use polymarket_client_sdk_v2::clob::{Client, Config};
let client = Client::new("https://clob.polymarket.com", Config::default())?
.authentication_builder(&signer)
@@ -71,7 +71,7 @@ Polymarket provides official open-source clients in TypeScript, Python, and Rust
| ---------- | ---------------------------- | ------------------------------------------------------------------------------------------ |
| TypeScript | `@polymarket/clob-client-v2` | [github.com/Polymarket/clob-client-v2](https://github.com/Polymarket/clob-client-v2) |
| Python | `py-clob-client-v2` | [github.com/Polymarket/py-clob-client-v2](https://github.com/Polymarket/py-clob-client-v2) |
| Rust | `polymarket-client-sdk` | [github.com/Polymarket/rs-clob-client-v2](https://github.com/Polymarket/rs-clob-client-v2) |
| Rust | `polymarket_client_sdk_v2` | [github.com/Polymarket/rs-clob-client-v2](https://github.com/Polymarket/rs-clob-client-v2) |
Each repository includes working examples in the `/examples` directory.
@@ -27,11 +27,11 @@ Public methods require the client to initialize with the host URL and Polygon ch
<Tab title="Python">
```python theme={null}
from py_clob_client.client import ClobClient
from py_clob_client_v2 import ClobClient
client = ClobClient(
host="https://clob.polymarket.com",
chain=137
chain_id=137
)
# Ready to call public methods