docs: sync Polymarket docs updates 2026-07-13 - add 90 new pages incl. Perps section
This commit is contained in:
@@ -0,0 +1,274 @@
|
||||
> ## 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.
|
||||
|
||||
# Auth
|
||||
|
||||
> Perps WebSocket authentication.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json auth
|
||||
id: auth
|
||||
title: Auth
|
||||
description: Authentication to access private channels.
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: AuthSend
|
||||
title: Auth send
|
||||
description: Authenticate connection
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_3
|
||||
id: Request
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Auth
|
||||
description: Authenticate this WebSocket connection for private channels
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: op
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: type
|
||||
type: string
|
||||
enumValues:
|
||||
- auth
|
||||
required: true
|
||||
- name: args
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: proxy
|
||||
type: string
|
||||
description: Proxy address in hex format
|
||||
required: true
|
||||
- name: secret
|
||||
type: string
|
||||
description: API secret
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-134>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-135>
|
||||
op:
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- args
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- auth
|
||||
x-parser-schema-id: <anonymous-schema-137>
|
||||
args:
|
||||
type: object
|
||||
required:
|
||||
- proxy
|
||||
- secret
|
||||
properties:
|
||||
proxy:
|
||||
type: string
|
||||
description: Proxy address in hex format
|
||||
example: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8'
|
||||
x-parser-schema-id: <anonymous-schema-139>
|
||||
secret:
|
||||
type: string
|
||||
description: API secret
|
||||
example: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
||||
x-parser-schema-id: <anonymous-schema-140>
|
||||
x-parser-schema-id: <anonymous-schema-138>
|
||||
x-parser-schema-id: <anonymous-schema-136>
|
||||
required:
|
||||
- req
|
||||
- op
|
||||
x-parser-schema-id: <anonymous-schema-133>
|
||||
title: Auth
|
||||
description: Authenticate this WebSocket connection for private channels
|
||||
example: |-
|
||||
{
|
||||
"req": "post",
|
||||
"op": {
|
||||
"type": "auth",
|
||||
"args": {
|
||||
"proxy": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
|
||||
"secret": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
|
||||
}
|
||||
}
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Request
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: auth
|
||||
- &ref_2
|
||||
id: AuthReceive
|
||||
title: Auth receive
|
||||
description: Auth response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_4
|
||||
id: Response
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Auth Response
|
||||
description: Authentication result
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of the
|
||||
API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`, `unauthorized`,
|
||||
`not_found`. For `400` it is a human-readable validation
|
||||
detail whose wording may change. See the Error handling
|
||||
guide for the domain identifiers. (Post-only /
|
||||
Fill-or-Kill outcomes are order statuses such as
|
||||
`post_only_rejected`, not rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-142>
|
||||
data:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-145>
|
||||
x-parser-schema-id: <anonymous-schema-144>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-147>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-148>
|
||||
x-parser-schema-id: <anonymous-schema-146>
|
||||
x-parser-schema-id: <anonymous-schema-143>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-141>
|
||||
title: Auth Response
|
||||
description: Authentication result
|
||||
example: |-
|
||||
{
|
||||
"id": 123,
|
||||
"data": {
|
||||
"status": "<string>",
|
||||
"error": "<string>"
|
||||
}
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Response
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
receiveOperations:
|
||||
- *ref_2
|
||||
sendMessages:
|
||||
- *ref_3
|
||||
receiveMessages:
|
||||
- *ref_4
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: auth
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,305 @@
|
||||
> ## 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.
|
||||
|
||||
# Auto Cancel
|
||||
|
||||
> Perps WebSocket dead man's switch updates.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json autoCancel
|
||||
id: autoCancel
|
||||
title: Auto-Cancel
|
||||
description: |
|
||||
Arm or clear the per-account auto-cancel schedule.
|
||||
Requires proxy signature, see [proxy signing](/http/signing#2-proxy-signing).
|
||||
|
||||
<Badge color="gray" size="md">Action Weight: **10**</Badge>
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: AutoCancelSend
|
||||
title: Auto cancel send
|
||||
description: Set or clear auto-cancel
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_3
|
||||
id: Request
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Auto-Cancel Request
|
||||
description: Client submits a signed auto-cancel request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: op
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: type
|
||||
type: string
|
||||
enumValues:
|
||||
- autoCancel
|
||||
required: true
|
||||
- name: args
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: time
|
||||
type: integer
|
||||
description: Timestamp in milliseconds
|
||||
required: true
|
||||
- name: sig
|
||||
type: string
|
||||
description: Signature in hex format
|
||||
required: true
|
||||
- name: salt
|
||||
type: integer
|
||||
description: Salt
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-96>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-97>
|
||||
op:
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- args
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- autoCancel
|
||||
x-parser-schema-id: <anonymous-schema-99>
|
||||
args:
|
||||
type: object
|
||||
required:
|
||||
- time
|
||||
properties:
|
||||
time:
|
||||
type: integer
|
||||
description: Timestamp in milliseconds
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-101>
|
||||
x-parser-schema-id: <anonymous-schema-100>
|
||||
x-parser-schema-id: <anonymous-schema-98>
|
||||
sig:
|
||||
type: string
|
||||
description: Signature in hex format
|
||||
example: 0x1234567890...
|
||||
x-parser-schema-id: <anonymous-schema-102>
|
||||
salt:
|
||||
type: integer
|
||||
description: Salt
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-103>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-104>
|
||||
required:
|
||||
- req
|
||||
- op
|
||||
- sig
|
||||
- salt
|
||||
- ts
|
||||
x-parser-schema-id: <anonymous-schema-95>
|
||||
title: Auto-Cancel Request
|
||||
description: Client submits a signed auto-cancel request
|
||||
example: |-
|
||||
{
|
||||
"req": "post",
|
||||
"op": {
|
||||
"type": "autoCancel",
|
||||
"args": {
|
||||
"time": 1767225600000
|
||||
}
|
||||
},
|
||||
"sig": "0x1234567890...",
|
||||
"salt": 1234567890,
|
||||
"ts": 1767225600000
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Request
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: autoCancel
|
||||
- &ref_2
|
||||
id: AutoCancelReceive
|
||||
title: Auto cancel receive
|
||||
description: Auto-cancel response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_4
|
||||
id: Response
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Auto-Cancel Response
|
||||
description: Server responds with auto-cancel result
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of the
|
||||
API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`, `unauthorized`,
|
||||
`not_found`. For `400` it is a human-readable validation
|
||||
detail whose wording may change. See the Error handling
|
||||
guide for the domain identifiers. (Post-only /
|
||||
Fill-or-Kill outcomes are order statuses such as
|
||||
`post_only_rejected`, not rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-106>
|
||||
data:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-109>
|
||||
x-parser-schema-id: <anonymous-schema-108>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-111>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-112>
|
||||
x-parser-schema-id: <anonymous-schema-110>
|
||||
x-parser-schema-id: <anonymous-schema-107>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-105>
|
||||
title: Auto-Cancel Response
|
||||
description: Server responds with auto-cancel result
|
||||
example: |-
|
||||
{
|
||||
"id": 5,
|
||||
"data": {
|
||||
"status": "ok"
|
||||
}
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Response
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
receiveOperations:
|
||||
- *ref_2
|
||||
sendMessages:
|
||||
- *ref_3
|
||||
receiveMessages:
|
||||
- *ref_4
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: autoCancel
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,586 @@
|
||||
> ## 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.
|
||||
|
||||
# Balances
|
||||
|
||||
> Perps WebSocket private balance updates.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json balances
|
||||
id: balances
|
||||
title: Balances
|
||||
description: >-
|
||||
Real-time balance updates. Pushed every 5 seconds. Requires authentication,
|
||||
see [Auth](/ws/auth).
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: BalancesSubscribe
|
||||
title: Balances subscribe
|
||||
description: Subscribe to balances
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_6
|
||||
id: SubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe
|
||||
description: Subscribe to private balance updates (requires prior auth)
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: 'Balances private channel: "balances"'
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
enumValues:
|
||||
- balances
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-514>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-515>
|
||||
chs:
|
||||
type: array
|
||||
description: 'Balances private channel: "balances"'
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- balances
|
||||
x-parser-schema-id: <anonymous-schema-517>
|
||||
example:
|
||||
- balances
|
||||
x-parser-schema-id: <anonymous-schema-516>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-513>
|
||||
title: Subscribe
|
||||
description: Subscribe to private balance updates (requires prior auth)
|
||||
example: |-
|
||||
{
|
||||
"req": "sub",
|
||||
"chs": [
|
||||
"balances"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeRequest
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: balances
|
||||
- &ref_3
|
||||
id: BalancesSubscribeResponse
|
||||
title: Balances subscribe response
|
||||
description: Balances subscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_8
|
||||
id: SubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe Response
|
||||
description: Response to balances subscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-519>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-523>
|
||||
x-parser-schema-id: <anonymous-schema-522>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-525>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-526>
|
||||
x-parser-schema-id: <anonymous-schema-524>
|
||||
x-parser-schema-id: <anonymous-schema-521>
|
||||
x-parser-schema-id: <anonymous-schema-520>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-518>
|
||||
title: Subscribe Response
|
||||
description: Response to balances subscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_2
|
||||
id: BalancesUnsubscribe
|
||||
title: Balances unsubscribe
|
||||
description: Unsubscribe from balances
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_7
|
||||
id: UnsubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe
|
||||
description: Unsubscribe from private balance updates
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: 'Balances private channel: "balances"'
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
enumValues:
|
||||
- balances
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-528>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-529>
|
||||
chs:
|
||||
type: array
|
||||
description: 'Balances private channel: "balances"'
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- balances
|
||||
x-parser-schema-id: <anonymous-schema-531>
|
||||
example:
|
||||
- balances
|
||||
x-parser-schema-id: <anonymous-schema-530>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-527>
|
||||
title: Unsubscribe
|
||||
description: Unsubscribe from private balance updates
|
||||
example: |-
|
||||
{
|
||||
"req": "unsub",
|
||||
"chs": [
|
||||
"balances"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeRequest
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_4
|
||||
id: BalancesUnsubscribeResponse
|
||||
title: Balances unsubscribe response
|
||||
description: Balances unsubscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_9
|
||||
id: UnsubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe Response
|
||||
description: Response to balances unsubscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-533>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-537>
|
||||
x-parser-schema-id: <anonymous-schema-536>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-539>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-540>
|
||||
x-parser-schema-id: <anonymous-schema-538>
|
||||
x-parser-schema-id: <anonymous-schema-535>
|
||||
x-parser-schema-id: <anonymous-schema-534>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-532>
|
||||
title: Unsubscribe Response
|
||||
description: Response to balances unsubscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_5
|
||||
id: BalancesUpdate
|
||||
title: Balances update
|
||||
description: Receive balance updates
|
||||
type: send
|
||||
messages:
|
||||
- &ref_10
|
||||
id: Update
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Update
|
||||
description: Balance updates pushed every 5 seconds
|
||||
type: object
|
||||
properties:
|
||||
- name: ch
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g.
|
||||
"fills", "orders").
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: sq
|
||||
type: integer
|
||||
description: Sequence number
|
||||
required: true
|
||||
- name: data
|
||||
type: object
|
||||
description: Balance object
|
||||
required: true
|
||||
properties:
|
||||
- name: asset
|
||||
type: string
|
||||
description: Asset name
|
||||
required: true
|
||||
- name: balance
|
||||
type: string
|
||||
description: Total balance
|
||||
required: true
|
||||
- name: value
|
||||
type: string
|
||||
description: USD value
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
title: Balances Update
|
||||
type: object
|
||||
properties:
|
||||
ch:
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g. "fills",
|
||||
"orders").
|
||||
example: trades::1
|
||||
x-parser-schema-id: <anonymous-schema-542>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-543>
|
||||
sq:
|
||||
type: integer
|
||||
description: Sequence number
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-544>
|
||||
data:
|
||||
type: object
|
||||
description: Balance object
|
||||
properties:
|
||||
asset:
|
||||
type: string
|
||||
description: Asset name
|
||||
example: USDC
|
||||
x-parser-schema-id: <anonymous-schema-546>
|
||||
balance:
|
||||
type: string
|
||||
description: Total balance
|
||||
example: '10000.00'
|
||||
x-parser-schema-id: <anonymous-schema-547>
|
||||
value:
|
||||
type: string
|
||||
description: USD value
|
||||
example: '10000.00'
|
||||
x-parser-schema-id: <anonymous-schema-548>
|
||||
required:
|
||||
- asset
|
||||
- balance
|
||||
- value
|
||||
x-parser-schema-id: <anonymous-schema-545>
|
||||
required:
|
||||
- ch
|
||||
- ts
|
||||
- sq
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-541>
|
||||
title: Update
|
||||
description: Balance updates pushed every 5 seconds
|
||||
example: |-
|
||||
{
|
||||
"ch": "balances",
|
||||
"ts": 1767225600000,
|
||||
"sq": 1234567890,
|
||||
"data": {
|
||||
"asset": "USDC",
|
||||
"balance": "10000.00",
|
||||
"value": "10000.00"
|
||||
}
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Update
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
- *ref_2
|
||||
receiveOperations:
|
||||
- *ref_3
|
||||
- *ref_4
|
||||
- *ref_5
|
||||
sendMessages:
|
||||
- *ref_6
|
||||
- *ref_7
|
||||
receiveMessages:
|
||||
- *ref_8
|
||||
- *ref_9
|
||||
- *ref_10
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: balances
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,606 @@
|
||||
> ## 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.
|
||||
|
||||
# BBO
|
||||
|
||||
> Perps WebSocket best bid and offer updates.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json bbo
|
||||
id: bbo
|
||||
title: BBO
|
||||
description: Best bid and offer real-time updates.
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: BBOSubscribe
|
||||
title: B b o subscribe
|
||||
description: Subscribe to BBO
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_6
|
||||
id: SubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe
|
||||
description: Subscribe to BBO updates for a specific instrument
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: |
|
||||
BBO subscription per instrument: `bbo::{iid}` (e.g. `bbo::1`).
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-190>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-191>
|
||||
chs:
|
||||
type: array
|
||||
description: |
|
||||
BBO subscription per instrument: `bbo::{iid}` (e.g. `bbo::1`).
|
||||
items:
|
||||
type: string
|
||||
pattern: ^bbo::\d+$
|
||||
x-parser-schema-id: <anonymous-schema-193>
|
||||
example:
|
||||
- bbo::1
|
||||
x-parser-schema-id: <anonymous-schema-192>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-189>
|
||||
title: Subscribe
|
||||
description: Subscribe to BBO updates for a specific instrument
|
||||
example: |-
|
||||
{
|
||||
"req": "sub",
|
||||
"chs": [
|
||||
"bbo::1"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeRequest
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: bbo
|
||||
- &ref_3
|
||||
id: BBOSubscribeResponse
|
||||
title: B b o subscribe response
|
||||
description: BBO subscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_8
|
||||
id: SubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe Response
|
||||
description: Response to BBO subscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-195>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-199>
|
||||
x-parser-schema-id: <anonymous-schema-198>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-201>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-202>
|
||||
x-parser-schema-id: <anonymous-schema-200>
|
||||
x-parser-schema-id: <anonymous-schema-197>
|
||||
x-parser-schema-id: <anonymous-schema-196>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-194>
|
||||
title: Subscribe Response
|
||||
description: Response to BBO subscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_2
|
||||
id: BBOUnsubscribe
|
||||
title: B b o unsubscribe
|
||||
description: Unsubscribe from BBO
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_7
|
||||
id: UnsubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe
|
||||
description: Unsubscribe from BBO updates
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: |
|
||||
BBO subscription per instrument: `bbo::{iid}` (e.g. `bbo::1`).
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-204>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-205>
|
||||
chs:
|
||||
type: array
|
||||
description: |
|
||||
BBO subscription per instrument: `bbo::{iid}` (e.g. `bbo::1`).
|
||||
items:
|
||||
type: string
|
||||
pattern: ^bbo::\d+$
|
||||
x-parser-schema-id: <anonymous-schema-207>
|
||||
example:
|
||||
- bbo::1
|
||||
x-parser-schema-id: <anonymous-schema-206>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-203>
|
||||
title: Unsubscribe
|
||||
description: Unsubscribe from BBO updates
|
||||
example: |-
|
||||
{
|
||||
"req": "unsub",
|
||||
"chs": [
|
||||
"bbo::1"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeRequest
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_4
|
||||
id: BBOUnsubscribeResponse
|
||||
title: B b o unsubscribe response
|
||||
description: BBO unsubscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_9
|
||||
id: UnsubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe Response
|
||||
description: Response to BBO unsubscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-209>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-213>
|
||||
x-parser-schema-id: <anonymous-schema-212>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-215>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-216>
|
||||
x-parser-schema-id: <anonymous-schema-214>
|
||||
x-parser-schema-id: <anonymous-schema-211>
|
||||
x-parser-schema-id: <anonymous-schema-210>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-208>
|
||||
title: Unsubscribe Response
|
||||
description: Response to BBO unsubscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_5
|
||||
id: BBOUpdate
|
||||
title: B b o update
|
||||
description: Receive BBO updates
|
||||
type: send
|
||||
messages:
|
||||
- &ref_10
|
||||
id: Update
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Update
|
||||
description: Real-time BBO updates for subscribed instruments
|
||||
type: object
|
||||
properties:
|
||||
- name: ch
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g.
|
||||
"fills", "orders").
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: sq
|
||||
type: integer
|
||||
description: Sequence number
|
||||
required: true
|
||||
- name: data
|
||||
type: object
|
||||
title: BBO Data
|
||||
description: BBO object
|
||||
required: true
|
||||
properties:
|
||||
- name: iid
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
required: true
|
||||
- name: bp
|
||||
type: string
|
||||
description: Best bid price
|
||||
required: true
|
||||
- name: bq
|
||||
type: string
|
||||
description: Best bid quantity
|
||||
required: true
|
||||
- name: ap
|
||||
type: string
|
||||
description: Best ask price
|
||||
required: true
|
||||
- name: aq
|
||||
type: string
|
||||
description: Best ask quantity
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
title: BBO Update
|
||||
type: object
|
||||
properties:
|
||||
ch:
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g. "fills",
|
||||
"orders").
|
||||
example: trades::1
|
||||
x-parser-schema-id: <anonymous-schema-218>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-219>
|
||||
sq:
|
||||
type: integer
|
||||
description: Sequence number
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-220>
|
||||
data:
|
||||
type: object
|
||||
description: BBO object
|
||||
title: BBO Data
|
||||
properties:
|
||||
iid:
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
example: 1
|
||||
x-parser-schema-id: <anonymous-schema-222>
|
||||
bp:
|
||||
type: string
|
||||
description: Best bid price
|
||||
example: '99.50'
|
||||
x-parser-schema-id: <anonymous-schema-223>
|
||||
bq:
|
||||
type: string
|
||||
description: Best bid quantity
|
||||
example: '10.00'
|
||||
x-parser-schema-id: <anonymous-schema-224>
|
||||
ap:
|
||||
type: string
|
||||
description: Best ask price
|
||||
example: '100.50'
|
||||
x-parser-schema-id: <anonymous-schema-225>
|
||||
aq:
|
||||
type: string
|
||||
description: Best ask quantity
|
||||
example: '10.00'
|
||||
x-parser-schema-id: <anonymous-schema-226>
|
||||
required:
|
||||
- iid
|
||||
- bp
|
||||
- bq
|
||||
- ap
|
||||
- aq
|
||||
x-parser-schema-id: <anonymous-schema-221>
|
||||
required:
|
||||
- ch
|
||||
- ts
|
||||
- sq
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-217>
|
||||
title: Update
|
||||
description: Real-time BBO updates for subscribed instruments
|
||||
example: |-
|
||||
{
|
||||
"ch": "bbo::1",
|
||||
"ts": 1767225600000,
|
||||
"sq": 1234567890,
|
||||
"data": {
|
||||
"iid": 1,
|
||||
"bp": "99.50",
|
||||
"bq": "10.00",
|
||||
"ap": "100.50",
|
||||
"aq": "10.00"
|
||||
}
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Update
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
- *ref_2
|
||||
receiveOperations:
|
||||
- *ref_3
|
||||
- *ref_4
|
||||
- *ref_5
|
||||
sendMessages:
|
||||
- *ref_6
|
||||
- *ref_7
|
||||
receiveMessages:
|
||||
- *ref_8
|
||||
- *ref_9
|
||||
- *ref_10
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: bbo
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,621 @@
|
||||
> ## 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.
|
||||
|
||||
# Book
|
||||
|
||||
> Perps WebSocket order book updates.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json book
|
||||
id: book
|
||||
title: Book
|
||||
description: Order book snapshot updates. Pushed every 100ms.
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: BookSubscribe
|
||||
title: Book subscribe
|
||||
description: Subscribe to book
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_6
|
||||
id: SubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe
|
||||
description: Subscribe to order book updates for an instrument
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: Book subscription in format "book::{iid}" (e.g., "book::1")
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-228>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-229>
|
||||
chs:
|
||||
type: array
|
||||
description: Book subscription in format "book::{iid}" (e.g., "book::1")
|
||||
items:
|
||||
type: string
|
||||
pattern: ^book::\d+$
|
||||
x-parser-schema-id: <anonymous-schema-231>
|
||||
example:
|
||||
- book::1
|
||||
x-parser-schema-id: <anonymous-schema-230>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-227>
|
||||
title: Subscribe
|
||||
description: Subscribe to order book updates for an instrument
|
||||
example: |-
|
||||
{
|
||||
"req": "sub",
|
||||
"chs": [
|
||||
"book::1"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeRequest
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: book
|
||||
- &ref_3
|
||||
id: BookSubscribeResponse
|
||||
title: Book subscribe response
|
||||
description: Book subscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_8
|
||||
id: SubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe Response
|
||||
description: Response to book subscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-233>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-237>
|
||||
x-parser-schema-id: <anonymous-schema-236>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-239>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-240>
|
||||
x-parser-schema-id: <anonymous-schema-238>
|
||||
x-parser-schema-id: <anonymous-schema-235>
|
||||
x-parser-schema-id: <anonymous-schema-234>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-232>
|
||||
title: Subscribe Response
|
||||
description: Response to book subscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_2
|
||||
id: BookUnsubscribe
|
||||
title: Book unsubscribe
|
||||
description: Unsubscribe from book
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_7
|
||||
id: UnsubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe
|
||||
description: Unsubscribe from order book updates
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: Book subscription in format "book::{iid}" (e.g., "book::1")
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-242>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-243>
|
||||
chs:
|
||||
type: array
|
||||
description: Book subscription in format "book::{iid}" (e.g., "book::1")
|
||||
items:
|
||||
type: string
|
||||
pattern: ^book::\d+$
|
||||
x-parser-schema-id: <anonymous-schema-245>
|
||||
example:
|
||||
- book::1
|
||||
x-parser-schema-id: <anonymous-schema-244>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-241>
|
||||
title: Unsubscribe
|
||||
description: Unsubscribe from order book updates
|
||||
example: |-
|
||||
{
|
||||
"req": "unsub",
|
||||
"chs": [
|
||||
"book::1"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeRequest
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_4
|
||||
id: BookUnsubscribeResponse
|
||||
title: Book unsubscribe response
|
||||
description: Book unsubscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_9
|
||||
id: UnsubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe Response
|
||||
description: Response to book unsubscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-247>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-251>
|
||||
x-parser-schema-id: <anonymous-schema-250>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-253>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-254>
|
||||
x-parser-schema-id: <anonymous-schema-252>
|
||||
x-parser-schema-id: <anonymous-schema-249>
|
||||
x-parser-schema-id: <anonymous-schema-248>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-246>
|
||||
title: Unsubscribe Response
|
||||
description: Response to book unsubscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_5
|
||||
id: BookUpdate
|
||||
title: Book update
|
||||
description: Receive book updates
|
||||
type: send
|
||||
messages:
|
||||
- &ref_10
|
||||
id: Update
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Update
|
||||
description: Real-time order book updates for subscribed instruments
|
||||
type: object
|
||||
properties:
|
||||
- name: ch
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g.
|
||||
"fills", "orders").
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: sq
|
||||
type: integer
|
||||
description: Sequence number
|
||||
required: true
|
||||
- name: data
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: b
|
||||
type: array
|
||||
description: Bid levels
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: array
|
||||
description: |
|
||||
- `"100.00"` - Price
|
||||
- `"10.00"` - Quantity
|
||||
required: false
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
required: false
|
||||
- name: a
|
||||
type: array
|
||||
description: Ask levels
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: array
|
||||
description: |
|
||||
- `"100.00"` - Price
|
||||
- `"10.00"` - Quantity
|
||||
required: false
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
title: Book Update
|
||||
type: object
|
||||
properties:
|
||||
ch:
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g. "fills",
|
||||
"orders").
|
||||
example: trades::1
|
||||
x-parser-schema-id: <anonymous-schema-256>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-257>
|
||||
sq:
|
||||
type: integer
|
||||
description: Sequence number
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-258>
|
||||
data:
|
||||
type: object
|
||||
required:
|
||||
- b
|
||||
- a
|
||||
properties:
|
||||
b:
|
||||
type: array
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
x-parser-schema-id: <anonymous-schema-262>
|
||||
maxItems: 2
|
||||
description: |
|
||||
- `"100.00"` - Price
|
||||
- `"10.00"` - Quantity
|
||||
example:
|
||||
- '100.00'
|
||||
- '10.00'
|
||||
x-parser-schema-id: <anonymous-schema-261>
|
||||
description: Bid levels
|
||||
x-parser-schema-id: <anonymous-schema-260>
|
||||
a:
|
||||
type: array
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
x-parser-schema-id: <anonymous-schema-265>
|
||||
maxItems: 2
|
||||
description: |
|
||||
- `"100.00"` - Price
|
||||
- `"10.00"` - Quantity
|
||||
example:
|
||||
- '100.00'
|
||||
- '10.00'
|
||||
x-parser-schema-id: <anonymous-schema-264>
|
||||
description: Ask levels
|
||||
x-parser-schema-id: <anonymous-schema-263>
|
||||
x-parser-schema-id: <anonymous-schema-259>
|
||||
required:
|
||||
- ch
|
||||
- ts
|
||||
- sq
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-255>
|
||||
title: Update
|
||||
description: Real-time order book updates for subscribed instruments
|
||||
example: |-
|
||||
{
|
||||
"ch": "book::1",
|
||||
"ts": 1767225600000,
|
||||
"sq": 1234567890,
|
||||
"data": {
|
||||
"b": [
|
||||
[
|
||||
"100.00",
|
||||
"10.00"
|
||||
]
|
||||
],
|
||||
"a": [
|
||||
[
|
||||
"100.00",
|
||||
"10.00"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Update
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
- *ref_2
|
||||
receiveOperations:
|
||||
- *ref_3
|
||||
- *ref_4
|
||||
- *ref_5
|
||||
sendMessages:
|
||||
- *ref_6
|
||||
- *ref_7
|
||||
receiveMessages:
|
||||
- *ref_8
|
||||
- *ref_9
|
||||
- *ref_10
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: book
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,406 @@
|
||||
> ## 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.
|
||||
|
||||
# Cancel Orders by Client Order ID
|
||||
|
||||
> Perps WebSocket order cancellation by client order ID.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json cancelOrdersCOID
|
||||
id: cancelOrdersCOID
|
||||
title: Cancel Orders COID
|
||||
description: |
|
||||
Cancel orders by client order ID.
|
||||
Requires proxy signature, see [proxy signing](/http/signing#2-proxy-signing).
|
||||
|
||||
<Badge color="gray" size="md">Action Weight: **0**</Badge>
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: CancelOrdersCOIDSend
|
||||
title: Cancel orders c o i d send
|
||||
description: Cancel orders by client order ID
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_3
|
||||
id: Request
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Cancel Orders COID Request
|
||||
description: Client submits a signed cancel-by-client-order-id request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: op
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: type
|
||||
type: string
|
||||
enumValues:
|
||||
- cancelOrdersCOID
|
||||
required: true
|
||||
- name: args
|
||||
type: array
|
||||
description: >
|
||||
Array of client order IDs to cancel. Cancelling an order
|
||||
that has
|
||||
|
||||
attached take-profit / stop-loss children (see
|
||||
`CreateOrder.tr`)
|
||||
|
||||
cascades to those children — they are cancelled with
|
||||
reason
|
||||
|
||||
`ParentCancelled`.
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
description: Client order ID
|
||||
required: false
|
||||
- name: sig
|
||||
type: string
|
||||
description: Signature in hex format
|
||||
required: true
|
||||
- name: salt
|
||||
type: integer
|
||||
description: Salt
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: exp
|
||||
type: integer
|
||||
description: >-
|
||||
Command expiry timestamp in Unix milliseconds. If provided, it
|
||||
must be in the future and within the gateway's default command
|
||||
timeout. It can shorten request validity but cannot extend it.
|
||||
This is not an order auto-cancel time.
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-72>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-73>
|
||||
op:
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- args
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- cancelOrdersCOID
|
||||
x-parser-schema-id: <anonymous-schema-75>
|
||||
args:
|
||||
type: array
|
||||
description: >
|
||||
Array of client order IDs to cancel. Cancelling an order
|
||||
that has
|
||||
|
||||
attached take-profit / stop-loss children (see
|
||||
`CreateOrder.tr`)
|
||||
|
||||
cascades to those children — they are cancelled with reason
|
||||
|
||||
`ParentCancelled`.
|
||||
items:
|
||||
type: string
|
||||
description: Client order ID
|
||||
minLength: 32
|
||||
maxLength: 32
|
||||
pattern: ^[0-9a-f]{32}$
|
||||
example: 550e8400e29b41d4a716446655440000
|
||||
x-parser-schema-id: <anonymous-schema-77>
|
||||
x-parser-schema-id: <anonymous-schema-76>
|
||||
x-parser-schema-id: <anonymous-schema-74>
|
||||
sig:
|
||||
type: string
|
||||
description: Signature in hex format
|
||||
example: 0x1234567890...
|
||||
x-parser-schema-id: <anonymous-schema-78>
|
||||
salt:
|
||||
type: integer
|
||||
description: Salt
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-79>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-80>
|
||||
exp:
|
||||
type: integer
|
||||
description: >-
|
||||
Command expiry timestamp in Unix milliseconds. If provided, it
|
||||
must be in the future and within the gateway's default command
|
||||
timeout. It can shorten request validity but cannot extend it.
|
||||
This is not an order auto-cancel time.
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-81>
|
||||
required:
|
||||
- req
|
||||
- op
|
||||
- sig
|
||||
- salt
|
||||
- ts
|
||||
x-parser-schema-id: <anonymous-schema-71>
|
||||
title: Cancel Orders COID Request
|
||||
description: Client submits a signed cancel-by-client-order-id request
|
||||
example: |-
|
||||
{
|
||||
"req": "post",
|
||||
"op": {
|
||||
"type": "cancelOrdersCOID",
|
||||
"args": [
|
||||
"550e8400e29b41d4a716446655440000"
|
||||
]
|
||||
},
|
||||
"sig": "0x1234567890...",
|
||||
"salt": 1234567890,
|
||||
"ts": 1767225600000,
|
||||
"exp": 1767225600000
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Request
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: cancelOrdersCOID
|
||||
- &ref_2
|
||||
id: CancelOrdersCOIDReceive
|
||||
title: Cancel orders c o i d receive
|
||||
description: Cancel by client order ID response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_4
|
||||
id: Response
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Cancel Orders COID Response
|
||||
description: Server responds with cancel result for each client order ID
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
description: Array of cancel results
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: oid
|
||||
type: integer
|
||||
description: Order ID
|
||||
required: true
|
||||
- name: coid
|
||||
type: string
|
||||
description: Client order ID
|
||||
required: false
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: oid
|
||||
type: integer
|
||||
description: Order ID
|
||||
required: false
|
||||
- name: coid
|
||||
type: string
|
||||
description: Client order ID
|
||||
required: false
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-83>
|
||||
data:
|
||||
type: array
|
||||
description: Array of cancel results
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- oid
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-87>
|
||||
oid:
|
||||
type: integer
|
||||
description: Order ID
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-88>
|
||||
coid:
|
||||
type: string
|
||||
description: Client order ID
|
||||
minLength: 32
|
||||
maxLength: 32
|
||||
pattern: ^[0-9a-f]{32}$
|
||||
example: 550e8400e29b41d4a716446655440000
|
||||
x-parser-schema-id: <anonymous-schema-89>
|
||||
x-parser-schema-id: <anonymous-schema-86>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-91>
|
||||
oid:
|
||||
type: integer
|
||||
description: Order ID
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-92>
|
||||
coid:
|
||||
type: string
|
||||
description: Client order ID
|
||||
minLength: 32
|
||||
maxLength: 32
|
||||
pattern: ^[0-9a-f]{32}$
|
||||
example: 550e8400e29b41d4a716446655440000
|
||||
x-parser-schema-id: <anonymous-schema-93>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-94>
|
||||
x-parser-schema-id: <anonymous-schema-90>
|
||||
x-parser-schema-id: <anonymous-schema-85>
|
||||
x-parser-schema-id: <anonymous-schema-84>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-82>
|
||||
title: Cancel Orders COID Response
|
||||
description: Server responds with cancel result for each client order ID
|
||||
example: |-
|
||||
{
|
||||
"id": 3,
|
||||
"data": [
|
||||
{
|
||||
"status": "ok",
|
||||
"oid": 1234567890,
|
||||
"coid": "550e8400e29b41d4a716446655440000"
|
||||
},
|
||||
{
|
||||
"status": "ok",
|
||||
"oid": 1234567891,
|
||||
"coid": "550e8400e29b41d4a716446655440001"
|
||||
}
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Response
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
receiveOperations:
|
||||
- *ref_2
|
||||
sendMessages:
|
||||
- *ref_3
|
||||
receiveMessages:
|
||||
- *ref_4
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: cancelOrdersCOID
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,398 @@
|
||||
> ## 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.
|
||||
|
||||
# Cancel Orders
|
||||
|
||||
> Perps WebSocket order cancellation by order ID.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json cancelOrders
|
||||
id: cancelOrders
|
||||
title: Cancel Orders
|
||||
description: |
|
||||
Cancel orders.
|
||||
Requires proxy signature, see [proxy signing](/http/signing#2-proxy-signing).
|
||||
|
||||
<Badge color="gray" size="md">Action Weight: **0**</Badge>
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: CancelOrdersSend
|
||||
title: Cancel orders send
|
||||
description: Cancel orders
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_3
|
||||
id: Request
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Cancel Orders Request
|
||||
description: Client submits a signed order cancellation request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: op
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: type
|
||||
type: string
|
||||
enumValues:
|
||||
- cancelOrders
|
||||
required: true
|
||||
- name: args
|
||||
type: array
|
||||
description: >
|
||||
Array of order IDs to cancel. Cancelling an order that has
|
||||
attached
|
||||
|
||||
take-profit / stop-loss children (see `CreateOrder.tr`)
|
||||
cascades to
|
||||
|
||||
those children — they are cancelled with reason
|
||||
`ParentCancelled`.
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: integer
|
||||
description: Order ID
|
||||
required: false
|
||||
- name: sig
|
||||
type: string
|
||||
description: Signature in hex format
|
||||
required: true
|
||||
- name: salt
|
||||
type: integer
|
||||
description: Salt
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: exp
|
||||
type: integer
|
||||
description: >-
|
||||
Command expiry timestamp in Unix milliseconds. If provided, it
|
||||
must be in the future and within the gateway's default command
|
||||
timeout. It can shorten request validity but cannot extend it.
|
||||
This is not an order auto-cancel time.
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-48>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-49>
|
||||
op:
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- args
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- cancelOrders
|
||||
x-parser-schema-id: <anonymous-schema-51>
|
||||
args:
|
||||
type: array
|
||||
description: >
|
||||
Array of order IDs to cancel. Cancelling an order that has
|
||||
attached
|
||||
|
||||
take-profit / stop-loss children (see `CreateOrder.tr`)
|
||||
cascades to
|
||||
|
||||
those children — they are cancelled with reason
|
||||
`ParentCancelled`.
|
||||
items:
|
||||
type: integer
|
||||
description: Order ID
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-53>
|
||||
x-parser-schema-id: <anonymous-schema-52>
|
||||
x-parser-schema-id: <anonymous-schema-50>
|
||||
sig:
|
||||
type: string
|
||||
description: Signature in hex format
|
||||
example: 0x1234567890...
|
||||
x-parser-schema-id: <anonymous-schema-54>
|
||||
salt:
|
||||
type: integer
|
||||
description: Salt
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-55>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-56>
|
||||
exp:
|
||||
type: integer
|
||||
description: >-
|
||||
Command expiry timestamp in Unix milliseconds. If provided, it
|
||||
must be in the future and within the gateway's default command
|
||||
timeout. It can shorten request validity but cannot extend it.
|
||||
This is not an order auto-cancel time.
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-57>
|
||||
required:
|
||||
- req
|
||||
- op
|
||||
- sig
|
||||
- salt
|
||||
- ts
|
||||
x-parser-schema-id: <anonymous-schema-47>
|
||||
title: Cancel Orders Request
|
||||
description: Client submits a signed order cancellation request
|
||||
example: |-
|
||||
{
|
||||
"req": "post",
|
||||
"op": {
|
||||
"type": "cancelOrders",
|
||||
"args": [
|
||||
1234567890
|
||||
]
|
||||
},
|
||||
"sig": "0x1234567890...",
|
||||
"salt": 1234567890,
|
||||
"ts": 1767225600000,
|
||||
"exp": 1767225600000
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Request
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: cancelOrders
|
||||
- &ref_2
|
||||
id: CancelOrdersReceive
|
||||
title: Cancel orders receive
|
||||
description: Cancel response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_4
|
||||
id: Response
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Cancel Orders Response
|
||||
description: Server responds with cancel result for each order
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
description: Array of cancel results
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: oid
|
||||
type: integer
|
||||
description: Order ID
|
||||
required: true
|
||||
- name: coid
|
||||
type: string
|
||||
description: Client order ID
|
||||
required: false
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: oid
|
||||
type: integer
|
||||
description: Order ID
|
||||
required: false
|
||||
- name: coid
|
||||
type: string
|
||||
description: Client order ID
|
||||
required: false
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-59>
|
||||
data:
|
||||
type: array
|
||||
description: Array of cancel results
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- oid
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-63>
|
||||
oid:
|
||||
type: integer
|
||||
description: Order ID
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-64>
|
||||
coid:
|
||||
type: string
|
||||
description: Client order ID
|
||||
minLength: 32
|
||||
maxLength: 32
|
||||
pattern: ^[0-9a-f]{32}$
|
||||
example: 550e8400e29b41d4a716446655440000
|
||||
x-parser-schema-id: <anonymous-schema-65>
|
||||
x-parser-schema-id: <anonymous-schema-62>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-67>
|
||||
oid:
|
||||
type: integer
|
||||
description: Order ID
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-68>
|
||||
coid:
|
||||
type: string
|
||||
description: Client order ID
|
||||
minLength: 32
|
||||
maxLength: 32
|
||||
pattern: ^[0-9a-f]{32}$
|
||||
example: 550e8400e29b41d4a716446655440000
|
||||
x-parser-schema-id: <anonymous-schema-69>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-70>
|
||||
x-parser-schema-id: <anonymous-schema-66>
|
||||
x-parser-schema-id: <anonymous-schema-61>
|
||||
x-parser-schema-id: <anonymous-schema-60>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-58>
|
||||
title: Cancel Orders Response
|
||||
description: Server responds with cancel result for each order
|
||||
example: |-
|
||||
{
|
||||
"id": 3,
|
||||
"data": [
|
||||
{
|
||||
"status": "ok",
|
||||
"oid": 1234567890
|
||||
},
|
||||
{
|
||||
"status": "ok",
|
||||
"oid": 1234567891
|
||||
}
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Response
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
receiveOperations:
|
||||
- *ref_2
|
||||
sendMessages:
|
||||
- *ref_3
|
||||
receiveMessages:
|
||||
- *ref_4
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: cancelOrders
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,614 @@
|
||||
> ## 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.
|
||||
|
||||
# Deposits
|
||||
|
||||
> Perps WebSocket private deposit updates.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json deposits
|
||||
id: deposits
|
||||
title: Deposits
|
||||
description: >-
|
||||
Real-time deposit status updates. Requires authentication, see
|
||||
[Auth](/ws/auth).
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: DepositsSubscribe
|
||||
title: Deposits subscribe
|
||||
description: Subscribe to deposits
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_6
|
||||
id: SubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe
|
||||
description: Subscribe to private deposit updates (requires prior auth)
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: 'Deposits private channel: "deposits"'
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
enumValues:
|
||||
- deposits
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-606>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-607>
|
||||
chs:
|
||||
type: array
|
||||
description: 'Deposits private channel: "deposits"'
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- deposits
|
||||
x-parser-schema-id: <anonymous-schema-609>
|
||||
example:
|
||||
- deposits
|
||||
x-parser-schema-id: <anonymous-schema-608>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-605>
|
||||
title: Subscribe
|
||||
description: Subscribe to private deposit updates (requires prior auth)
|
||||
example: |-
|
||||
{
|
||||
"req": "sub",
|
||||
"chs": [
|
||||
"deposits"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeRequest
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: deposits
|
||||
- &ref_3
|
||||
id: DepositsSubscribeResponse
|
||||
title: Deposits subscribe response
|
||||
description: Deposits subscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_8
|
||||
id: SubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe Response
|
||||
description: Response to deposits subscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-611>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-615>
|
||||
x-parser-schema-id: <anonymous-schema-614>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-617>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-618>
|
||||
x-parser-schema-id: <anonymous-schema-616>
|
||||
x-parser-schema-id: <anonymous-schema-613>
|
||||
x-parser-schema-id: <anonymous-schema-612>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-610>
|
||||
title: Subscribe Response
|
||||
description: Response to deposits subscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_2
|
||||
id: DepositsUnsubscribe
|
||||
title: Deposits unsubscribe
|
||||
description: Unsubscribe from deposits
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_7
|
||||
id: UnsubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe
|
||||
description: Unsubscribe from private deposit updates
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: 'Deposits private channel: "deposits"'
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
enumValues:
|
||||
- deposits
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-620>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-621>
|
||||
chs:
|
||||
type: array
|
||||
description: 'Deposits private channel: "deposits"'
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- deposits
|
||||
x-parser-schema-id: <anonymous-schema-623>
|
||||
example:
|
||||
- deposits
|
||||
x-parser-schema-id: <anonymous-schema-622>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-619>
|
||||
title: Unsubscribe
|
||||
description: Unsubscribe from private deposit updates
|
||||
example: |-
|
||||
{
|
||||
"req": "unsub",
|
||||
"chs": [
|
||||
"deposits"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeRequest
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_4
|
||||
id: DepositsUnsubscribeResponse
|
||||
title: Deposits unsubscribe response
|
||||
description: Deposits unsubscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_9
|
||||
id: UnsubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe Response
|
||||
description: Response to deposits unsubscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-625>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-629>
|
||||
x-parser-schema-id: <anonymous-schema-628>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-631>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-632>
|
||||
x-parser-schema-id: <anonymous-schema-630>
|
||||
x-parser-schema-id: <anonymous-schema-627>
|
||||
x-parser-schema-id: <anonymous-schema-626>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-624>
|
||||
title: Unsubscribe Response
|
||||
description: Response to deposits unsubscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_5
|
||||
id: DepositsUpdate
|
||||
title: Deposits update
|
||||
description: Receive deposit updates
|
||||
type: send
|
||||
messages:
|
||||
- &ref_10
|
||||
id: Update
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Update
|
||||
description: Deposit status updates for authenticated users
|
||||
type: object
|
||||
properties:
|
||||
- name: ch
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g.
|
||||
"fills", "orders").
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: sq
|
||||
type: integer
|
||||
description: Sequence number
|
||||
required: true
|
||||
- name: data
|
||||
type: object
|
||||
description: Array of deposit objects
|
||||
required: true
|
||||
properties:
|
||||
- name: hash
|
||||
type: string
|
||||
description: On-chain transaction hash, "0x" if not yet mined
|
||||
required: true
|
||||
- name: asset
|
||||
type: string
|
||||
description: Asset name
|
||||
required: true
|
||||
- name: amount
|
||||
type: string
|
||||
description: >-
|
||||
Raw token amount including decimals. For withdrawals this
|
||||
matches the uint256 amount in the EIP-712 signature (e.g.
|
||||
"100000000" for 100 USDC with 6 decimals).
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
description: Deposit status
|
||||
enumValues:
|
||||
- pending
|
||||
- confirmed
|
||||
- removed
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
title: Deposits Update
|
||||
type: object
|
||||
properties:
|
||||
ch:
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g. "fills",
|
||||
"orders").
|
||||
example: trades::1
|
||||
x-parser-schema-id: <anonymous-schema-634>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-635>
|
||||
sq:
|
||||
type: integer
|
||||
description: Sequence number
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-636>
|
||||
data:
|
||||
type: object
|
||||
description: Array of deposit objects
|
||||
properties:
|
||||
hash:
|
||||
type: string
|
||||
description: On-chain transaction hash, "0x" if not yet mined
|
||||
default: 0x
|
||||
example: >-
|
||||
0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
|
||||
x-parser-schema-id: <anonymous-schema-638>
|
||||
asset:
|
||||
type: string
|
||||
description: Asset name
|
||||
example: USDC
|
||||
x-parser-schema-id: <anonymous-schema-639>
|
||||
amount:
|
||||
type: string
|
||||
description: >-
|
||||
Raw token amount including decimals. For withdrawals this
|
||||
matches the uint256 amount in the EIP-712 signature (e.g.
|
||||
"100000000" for 100 USDC with 6 decimals).
|
||||
example: '100000000'
|
||||
x-parser-schema-id: <anonymous-schema-640>
|
||||
status:
|
||||
type: string
|
||||
description: Deposit status
|
||||
enum:
|
||||
- pending
|
||||
- confirmed
|
||||
- removed
|
||||
x-parser-schema-id: <anonymous-schema-641>
|
||||
required:
|
||||
- hash
|
||||
- asset
|
||||
- amount
|
||||
- status
|
||||
x-parser-schema-id: <anonymous-schema-637>
|
||||
required:
|
||||
- ch
|
||||
- ts
|
||||
- sq
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-633>
|
||||
title: Update
|
||||
description: Deposit status updates for authenticated users
|
||||
example: |-
|
||||
{
|
||||
"ch": "deposits",
|
||||
"ts": 1767225600000,
|
||||
"sq": 1234567890,
|
||||
"data": [
|
||||
{
|
||||
"hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
|
||||
"asset": "USDC",
|
||||
"amount": "100000000",
|
||||
"status": "pending"
|
||||
}
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Update
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
- *ref_2
|
||||
receiveOperations:
|
||||
- *ref_3
|
||||
- *ref_4
|
||||
- *ref_5
|
||||
sendMessages:
|
||||
- *ref_6
|
||||
- *ref_7
|
||||
receiveMessages:
|
||||
- *ref_8
|
||||
- *ref_9
|
||||
- *ref_10
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: deposits
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,727 @@
|
||||
> ## 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.
|
||||
|
||||
# Fills
|
||||
|
||||
> Perps WebSocket private fill updates.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json fills
|
||||
id: fills
|
||||
title: Fills
|
||||
description: Real-time fill updates. Requires authentication, see [Auth](/ws/auth).
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: FillsSubscribe
|
||||
title: Fills subscribe
|
||||
description: Subscribe to fills
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_6
|
||||
id: SubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe
|
||||
description: Subscribe to private fill updates (requires prior auth)
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: 'Fills private channel: "fills"'
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
enumValues:
|
||||
- fills
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-380>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-381>
|
||||
chs:
|
||||
type: array
|
||||
description: 'Fills private channel: "fills"'
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- fills
|
||||
x-parser-schema-id: <anonymous-schema-383>
|
||||
example:
|
||||
- fills
|
||||
x-parser-schema-id: <anonymous-schema-382>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-379>
|
||||
title: Subscribe
|
||||
description: Subscribe to private fill updates (requires prior auth)
|
||||
example: |-
|
||||
{
|
||||
"req": "sub",
|
||||
"chs": [
|
||||
"fills"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeRequest
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: fills
|
||||
- &ref_3
|
||||
id: FillsSubscribeResponse
|
||||
title: Fills subscribe response
|
||||
description: Fills subscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_8
|
||||
id: SubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe Response
|
||||
description: Response to fills subscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-385>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-389>
|
||||
x-parser-schema-id: <anonymous-schema-388>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-391>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-392>
|
||||
x-parser-schema-id: <anonymous-schema-390>
|
||||
x-parser-schema-id: <anonymous-schema-387>
|
||||
x-parser-schema-id: <anonymous-schema-386>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-384>
|
||||
title: Subscribe Response
|
||||
description: Response to fills subscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_2
|
||||
id: FillsUnsubscribe
|
||||
title: Fills unsubscribe
|
||||
description: Unsubscribe from fills
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_7
|
||||
id: UnsubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe
|
||||
description: Unsubscribe from private fill updates
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: 'Fills private channel: "fills"'
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
enumValues:
|
||||
- fills
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-394>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-395>
|
||||
chs:
|
||||
type: array
|
||||
description: 'Fills private channel: "fills"'
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- fills
|
||||
x-parser-schema-id: <anonymous-schema-397>
|
||||
example:
|
||||
- fills
|
||||
x-parser-schema-id: <anonymous-schema-396>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-393>
|
||||
title: Unsubscribe
|
||||
description: Unsubscribe from private fill updates
|
||||
example: |-
|
||||
{
|
||||
"req": "unsub",
|
||||
"chs": [
|
||||
"fills"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeRequest
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_4
|
||||
id: FillsUnsubscribeResponse
|
||||
title: Fills unsubscribe response
|
||||
description: Fills unsubscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_9
|
||||
id: UnsubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe Response
|
||||
description: Response to fills unsubscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-399>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-403>
|
||||
x-parser-schema-id: <anonymous-schema-402>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-405>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-406>
|
||||
x-parser-schema-id: <anonymous-schema-404>
|
||||
x-parser-schema-id: <anonymous-schema-401>
|
||||
x-parser-schema-id: <anonymous-schema-400>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-398>
|
||||
title: Unsubscribe Response
|
||||
description: Response to fills unsubscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_5
|
||||
id: FillsUpdate
|
||||
title: Fills update
|
||||
description: Receive fill updates
|
||||
type: send
|
||||
messages:
|
||||
- &ref_10
|
||||
id: Update
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Update
|
||||
description: Real-time fill updates for authenticated users
|
||||
type: object
|
||||
properties:
|
||||
- name: ch
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g.
|
||||
"fills", "orders").
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: sq
|
||||
type: integer
|
||||
description: Sequence number
|
||||
required: true
|
||||
- name: data
|
||||
type: object
|
||||
description: Array of fill objects
|
||||
required: true
|
||||
properties:
|
||||
- name: tid
|
||||
type: integer
|
||||
description: Trade ID
|
||||
required: true
|
||||
- name: oid
|
||||
type: integer
|
||||
description: Order ID
|
||||
required: true
|
||||
- name: iid
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
required: true
|
||||
- name: side
|
||||
type: string
|
||||
description: Side
|
||||
enumValues:
|
||||
- long
|
||||
- short
|
||||
required: true
|
||||
- name: p
|
||||
type: string
|
||||
description: Price
|
||||
required: true
|
||||
- name: qty
|
||||
type: string
|
||||
description: Quantity in no. of contracts
|
||||
required: true
|
||||
- name: taker
|
||||
type: boolean
|
||||
description: Whether this side was the taker
|
||||
required: true
|
||||
- name: fee
|
||||
type: string
|
||||
description: Fee amount for this trade side
|
||||
required: true
|
||||
- name: fea
|
||||
type: string
|
||||
description: Fee asset name
|
||||
required: true
|
||||
- name: psz
|
||||
type: string
|
||||
description: Position size before the fill
|
||||
required: true
|
||||
- name: pep
|
||||
type: string
|
||||
description: Position entry price before the fill
|
||||
required: true
|
||||
- name: pnl
|
||||
type: string
|
||||
description: PnL in USD
|
||||
required: true
|
||||
- name: liq
|
||||
type: boolean
|
||||
description: Whether the fill was a liquidation
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations;
|
||||
Unix seconds for withdrawals (must match the on-chain
|
||||
EIP-712 struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: coid
|
||||
type: string
|
||||
description: Client order ID
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
title: Fills Update
|
||||
type: object
|
||||
properties:
|
||||
ch:
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g. "fills",
|
||||
"orders").
|
||||
example: trades::1
|
||||
x-parser-schema-id: <anonymous-schema-408>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-409>
|
||||
sq:
|
||||
type: integer
|
||||
description: Sequence number
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-410>
|
||||
data:
|
||||
type: object
|
||||
description: Array of fill objects
|
||||
properties:
|
||||
tid:
|
||||
type: integer
|
||||
description: Trade ID
|
||||
example: 1
|
||||
x-parser-schema-id: <anonymous-schema-412>
|
||||
oid:
|
||||
type: integer
|
||||
description: Order ID
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-413>
|
||||
iid:
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
example: 1
|
||||
x-parser-schema-id: <anonymous-schema-414>
|
||||
side:
|
||||
type: string
|
||||
description: Side
|
||||
enum:
|
||||
- long
|
||||
- short
|
||||
x-parser-schema-id: <anonymous-schema-415>
|
||||
p:
|
||||
type: string
|
||||
description: Price
|
||||
example: '100.00'
|
||||
x-parser-schema-id: <anonymous-schema-416>
|
||||
qty:
|
||||
type: string
|
||||
description: Quantity in no. of contracts
|
||||
example: '10.00'
|
||||
x-parser-schema-id: <anonymous-schema-417>
|
||||
taker:
|
||||
type: boolean
|
||||
description: Whether this side was the taker
|
||||
x-parser-schema-id: <anonymous-schema-418>
|
||||
fee:
|
||||
type: string
|
||||
description: Fee amount for this trade side
|
||||
example: '1.25'
|
||||
x-parser-schema-id: <anonymous-schema-419>
|
||||
fea:
|
||||
type: string
|
||||
description: Fee asset name
|
||||
example: USDC
|
||||
x-parser-schema-id: <anonymous-schema-420>
|
||||
psz:
|
||||
type: string
|
||||
description: Position size before the fill
|
||||
example: '26.86'
|
||||
x-parser-schema-id: <anonymous-schema-421>
|
||||
pep:
|
||||
type: string
|
||||
description: Position entry price before the fill
|
||||
example: '100.00'
|
||||
x-parser-schema-id: <anonymous-schema-422>
|
||||
pnl:
|
||||
type: string
|
||||
description: PnL in USD
|
||||
example: '100.00'
|
||||
x-parser-schema-id: <anonymous-schema-423>
|
||||
liq:
|
||||
type: boolean
|
||||
description: Whether the fill was a liquidation
|
||||
x-parser-schema-id: <anonymous-schema-424>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations;
|
||||
Unix seconds for withdrawals (must match the on-chain
|
||||
EIP-712 struct verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-425>
|
||||
coid:
|
||||
type: string
|
||||
description: Client order ID
|
||||
minLength: 32
|
||||
maxLength: 32
|
||||
pattern: ^[0-9a-f]{32}$
|
||||
example: 550e8400e29b41d4a716446655440000
|
||||
x-parser-schema-id: <anonymous-schema-426>
|
||||
required:
|
||||
- tid
|
||||
- oid
|
||||
- iid
|
||||
- side
|
||||
- p
|
||||
- qty
|
||||
- taker
|
||||
- fee
|
||||
- fea
|
||||
- psz
|
||||
- pep
|
||||
- pnl
|
||||
- ts
|
||||
- liq
|
||||
x-parser-schema-id: <anonymous-schema-411>
|
||||
required:
|
||||
- ch
|
||||
- ts
|
||||
- sq
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-407>
|
||||
title: Update
|
||||
description: Real-time fill updates for authenticated users
|
||||
example: |-
|
||||
{
|
||||
"ch": "fills",
|
||||
"ts": 1767225600000,
|
||||
"sq": 1234567890,
|
||||
"data": [
|
||||
{
|
||||
"tid": 1,
|
||||
"oid": 1234567890,
|
||||
"iid": 1,
|
||||
"side": "long",
|
||||
"p": "100.00",
|
||||
"qty": "10.00",
|
||||
"fee": "1.25",
|
||||
"fea": "USDC",
|
||||
"psz": "26.86",
|
||||
"pep": "100.00",
|
||||
"pnl": "100.00",
|
||||
"ts": 1767225600000,
|
||||
"coid": "550e8400e29b41d4a716446655440000"
|
||||
}
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Update
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
- *ref_2
|
||||
receiveOperations:
|
||||
- *ref_3
|
||||
- *ref_4
|
||||
- *ref_5
|
||||
sendMessages:
|
||||
- *ref_6
|
||||
- *ref_7
|
||||
receiveMessages:
|
||||
- *ref_8
|
||||
- *ref_9
|
||||
- *ref_10
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: fills
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,631 @@
|
||||
> ## 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.
|
||||
|
||||
# Funding
|
||||
|
||||
> Perps WebSocket private funding updates.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json funding
|
||||
id: funding
|
||||
title: Funding
|
||||
description: >-
|
||||
Real-time funding payment updates. Requires authentication, see
|
||||
[Auth](/ws/auth).
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: FundingSubscribe
|
||||
title: Funding subscribe
|
||||
description: Subscribe to funding
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_6
|
||||
id: SubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe
|
||||
description: Subscribe to private funding payment updates (requires prior auth)
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: 'Funding private channel: "funding"'
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
enumValues:
|
||||
- funding
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-475>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-476>
|
||||
chs:
|
||||
type: array
|
||||
description: 'Funding private channel: "funding"'
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- funding
|
||||
x-parser-schema-id: <anonymous-schema-478>
|
||||
example:
|
||||
- funding
|
||||
x-parser-schema-id: <anonymous-schema-477>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-474>
|
||||
title: Subscribe
|
||||
description: Subscribe to private funding payment updates (requires prior auth)
|
||||
example: |-
|
||||
{
|
||||
"req": "sub",
|
||||
"chs": [
|
||||
"funding"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeRequest
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: funding
|
||||
- &ref_3
|
||||
id: FundingSubscribeResponse
|
||||
title: Funding subscribe response
|
||||
description: Funding subscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_8
|
||||
id: SubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe Response
|
||||
description: Response to funding subscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-480>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-484>
|
||||
x-parser-schema-id: <anonymous-schema-483>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-486>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-487>
|
||||
x-parser-schema-id: <anonymous-schema-485>
|
||||
x-parser-schema-id: <anonymous-schema-482>
|
||||
x-parser-schema-id: <anonymous-schema-481>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-479>
|
||||
title: Subscribe Response
|
||||
description: Response to funding subscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_2
|
||||
id: FundingUnsubscribe
|
||||
title: Funding unsubscribe
|
||||
description: Unsubscribe from funding
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_7
|
||||
id: UnsubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe
|
||||
description: Unsubscribe from private funding updates
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: 'Funding private channel: "funding"'
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
enumValues:
|
||||
- funding
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-489>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-490>
|
||||
chs:
|
||||
type: array
|
||||
description: 'Funding private channel: "funding"'
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- funding
|
||||
x-parser-schema-id: <anonymous-schema-492>
|
||||
example:
|
||||
- funding
|
||||
x-parser-schema-id: <anonymous-schema-491>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-488>
|
||||
title: Unsubscribe
|
||||
description: Unsubscribe from private funding updates
|
||||
example: |-
|
||||
{
|
||||
"req": "unsub",
|
||||
"chs": [
|
||||
"funding"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeRequest
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_4
|
||||
id: FundingUnsubscribeResponse
|
||||
title: Funding unsubscribe response
|
||||
description: Funding unsubscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_9
|
||||
id: UnsubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe Response
|
||||
description: Response to funding unsubscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-494>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-498>
|
||||
x-parser-schema-id: <anonymous-schema-497>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-500>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-501>
|
||||
x-parser-schema-id: <anonymous-schema-499>
|
||||
x-parser-schema-id: <anonymous-schema-496>
|
||||
x-parser-schema-id: <anonymous-schema-495>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-493>
|
||||
title: Unsubscribe Response
|
||||
description: Response to funding unsubscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_5
|
||||
id: FundingUpdate
|
||||
title: Funding update
|
||||
description: Receive funding updates
|
||||
type: send
|
||||
messages:
|
||||
- &ref_10
|
||||
id: Update
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Update
|
||||
description: Real-time funding payment updates for authenticated users
|
||||
type: object
|
||||
properties:
|
||||
- name: ch
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g.
|
||||
"fills", "orders").
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: sq
|
||||
type: integer
|
||||
description: Sequence number
|
||||
required: true
|
||||
- name: data
|
||||
type: object
|
||||
description: Array of funding objects
|
||||
required: true
|
||||
properties:
|
||||
- name: iid
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
required: true
|
||||
- name: sz
|
||||
type: string
|
||||
description: >-
|
||||
Signed position size in no. of contracts (positive = long,
|
||||
negative = short)
|
||||
required: true
|
||||
- name: fr
|
||||
type: string
|
||||
description: Funding rate
|
||||
required: true
|
||||
- name: fund
|
||||
type: string
|
||||
description: Funding paid in USD
|
||||
required: true
|
||||
- name: fua
|
||||
type: string
|
||||
description: Funding asset name
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations;
|
||||
Unix seconds for withdrawals (must match the on-chain
|
||||
EIP-712 struct verified against block.timestamp).
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
title: Funding Update
|
||||
type: object
|
||||
properties:
|
||||
ch:
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g. "fills",
|
||||
"orders").
|
||||
example: trades::1
|
||||
x-parser-schema-id: <anonymous-schema-503>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-504>
|
||||
sq:
|
||||
type: integer
|
||||
description: Sequence number
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-505>
|
||||
data:
|
||||
type: object
|
||||
description: Array of funding objects
|
||||
properties:
|
||||
iid:
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
example: 1
|
||||
x-parser-schema-id: <anonymous-schema-507>
|
||||
sz:
|
||||
type: string
|
||||
description: >-
|
||||
Signed position size in no. of contracts (positive = long,
|
||||
negative = short)
|
||||
example: '10.00'
|
||||
x-parser-schema-id: <anonymous-schema-508>
|
||||
fr:
|
||||
type: string
|
||||
description: Funding rate
|
||||
example: '0.0001'
|
||||
x-parser-schema-id: <anonymous-schema-509>
|
||||
fund:
|
||||
type: string
|
||||
description: Funding paid in USD
|
||||
example: '1.00'
|
||||
x-parser-schema-id: <anonymous-schema-510>
|
||||
fua:
|
||||
type: string
|
||||
description: Funding asset name
|
||||
example: USDC
|
||||
x-parser-schema-id: <anonymous-schema-511>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations;
|
||||
Unix seconds for withdrawals (must match the on-chain
|
||||
EIP-712 struct verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-512>
|
||||
required:
|
||||
- iid
|
||||
- sz
|
||||
- fr
|
||||
- fund
|
||||
- fua
|
||||
- ts
|
||||
x-parser-schema-id: <anonymous-schema-506>
|
||||
required:
|
||||
- ch
|
||||
- ts
|
||||
- sq
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-502>
|
||||
title: Update
|
||||
description: Real-time funding payment updates for authenticated users
|
||||
example: |-
|
||||
{
|
||||
"ch": "funding",
|
||||
"ts": 1767225600000,
|
||||
"sq": 1234567890,
|
||||
"data": [
|
||||
{
|
||||
"iid": 1,
|
||||
"sz": "10.00",
|
||||
"fr": "0.0001",
|
||||
"fund": "1.00",
|
||||
"fua": "USDC",
|
||||
"ts": 1767225600000
|
||||
}
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Update
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
- *ref_2
|
||||
receiveOperations:
|
||||
- *ref_3
|
||||
- *ref_4
|
||||
- *ref_5
|
||||
sendMessages:
|
||||
- *ref_6
|
||||
- *ref_7
|
||||
receiveMessages:
|
||||
- *ref_8
|
||||
- *ref_9
|
||||
- *ref_10
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: funding
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,590 @@
|
||||
> ## 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.
|
||||
|
||||
# Klines
|
||||
|
||||
> Perps WebSocket candle updates.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json klines
|
||||
id: klines
|
||||
title: Klines
|
||||
description: Real-time kline updates.
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: KlinesSubscribe
|
||||
title: Klines subscribe
|
||||
description: Subscribe to klines
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_6
|
||||
id: SubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe
|
||||
description: Subscribe to kline updates for an instrument and interval
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: >-
|
||||
Klines subscription in format "klines::{iid}::{interval}"
|
||||
(e.g., "klines::1::1m")
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-267>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-268>
|
||||
chs:
|
||||
type: array
|
||||
description: >-
|
||||
Klines subscription in format "klines::{iid}::{interval}" (e.g.,
|
||||
"klines::1::1m")
|
||||
items:
|
||||
type: string
|
||||
pattern: ^klines::\d+::(1m|5m|15m|30m|1h|4h|6h|12h|1d|1w)$
|
||||
x-parser-schema-id: <anonymous-schema-270>
|
||||
example:
|
||||
- klines::1::1m
|
||||
x-parser-schema-id: <anonymous-schema-269>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-266>
|
||||
title: Subscribe
|
||||
description: Subscribe to kline updates for an instrument and interval
|
||||
example: |-
|
||||
{
|
||||
"req": "sub",
|
||||
"chs": [
|
||||
"klines::1::1m"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeRequest
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: klines
|
||||
- &ref_3
|
||||
id: KlinesSubscribeResponse
|
||||
title: Klines subscribe response
|
||||
description: Klines subscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_8
|
||||
id: SubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe Response
|
||||
description: Response to klines subscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-272>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-276>
|
||||
x-parser-schema-id: <anonymous-schema-275>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-278>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-279>
|
||||
x-parser-schema-id: <anonymous-schema-277>
|
||||
x-parser-schema-id: <anonymous-schema-274>
|
||||
x-parser-schema-id: <anonymous-schema-273>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-271>
|
||||
title: Subscribe Response
|
||||
description: Response to klines subscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_2
|
||||
id: KlinesUnsubscribe
|
||||
title: Klines unsubscribe
|
||||
description: Unsubscribe from klines
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_7
|
||||
id: UnsubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe
|
||||
description: Unsubscribe from kline updates
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: >-
|
||||
Klines subscription in format "klines::{iid}::{interval}"
|
||||
(e.g., "klines::1::1m")
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-281>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-282>
|
||||
chs:
|
||||
type: array
|
||||
description: >-
|
||||
Klines subscription in format "klines::{iid}::{interval}" (e.g.,
|
||||
"klines::1::1m")
|
||||
items:
|
||||
type: string
|
||||
pattern: ^klines::\d+::(1m|5m|15m|30m|1h|4h|6h|12h|1d|1w)$
|
||||
x-parser-schema-id: <anonymous-schema-284>
|
||||
example:
|
||||
- klines::1::1m
|
||||
x-parser-schema-id: <anonymous-schema-283>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-280>
|
||||
title: Unsubscribe
|
||||
description: Unsubscribe from kline updates
|
||||
example: |-
|
||||
{
|
||||
"req": "unsub",
|
||||
"chs": [
|
||||
"klines::1::1m"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeRequest
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_4
|
||||
id: KlinesUnsubscribeResponse
|
||||
title: Klines unsubscribe response
|
||||
description: Klines unsubscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_9
|
||||
id: UnsubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe Response
|
||||
description: Response to klines unsubscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-286>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-290>
|
||||
x-parser-schema-id: <anonymous-schema-289>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-292>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-293>
|
||||
x-parser-schema-id: <anonymous-schema-291>
|
||||
x-parser-schema-id: <anonymous-schema-288>
|
||||
x-parser-schema-id: <anonymous-schema-287>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-285>
|
||||
title: Unsubscribe Response
|
||||
description: Response to klines unsubscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_5
|
||||
id: KlinesUpdate
|
||||
title: Klines update
|
||||
description: Receive kline updates
|
||||
type: send
|
||||
messages:
|
||||
- &ref_10
|
||||
id: Update
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Update
|
||||
description: Real-time kline updates for subscribed instruments
|
||||
type: object
|
||||
properties:
|
||||
- name: ch
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g.
|
||||
"fills", "orders").
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: sq
|
||||
type: integer
|
||||
description: Sequence number
|
||||
required: true
|
||||
- name: data
|
||||
type: array
|
||||
description: Array of kline arrays
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: array
|
||||
description: |
|
||||
- `1767225600000` - Open time
|
||||
- `"100.00"` - Open price
|
||||
- `"105.00"` - High price
|
||||
- `"99.00"` - Low price
|
||||
- `"102.00"` - Close price
|
||||
- `"500.00"` - Volume (base unit)
|
||||
- `42` - Number of trades
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
title: Kline Update
|
||||
type: object
|
||||
properties:
|
||||
ch:
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g. "fills",
|
||||
"orders").
|
||||
example: trades::1
|
||||
x-parser-schema-id: <anonymous-schema-295>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-296>
|
||||
sq:
|
||||
type: integer
|
||||
description: Sequence number
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-297>
|
||||
data:
|
||||
type: array
|
||||
description: Array of kline arrays
|
||||
items:
|
||||
type: array
|
||||
description: |
|
||||
- `1767225600000` - Open time
|
||||
- `"100.00"` - Open price
|
||||
- `"105.00"` - High price
|
||||
- `"99.00"` - Low price
|
||||
- `"102.00"` - Close price
|
||||
- `"500.00"` - Volume (base unit)
|
||||
- `42` - Number of trades
|
||||
example:
|
||||
- 1767225600000
|
||||
- '100.00'
|
||||
- '105.00'
|
||||
- '99.00'
|
||||
- '102.00'
|
||||
- '500.00'
|
||||
- 42
|
||||
x-parser-schema-id: <anonymous-schema-299>
|
||||
x-parser-schema-id: <anonymous-schema-298>
|
||||
required:
|
||||
- ch
|
||||
- ts
|
||||
- sq
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-294>
|
||||
title: Update
|
||||
description: Real-time kline updates for subscribed instruments
|
||||
example: |-
|
||||
{
|
||||
"ch": "klines::1::1m",
|
||||
"ts": 1767225600000,
|
||||
"sq": 1234567890,
|
||||
"data": [
|
||||
[
|
||||
1767225600000,
|
||||
"100.00",
|
||||
"105.00",
|
||||
"99.00",
|
||||
"102.00",
|
||||
"500.00",
|
||||
42
|
||||
]
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Update
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
- *ref_2
|
||||
receiveOperations:
|
||||
- *ref_3
|
||||
- *ref_4
|
||||
- *ref_5
|
||||
sendMessages:
|
||||
- *ref_6
|
||||
- *ref_7
|
||||
receiveMessages:
|
||||
- *ref_8
|
||||
- *ref_9
|
||||
- *ref_10
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: klines
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,716 @@
|
||||
> ## 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.
|
||||
|
||||
# Orders
|
||||
|
||||
> Perps WebSocket private order updates.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json orders
|
||||
id: orders
|
||||
title: Orders
|
||||
description: Real-time order updates. Requires authentication, see [Auth](/ws/auth).
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: OrdersSubscribe
|
||||
title: Orders subscribe
|
||||
description: Subscribe to orders
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_6
|
||||
id: SubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe
|
||||
description: Subscribe to private order updates (requires prior auth)
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: 'Orders private channel: "orders"'
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
enumValues:
|
||||
- orders
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-428>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-429>
|
||||
chs:
|
||||
type: array
|
||||
description: 'Orders private channel: "orders"'
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- orders
|
||||
x-parser-schema-id: <anonymous-schema-431>
|
||||
example:
|
||||
- orders
|
||||
x-parser-schema-id: <anonymous-schema-430>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-427>
|
||||
title: Subscribe
|
||||
description: Subscribe to private order updates (requires prior auth)
|
||||
example: |-
|
||||
{
|
||||
"req": "sub",
|
||||
"chs": [
|
||||
"orders"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeRequest
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: orders
|
||||
- &ref_3
|
||||
id: OrdersSubscribeResponse
|
||||
title: Orders subscribe response
|
||||
description: Orders subscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_8
|
||||
id: SubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe Response
|
||||
description: Response to orders subscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-433>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-437>
|
||||
x-parser-schema-id: <anonymous-schema-436>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-439>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-440>
|
||||
x-parser-schema-id: <anonymous-schema-438>
|
||||
x-parser-schema-id: <anonymous-schema-435>
|
||||
x-parser-schema-id: <anonymous-schema-434>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-432>
|
||||
title: Subscribe Response
|
||||
description: Response to orders subscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_2
|
||||
id: OrdersUnsubscribe
|
||||
title: Orders unsubscribe
|
||||
description: Unsubscribe from orders
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_7
|
||||
id: UnsubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe
|
||||
description: Unsubscribe from private order updates
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: 'Orders private channel: "orders"'
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
enumValues:
|
||||
- orders
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-442>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-443>
|
||||
chs:
|
||||
type: array
|
||||
description: 'Orders private channel: "orders"'
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- orders
|
||||
x-parser-schema-id: <anonymous-schema-445>
|
||||
example:
|
||||
- orders
|
||||
x-parser-schema-id: <anonymous-schema-444>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-441>
|
||||
title: Unsubscribe
|
||||
description: Unsubscribe from private order updates
|
||||
example: |-
|
||||
{
|
||||
"req": "unsub",
|
||||
"chs": [
|
||||
"orders"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeRequest
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_4
|
||||
id: OrdersUnsubscribeResponse
|
||||
title: Orders unsubscribe response
|
||||
description: Orders unsubscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_9
|
||||
id: UnsubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe Response
|
||||
description: Response to orders unsubscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-447>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-451>
|
||||
x-parser-schema-id: <anonymous-schema-450>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-453>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-454>
|
||||
x-parser-schema-id: <anonymous-schema-452>
|
||||
x-parser-schema-id: <anonymous-schema-449>
|
||||
x-parser-schema-id: <anonymous-schema-448>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-446>
|
||||
title: Unsubscribe Response
|
||||
description: Response to orders unsubscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_5
|
||||
id: OrdersUpdate
|
||||
title: Orders update
|
||||
description: Receive order updates
|
||||
type: send
|
||||
messages:
|
||||
- &ref_10
|
||||
id: Update
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Update
|
||||
description: Real-time order updates for authenticated users
|
||||
type: object
|
||||
properties:
|
||||
- name: ch
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g.
|
||||
"fills", "orders").
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: sq
|
||||
type: integer
|
||||
description: Sequence number
|
||||
required: true
|
||||
- name: data
|
||||
type: object
|
||||
description: Order object
|
||||
required: true
|
||||
properties:
|
||||
- name: oid
|
||||
type: integer
|
||||
description: Order ID
|
||||
required: true
|
||||
- name: iid
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
required: true
|
||||
- name: buy
|
||||
type: boolean
|
||||
description: Is buy
|
||||
required: true
|
||||
- name: p
|
||||
type: string
|
||||
description: Price
|
||||
required: true
|
||||
- name: qty
|
||||
type: string
|
||||
description: Quantity in no. of contracts
|
||||
required: true
|
||||
- name: tif
|
||||
type: string
|
||||
description: Time in force
|
||||
enumValues:
|
||||
- gtc
|
||||
- ioc
|
||||
- fok
|
||||
required: true
|
||||
- name: po
|
||||
type: boolean
|
||||
description: Post only
|
||||
required: true
|
||||
- name: ro
|
||||
type: boolean
|
||||
description: Reduce only
|
||||
required: true
|
||||
- name: rest
|
||||
type: string
|
||||
description: Resting quantity
|
||||
required: true
|
||||
- name: fill
|
||||
type: string
|
||||
description: Filled quantity
|
||||
required: true
|
||||
- name: cts
|
||||
type: integer
|
||||
description: Create timestamp in milliseconds
|
||||
required: true
|
||||
- name: uts
|
||||
type: integer
|
||||
description: Update timestamp in milliseconds
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
description: Order status
|
||||
required: true
|
||||
- name: coid
|
||||
type: string
|
||||
description: Client order ID
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
title: Orders Update
|
||||
type: object
|
||||
properties:
|
||||
ch:
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g. "fills",
|
||||
"orders").
|
||||
example: trades::1
|
||||
x-parser-schema-id: <anonymous-schema-456>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-457>
|
||||
sq:
|
||||
type: integer
|
||||
description: Sequence number
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-458>
|
||||
data:
|
||||
type: object
|
||||
description: Order object
|
||||
properties:
|
||||
oid:
|
||||
type: integer
|
||||
description: Order ID
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-460>
|
||||
iid:
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
example: 1
|
||||
x-parser-schema-id: <anonymous-schema-461>
|
||||
buy:
|
||||
type: boolean
|
||||
description: Is buy
|
||||
example: true
|
||||
x-parser-schema-id: <anonymous-schema-462>
|
||||
p:
|
||||
type: string
|
||||
description: Price
|
||||
example: '100.00'
|
||||
x-parser-schema-id: <anonymous-schema-463>
|
||||
qty:
|
||||
type: string
|
||||
description: Quantity in no. of contracts
|
||||
example: '10.00'
|
||||
x-parser-schema-id: <anonymous-schema-464>
|
||||
tif:
|
||||
type: string
|
||||
description: Time in force
|
||||
enum:
|
||||
- gtc
|
||||
- ioc
|
||||
- fok
|
||||
x-parser-schema-id: <anonymous-schema-465>
|
||||
po:
|
||||
type: boolean
|
||||
description: Post only
|
||||
default: false
|
||||
example: false
|
||||
x-parser-schema-id: <anonymous-schema-466>
|
||||
ro:
|
||||
type: boolean
|
||||
description: Reduce only
|
||||
example: false
|
||||
default: false
|
||||
x-parser-schema-id: <anonymous-schema-467>
|
||||
rest:
|
||||
type: string
|
||||
description: Resting quantity
|
||||
example: '9.00'
|
||||
x-parser-schema-id: <anonymous-schema-468>
|
||||
fill:
|
||||
type: string
|
||||
description: Filled quantity
|
||||
example: '1.00'
|
||||
x-parser-schema-id: <anonymous-schema-469>
|
||||
cts:
|
||||
type: integer
|
||||
description: Create timestamp in milliseconds
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-470>
|
||||
uts:
|
||||
type: integer
|
||||
description: Update timestamp in milliseconds
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-471>
|
||||
status:
|
||||
type: string
|
||||
description: Order status
|
||||
example: open
|
||||
x-parser-schema-id: <anonymous-schema-472>
|
||||
coid:
|
||||
type: string
|
||||
description: Client order ID
|
||||
minLength: 32
|
||||
maxLength: 32
|
||||
pattern: ^[0-9a-f]{32}$
|
||||
example: 550e8400e29b41d4a716446655440000
|
||||
x-parser-schema-id: <anonymous-schema-473>
|
||||
required:
|
||||
- oid
|
||||
- iid
|
||||
- buy
|
||||
- p
|
||||
- qty
|
||||
- tif
|
||||
- po
|
||||
- ro
|
||||
- status
|
||||
- rest
|
||||
- fill
|
||||
- cts
|
||||
- uts
|
||||
x-parser-schema-id: <anonymous-schema-459>
|
||||
required:
|
||||
- ch
|
||||
- ts
|
||||
- sq
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-455>
|
||||
title: Update
|
||||
description: Real-time order updates for authenticated users
|
||||
example: |-
|
||||
{
|
||||
"ch": "orders",
|
||||
"ts": 1767225600000,
|
||||
"sq": 1234567890,
|
||||
"data": {
|
||||
"oid": 1234567890,
|
||||
"iid": 1,
|
||||
"buy": true,
|
||||
"p": "100.00",
|
||||
"qty": "10.00",
|
||||
"tif": "gtc",
|
||||
"po": false,
|
||||
"ro": false,
|
||||
"rest": "9.00",
|
||||
"fill": "1.00",
|
||||
"cts": 1767225600000,
|
||||
"uts": 1767225600000,
|
||||
"status": "open",
|
||||
"coid": "550e8400e29b41d4a716446655440000"
|
||||
}
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Update
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
- *ref_2
|
||||
receiveOperations:
|
||||
- *ref_3
|
||||
- *ref_4
|
||||
- *ref_5
|
||||
sendMessages:
|
||||
- *ref_6
|
||||
- *ref_7
|
||||
receiveMessages:
|
||||
- *ref_8
|
||||
- *ref_9
|
||||
- *ref_10
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: orders
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,222 @@
|
||||
> ## 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.
|
||||
|
||||
# Ping
|
||||
|
||||
> Perps WebSocket heartbeat.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json ping
|
||||
id: ping
|
||||
title: Ping
|
||||
description: >-
|
||||
Connections are automatically closed after 60 seconds of inactivity. Send a
|
||||
ping message periodically to keep the connection alive.
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: PingSend
|
||||
title: Ping send
|
||||
description: Send ping
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_3
|
||||
id: Request
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Ping
|
||||
description: Client sends ping to test connection and keep alive
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: op
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: type
|
||||
type: string
|
||||
enumValues:
|
||||
- ping
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-2>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-3>
|
||||
op:
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- ping
|
||||
x-parser-schema-id: <anonymous-schema-5>
|
||||
x-parser-schema-id: <anonymous-schema-4>
|
||||
required:
|
||||
- req
|
||||
- op
|
||||
x-parser-schema-id: <anonymous-schema-1>
|
||||
title: Ping
|
||||
description: Client sends ping to test connection and keep alive
|
||||
example: |-
|
||||
{
|
||||
"req": "post",
|
||||
"op": {
|
||||
"type": "ping"
|
||||
}
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Request
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: ping
|
||||
- &ref_2
|
||||
id: PingReceive
|
||||
title: Ping receive
|
||||
description: Pong response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_4
|
||||
id: Response
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Pong
|
||||
description: Server responds with pong including connection info
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
description: Result status
|
||||
enumValues:
|
||||
- ok
|
||||
- err
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations;
|
||||
Unix seconds for withdrawals (must match the on-chain
|
||||
EIP-712 struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: sq
|
||||
type: integer
|
||||
description: Sequence number
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-7>
|
||||
data:
|
||||
type: object
|
||||
required:
|
||||
- status
|
||||
- ts
|
||||
- sq
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
- err
|
||||
description: Result status
|
||||
x-parser-schema-id: <anonymous-schema-9>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations;
|
||||
Unix seconds for withdrawals (must match the on-chain
|
||||
EIP-712 struct verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-10>
|
||||
sq:
|
||||
type: integer
|
||||
description: Sequence number
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-11>
|
||||
x-parser-schema-id: <anonymous-schema-8>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-6>
|
||||
title: Pong
|
||||
description: Server responds with pong including connection info
|
||||
example: |-
|
||||
{
|
||||
"data": {
|
||||
"status": "ok",
|
||||
"ts": 1767225600000,
|
||||
"sq": 1234567890
|
||||
}
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Response
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
receiveOperations:
|
||||
- *ref_2
|
||||
sendMessages:
|
||||
- *ref_3
|
||||
receiveMessages:
|
||||
- *ref_4
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: ping
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,478 @@
|
||||
> ## 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.
|
||||
|
||||
# Place Orders
|
||||
|
||||
> Perps WebSocket order placement.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json placeOrders
|
||||
id: placeOrders
|
||||
title: Create Orders
|
||||
description: |
|
||||
Create new orders.
|
||||
Requires proxy signature, see [proxy signing](/http/signing#2-proxy-signing).
|
||||
|
||||
<Badge color="gray" size="md">Action Weight: **1 / order**</Badge>
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: PlaceOrdersSend
|
||||
title: Place orders send
|
||||
description: Submit new orders
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_3
|
||||
id: Request
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Create Orders Request
|
||||
description: Client submits a signed order placement request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: op
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: type
|
||||
type: string
|
||||
enumValues:
|
||||
- createOrders
|
||||
required: true
|
||||
- name: args
|
||||
type: object
|
||||
description: Array of orders to create
|
||||
required: true
|
||||
properties:
|
||||
- name: iid
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
required: true
|
||||
- name: buy
|
||||
type: boolean
|
||||
description: Is buy
|
||||
required: true
|
||||
- name: p
|
||||
type: string
|
||||
description: Price
|
||||
required: false
|
||||
- name: qty
|
||||
type: string
|
||||
description: Quantity in no. of contracts
|
||||
required: true
|
||||
- name: tif
|
||||
type: string
|
||||
description: Time in force
|
||||
enumValues:
|
||||
- gtc
|
||||
- ioc
|
||||
- fok
|
||||
required: false
|
||||
- name: po
|
||||
type: boolean
|
||||
description: Post only
|
||||
required: false
|
||||
- name: ro
|
||||
type: boolean
|
||||
description: Reduce only
|
||||
required: false
|
||||
- name: c
|
||||
type: string
|
||||
description: Client order ID
|
||||
required: false
|
||||
- name: tr
|
||||
type: object
|
||||
description: Optional trigger attached to this order.
|
||||
required: false
|
||||
properties:
|
||||
- name: market
|
||||
type: boolean
|
||||
description: Whether the trigger executes as a market order
|
||||
required: false
|
||||
- name: trp
|
||||
type: string
|
||||
description: Trigger price
|
||||
required: false
|
||||
- name: tpsl
|
||||
type: string
|
||||
description: Trigger type
|
||||
enumValues:
|
||||
- tp
|
||||
- sl
|
||||
required: false
|
||||
- name: grp
|
||||
type: string
|
||||
description: TPSL grouping
|
||||
enumValues:
|
||||
- order
|
||||
- position
|
||||
required: false
|
||||
- name: sig
|
||||
type: string
|
||||
description: Signature in hex format
|
||||
required: true
|
||||
- name: salt
|
||||
type: integer
|
||||
description: Salt
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: exp
|
||||
type: integer
|
||||
description: >-
|
||||
Command expiry timestamp in Unix milliseconds. If provided, it
|
||||
must be in the future and within the gateway's default command
|
||||
timeout. It can shorten request validity but cannot extend it.
|
||||
This is not an order auto-cancel time.
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-13>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-14>
|
||||
op:
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- args
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- createOrders
|
||||
x-parser-schema-id: <anonymous-schema-16>
|
||||
args:
|
||||
description: Array of orders to create
|
||||
type: object
|
||||
required:
|
||||
- iid
|
||||
- buy
|
||||
- qty
|
||||
properties:
|
||||
iid:
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
example: 1
|
||||
x-parser-schema-id: <anonymous-schema-18>
|
||||
buy:
|
||||
type: boolean
|
||||
description: Is buy
|
||||
example: true
|
||||
x-parser-schema-id: <anonymous-schema-19>
|
||||
p:
|
||||
type: string
|
||||
description: Price
|
||||
example: '100.00'
|
||||
x-parser-schema-id: <anonymous-schema-20>
|
||||
qty:
|
||||
type: string
|
||||
description: Quantity in no. of contracts
|
||||
example: '10.00'
|
||||
x-parser-schema-id: <anonymous-schema-21>
|
||||
tif:
|
||||
type: string
|
||||
description: Time in force
|
||||
enum:
|
||||
- gtc
|
||||
- ioc
|
||||
- fok
|
||||
x-parser-schema-id: <anonymous-schema-22>
|
||||
po:
|
||||
type: boolean
|
||||
description: Post only
|
||||
default: false
|
||||
example: false
|
||||
x-parser-schema-id: <anonymous-schema-23>
|
||||
ro:
|
||||
type: boolean
|
||||
description: Reduce only
|
||||
example: false
|
||||
default: false
|
||||
x-parser-schema-id: <anonymous-schema-24>
|
||||
c:
|
||||
type: string
|
||||
description: Client order ID
|
||||
minLength: 32
|
||||
maxLength: 32
|
||||
pattern: ^[0-9a-f]{32}$
|
||||
example: 550e8400e29b41d4a716446655440000
|
||||
x-parser-schema-id: <anonymous-schema-25>
|
||||
tr:
|
||||
type: object
|
||||
description: Optional trigger attached to this order.
|
||||
properties:
|
||||
market:
|
||||
type: boolean
|
||||
description: Whether the trigger executes as a market order
|
||||
x-parser-schema-id: <anonymous-schema-27>
|
||||
trp:
|
||||
type: string
|
||||
description: Trigger price
|
||||
example: '110.00'
|
||||
x-parser-schema-id: <anonymous-schema-28>
|
||||
tpsl:
|
||||
type: string
|
||||
description: Trigger type
|
||||
enum:
|
||||
- tp
|
||||
- sl
|
||||
x-parser-schema-id: <anonymous-schema-29>
|
||||
x-parser-schema-id: <anonymous-schema-26>
|
||||
x-parser-schema-id: <anonymous-schema-17>
|
||||
grp:
|
||||
type: string
|
||||
description: TPSL grouping
|
||||
enum:
|
||||
- order
|
||||
- position
|
||||
x-parser-schema-id: <anonymous-schema-30>
|
||||
x-parser-schema-id: <anonymous-schema-15>
|
||||
sig:
|
||||
type: string
|
||||
description: Signature in hex format
|
||||
example: 0x1234567890...
|
||||
x-parser-schema-id: <anonymous-schema-31>
|
||||
salt:
|
||||
type: integer
|
||||
description: Salt
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-32>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-33>
|
||||
exp:
|
||||
type: integer
|
||||
description: >-
|
||||
Command expiry timestamp in Unix milliseconds. If provided, it
|
||||
must be in the future and within the gateway's default command
|
||||
timeout. It can shorten request validity but cannot extend it.
|
||||
This is not an order auto-cancel time.
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-34>
|
||||
required:
|
||||
- req
|
||||
- op
|
||||
- sig
|
||||
- salt
|
||||
- ts
|
||||
x-parser-schema-id: <anonymous-schema-12>
|
||||
title: Create Orders Request
|
||||
description: Client submits a signed order placement request
|
||||
example: |-
|
||||
{
|
||||
"req": "post",
|
||||
"op": {
|
||||
"type": "createOrders",
|
||||
"args": [
|
||||
{
|
||||
"iid": 1,
|
||||
"buy": true,
|
||||
"p": "100.00",
|
||||
"qty": "10.00",
|
||||
"tif": "gtc",
|
||||
"po": false,
|
||||
"ro": false,
|
||||
"c": "550e8400e29b41d4a716446655440000",
|
||||
"tr": {
|
||||
"trp": "110.00",
|
||||
"tpsl": "tp"
|
||||
}
|
||||
}
|
||||
],
|
||||
"grp": "order"
|
||||
},
|
||||
"sig": "0x1234567890...",
|
||||
"salt": 1234567890,
|
||||
"ts": 1767225600000,
|
||||
"exp": 1767225600000
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Request
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: placeOrders
|
||||
- &ref_2
|
||||
id: PlaceOrdersReceive
|
||||
title: Place orders receive
|
||||
description: Order ACK response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_4
|
||||
id: Response
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Create Orders Response
|
||||
description: Server responds with order ACK for each submitted order
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: object
|
||||
description: Array of order results
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-36>
|
||||
data:
|
||||
type: object
|
||||
description: Array of order results
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- oid
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-39>
|
||||
oid:
|
||||
type: integer
|
||||
description: Order ID
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-40>
|
||||
coid:
|
||||
type: string
|
||||
description: Client order ID
|
||||
minLength: 32
|
||||
maxLength: 32
|
||||
pattern: ^[0-9a-f]{32}$
|
||||
example: 550e8400e29b41d4a716446655440000
|
||||
x-parser-schema-id: <anonymous-schema-41>
|
||||
x-parser-schema-id: <anonymous-schema-38>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-43>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-44>
|
||||
oid:
|
||||
type: integer
|
||||
description: Order ID
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-45>
|
||||
coid:
|
||||
type: string
|
||||
description: Client order ID
|
||||
minLength: 32
|
||||
maxLength: 32
|
||||
pattern: ^[0-9a-f]{32}$
|
||||
example: 550e8400e29b41d4a716446655440000
|
||||
x-parser-schema-id: <anonymous-schema-46>
|
||||
x-parser-schema-id: <anonymous-schema-42>
|
||||
x-parser-schema-id: <anonymous-schema-37>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-35>
|
||||
title: Create Orders Response
|
||||
description: Server responds with order ACK for each submitted order
|
||||
example: |-
|
||||
{
|
||||
"id": 1,
|
||||
"data": [
|
||||
{
|
||||
"status": "ok",
|
||||
"oid": 1234567890
|
||||
}
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Response
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
receiveOperations:
|
||||
- *ref_2
|
||||
sendMessages:
|
||||
- *ref_3
|
||||
receiveMessages:
|
||||
- *ref_4
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: placeOrders
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,798 @@
|
||||
> ## 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.
|
||||
|
||||
# Portfolio
|
||||
|
||||
> Perps WebSocket private portfolio updates.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json portfolio
|
||||
id: portfolio
|
||||
title: Portfolio
|
||||
description: >-
|
||||
Real-time portfolio updates. Pushed every 5 seconds. Requires authentication,
|
||||
see [Auth](/ws/auth).
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: PortfolioSubscribe
|
||||
title: Portfolio subscribe
|
||||
description: Subscribe to portfolio
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_6
|
||||
id: SubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe
|
||||
description: Subscribe to private portfolio updates (requires prior auth)
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: 'Portfolio private channel: "portfolio"'
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
enumValues:
|
||||
- portfolio
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-550>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-551>
|
||||
chs:
|
||||
type: array
|
||||
description: 'Portfolio private channel: "portfolio"'
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- portfolio
|
||||
x-parser-schema-id: <anonymous-schema-553>
|
||||
example:
|
||||
- portfolio
|
||||
x-parser-schema-id: <anonymous-schema-552>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-549>
|
||||
title: Subscribe
|
||||
description: Subscribe to private portfolio updates (requires prior auth)
|
||||
example: |-
|
||||
{
|
||||
"req": "sub",
|
||||
"chs": [
|
||||
"portfolio"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeRequest
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: portfolio
|
||||
- &ref_3
|
||||
id: PortfolioSubscribeResponse
|
||||
title: Portfolio subscribe response
|
||||
description: Portfolio subscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_8
|
||||
id: SubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe Response
|
||||
description: Response to portfolio subscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-555>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-559>
|
||||
x-parser-schema-id: <anonymous-schema-558>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-561>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-562>
|
||||
x-parser-schema-id: <anonymous-schema-560>
|
||||
x-parser-schema-id: <anonymous-schema-557>
|
||||
x-parser-schema-id: <anonymous-schema-556>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-554>
|
||||
title: Subscribe Response
|
||||
description: Response to portfolio subscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_2
|
||||
id: PortfolioUnsubscribe
|
||||
title: Portfolio unsubscribe
|
||||
description: Unsubscribe from portfolio
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_7
|
||||
id: UnsubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe
|
||||
description: Unsubscribe from private portfolio updates
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: 'Portfolio private channel: "portfolio"'
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
enumValues:
|
||||
- portfolio
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-564>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-565>
|
||||
chs:
|
||||
type: array
|
||||
description: 'Portfolio private channel: "portfolio"'
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- portfolio
|
||||
x-parser-schema-id: <anonymous-schema-567>
|
||||
example:
|
||||
- portfolio
|
||||
x-parser-schema-id: <anonymous-schema-566>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-563>
|
||||
title: Unsubscribe
|
||||
description: Unsubscribe from private portfolio updates
|
||||
example: |-
|
||||
{
|
||||
"req": "unsub",
|
||||
"chs": [
|
||||
"portfolio"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeRequest
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_4
|
||||
id: PortfolioUnsubscribeResponse
|
||||
title: Portfolio unsubscribe response
|
||||
description: Portfolio unsubscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_9
|
||||
id: UnsubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe Response
|
||||
description: Response to portfolio unsubscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-569>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-573>
|
||||
x-parser-schema-id: <anonymous-schema-572>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-575>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-576>
|
||||
x-parser-schema-id: <anonymous-schema-574>
|
||||
x-parser-schema-id: <anonymous-schema-571>
|
||||
x-parser-schema-id: <anonymous-schema-570>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-568>
|
||||
title: Unsubscribe Response
|
||||
description: Response to portfolio unsubscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_5
|
||||
id: PortfolioUpdate
|
||||
title: Portfolio update
|
||||
description: Receive portfolio updates
|
||||
type: send
|
||||
messages:
|
||||
- &ref_10
|
||||
id: Update
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Update
|
||||
description: Portfolio updates pushed every 5 seconds
|
||||
type: object
|
||||
properties:
|
||||
- name: ch
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g.
|
||||
"fills", "orders").
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: sq
|
||||
type: integer
|
||||
description: Sequence number
|
||||
required: true
|
||||
- name: data
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: positions
|
||||
type: array
|
||||
required: true
|
||||
properties:
|
||||
- name: instrument_id
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
required: true
|
||||
- name: symbol
|
||||
type: string
|
||||
description: Instrument symbol
|
||||
required: true
|
||||
- name: size
|
||||
type: string
|
||||
description: >-
|
||||
Signed position size in no. of contracts (positive =
|
||||
long, negative = short)
|
||||
required: true
|
||||
- name: entry_price
|
||||
type: string
|
||||
description: Average entry price
|
||||
required: true
|
||||
- name: leverage
|
||||
type: integer
|
||||
description: Leverage
|
||||
required: true
|
||||
- name: cross
|
||||
type: boolean
|
||||
description: Whether to use cross margin mode
|
||||
required: true
|
||||
- name: initial_margin
|
||||
type: string
|
||||
description: Initial margin in USD
|
||||
required: true
|
||||
- name: maintenance_margin
|
||||
type: string
|
||||
description: Maintenance margin amount
|
||||
required: true
|
||||
- name: position_value
|
||||
type: string
|
||||
description: Notional position value in USD
|
||||
required: true
|
||||
- name: liquidation_price
|
||||
type: string
|
||||
description: Liquidation price
|
||||
required: true
|
||||
- name: unrealized_pnl
|
||||
type: string
|
||||
description: Unrealized PnL in USD
|
||||
required: true
|
||||
- name: return_on_equity
|
||||
type: string
|
||||
description: Return on equity as a decimal
|
||||
required: true
|
||||
- name: cumulative_funding
|
||||
type: string
|
||||
description: Cumulative funding paid/received in USD
|
||||
required: true
|
||||
- name: margin
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: total_account_value
|
||||
type: string
|
||||
description: Total account value in USD (equity + unrealized PnL)
|
||||
required: true
|
||||
- name: total_initial_margin
|
||||
type: string
|
||||
description: Total initial margin in use across all positions
|
||||
required: true
|
||||
- name: total_maintenance_margin
|
||||
type: string
|
||||
description: Total maintenance margin across all positions
|
||||
required: true
|
||||
- name: total_position_value
|
||||
type: string
|
||||
description: Total notional position value in USD
|
||||
required: true
|
||||
- name: withdrawable
|
||||
type: string
|
||||
description: Withdrawable balance in USD
|
||||
required: true
|
||||
- name: in_liquidation
|
||||
type: boolean
|
||||
description: Whether the account is currently under liquidation
|
||||
required: true
|
||||
- name: timestamp
|
||||
type: integer
|
||||
description: Update timestamp in milliseconds
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
title: Portfolio Update
|
||||
type: object
|
||||
properties:
|
||||
ch:
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g. "fills",
|
||||
"orders").
|
||||
example: trades::1
|
||||
x-parser-schema-id: <anonymous-schema-578>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-579>
|
||||
sq:
|
||||
type: integer
|
||||
description: Sequence number
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-580>
|
||||
data:
|
||||
type: object
|
||||
required:
|
||||
- positions
|
||||
- margin
|
||||
- withdrawable
|
||||
- in_liquidation
|
||||
- timestamp
|
||||
properties:
|
||||
positions:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- instrument_id
|
||||
- symbol
|
||||
- size
|
||||
- entry_price
|
||||
- leverage
|
||||
- cross
|
||||
- initial_margin
|
||||
- maintenance_margin
|
||||
- position_value
|
||||
- liquidation_price
|
||||
- unrealized_pnl
|
||||
- return_on_equity
|
||||
- cumulative_funding
|
||||
properties:
|
||||
instrument_id:
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
x-parser-schema-id: <anonymous-schema-584>
|
||||
symbol:
|
||||
type: string
|
||||
description: Instrument symbol
|
||||
example: NVDA-USDC
|
||||
x-parser-schema-id: <anonymous-schema-585>
|
||||
size:
|
||||
type: string
|
||||
description: >-
|
||||
Signed position size in no. of contracts (positive =
|
||||
long, negative = short)
|
||||
example: '10.00'
|
||||
x-parser-schema-id: <anonymous-schema-586>
|
||||
entry_price:
|
||||
type: string
|
||||
description: Average entry price
|
||||
example: '2986.30'
|
||||
x-parser-schema-id: <anonymous-schema-587>
|
||||
leverage:
|
||||
type: integer
|
||||
description: Leverage
|
||||
example: 10
|
||||
x-parser-schema-id: <anonymous-schema-588>
|
||||
cross:
|
||||
type: boolean
|
||||
description: Whether to use cross margin mode
|
||||
x-parser-schema-id: <anonymous-schema-589>
|
||||
initial_margin:
|
||||
type: string
|
||||
description: Initial margin in USD
|
||||
example: '10.00'
|
||||
x-parser-schema-id: <anonymous-schema-590>
|
||||
maintenance_margin:
|
||||
type: string
|
||||
description: Maintenance margin amount
|
||||
example: '100.00'
|
||||
x-parser-schema-id: <anonymous-schema-591>
|
||||
position_value:
|
||||
type: string
|
||||
description: Notional position value in USD
|
||||
example: '100.03'
|
||||
x-parser-schema-id: <anonymous-schema-592>
|
||||
liquidation_price:
|
||||
type: string
|
||||
description: Liquidation price
|
||||
example: '2866.27'
|
||||
x-parser-schema-id: <anonymous-schema-593>
|
||||
unrealized_pnl:
|
||||
type: string
|
||||
description: Unrealized PnL in USD
|
||||
example: '-0.01'
|
||||
x-parser-schema-id: <anonymous-schema-594>
|
||||
return_on_equity:
|
||||
type: string
|
||||
description: Return on equity as a decimal
|
||||
example: '-0.0027'
|
||||
x-parser-schema-id: <anonymous-schema-595>
|
||||
cumulative_funding:
|
||||
type: string
|
||||
description: Cumulative funding paid/received in USD
|
||||
example: '514.09'
|
||||
x-parser-schema-id: <anonymous-schema-596>
|
||||
x-parser-schema-id: <anonymous-schema-583>
|
||||
x-parser-schema-id: <anonymous-schema-582>
|
||||
margin:
|
||||
type: object
|
||||
required:
|
||||
- total_account_value
|
||||
- total_initial_margin
|
||||
- total_maintenance_margin
|
||||
- total_position_value
|
||||
properties:
|
||||
total_account_value:
|
||||
type: string
|
||||
description: Total account value in USD (equity + unrealized PnL)
|
||||
example: '13109.48'
|
||||
x-parser-schema-id: <anonymous-schema-598>
|
||||
total_initial_margin:
|
||||
type: string
|
||||
description: Total initial margin in use across all positions
|
||||
example: '4.97'
|
||||
x-parser-schema-id: <anonymous-schema-599>
|
||||
total_maintenance_margin:
|
||||
type: string
|
||||
description: Total maintenance margin across all positions
|
||||
example: '2.49'
|
||||
x-parser-schema-id: <anonymous-schema-600>
|
||||
total_position_value:
|
||||
type: string
|
||||
description: Total notional position value in USD
|
||||
example: '100.03'
|
||||
x-parser-schema-id: <anonymous-schema-601>
|
||||
x-parser-schema-id: <anonymous-schema-597>
|
||||
withdrawable:
|
||||
type: string
|
||||
description: Withdrawable balance in USD
|
||||
example: '13104.51'
|
||||
x-parser-schema-id: <anonymous-schema-602>
|
||||
in_liquidation:
|
||||
type: boolean
|
||||
description: Whether the account is currently under liquidation
|
||||
x-parser-schema-id: <anonymous-schema-603>
|
||||
timestamp:
|
||||
type: integer
|
||||
description: Update timestamp in milliseconds
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-604>
|
||||
x-parser-schema-id: <anonymous-schema-581>
|
||||
required:
|
||||
- ch
|
||||
- ts
|
||||
- sq
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-577>
|
||||
title: Update
|
||||
description: Portfolio updates pushed every 5 seconds
|
||||
example: |-
|
||||
{
|
||||
"ch": "portfolio",
|
||||
"ts": 1767225600000,
|
||||
"sq": 1234567890,
|
||||
"data": {
|
||||
"positions": [
|
||||
{
|
||||
"symbol": "NVDA-USDC",
|
||||
"size": "10.00",
|
||||
"entry_price": "2986.30",
|
||||
"leverage": 10,
|
||||
"initial_margin": "10.00",
|
||||
"maintenance_margin": "100.00",
|
||||
"position_value": "100.03",
|
||||
"liquidation_price": "2866.27",
|
||||
"unrealized_pnl": "-0.01",
|
||||
"return_on_equity": "-0.0027",
|
||||
"cumulative_funding": "514.09"
|
||||
}
|
||||
],
|
||||
"margin": {
|
||||
"total_account_value": "13109.48",
|
||||
"total_initial_margin": "4.97",
|
||||
"total_maintenance_margin": "2.49",
|
||||
"total_position_value": "100.03"
|
||||
},
|
||||
"withdrawable": "13104.51",
|
||||
"timestamp": 1767225600000
|
||||
}
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Update
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
- *ref_2
|
||||
receiveOperations:
|
||||
- *ref_3
|
||||
- *ref_4
|
||||
- *ref_5
|
||||
sendMessages:
|
||||
- *ref_6
|
||||
- *ref_7
|
||||
receiveMessages:
|
||||
- *ref_8
|
||||
- *ref_9
|
||||
- *ref_10
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: portfolio
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,655 @@
|
||||
> ## 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.
|
||||
|
||||
# Statistics
|
||||
|
||||
> Perps WebSocket 24-hour statistics updates.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json statistics
|
||||
id: statistics
|
||||
title: Statistics
|
||||
description: 24-hour statistics updates. Pushed every 1 second.
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: StatisticsSubscribe
|
||||
title: Statistics subscribe
|
||||
description: Subscribe to statistics
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_6
|
||||
id: SubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe
|
||||
description: >-
|
||||
Subscribe to 24-hour statistics updates for all instruments or a
|
||||
specific one
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: >
|
||||
Statistics subscription: `statistics::all` for every active
|
||||
instrument,
|
||||
|
||||
or `statistics::{iid}` (e.g. `statistics::1`) for a specific
|
||||
one.
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-342>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-343>
|
||||
chs:
|
||||
type: array
|
||||
description: >
|
||||
Statistics subscription: `statistics::all` for every active
|
||||
instrument,
|
||||
|
||||
or `statistics::{iid}` (e.g. `statistics::1`) for a specific
|
||||
one.
|
||||
items:
|
||||
type: string
|
||||
pattern: ^statistics::(\d+|all)$
|
||||
x-parser-schema-id: <anonymous-schema-345>
|
||||
example:
|
||||
- statistics::all
|
||||
x-parser-schema-id: <anonymous-schema-344>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-341>
|
||||
title: Subscribe
|
||||
description: >-
|
||||
Subscribe to 24-hour statistics updates for all instruments or a
|
||||
specific one
|
||||
example: |-
|
||||
{
|
||||
"req": "sub",
|
||||
"chs": [
|
||||
"statistics::all"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeRequest
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: statistics
|
||||
- &ref_3
|
||||
id: StatisticsSubscribeResponse
|
||||
title: Statistics subscribe response
|
||||
description: Statistics subscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_8
|
||||
id: SubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe Response
|
||||
description: Response to statistics subscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-347>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-351>
|
||||
x-parser-schema-id: <anonymous-schema-350>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-353>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-354>
|
||||
x-parser-schema-id: <anonymous-schema-352>
|
||||
x-parser-schema-id: <anonymous-schema-349>
|
||||
x-parser-schema-id: <anonymous-schema-348>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-346>
|
||||
title: Subscribe Response
|
||||
description: Response to statistics subscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_2
|
||||
id: StatisticsUnsubscribe
|
||||
title: Statistics unsubscribe
|
||||
description: Unsubscribe from statistics
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_7
|
||||
id: UnsubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe
|
||||
description: Unsubscribe from statistics updates
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: >
|
||||
Statistics subscription: `statistics::all` for every active
|
||||
instrument,
|
||||
|
||||
or `statistics::{iid}` (e.g. `statistics::1`) for a specific
|
||||
one.
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-356>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-357>
|
||||
chs:
|
||||
type: array
|
||||
description: >
|
||||
Statistics subscription: `statistics::all` for every active
|
||||
instrument,
|
||||
|
||||
or `statistics::{iid}` (e.g. `statistics::1`) for a specific
|
||||
one.
|
||||
items:
|
||||
type: string
|
||||
pattern: ^statistics::(\d+|all)$
|
||||
x-parser-schema-id: <anonymous-schema-359>
|
||||
example:
|
||||
- statistics::all
|
||||
x-parser-schema-id: <anonymous-schema-358>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-355>
|
||||
title: Unsubscribe
|
||||
description: Unsubscribe from statistics updates
|
||||
example: |-
|
||||
{
|
||||
"req": "unsub",
|
||||
"chs": [
|
||||
"statistics::all"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeRequest
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_4
|
||||
id: StatisticsUnsubscribeResponse
|
||||
title: Statistics unsubscribe response
|
||||
description: Statistics unsubscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_9
|
||||
id: UnsubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe Response
|
||||
description: Response to statistics unsubscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-361>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-365>
|
||||
x-parser-schema-id: <anonymous-schema-364>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-367>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-368>
|
||||
x-parser-schema-id: <anonymous-schema-366>
|
||||
x-parser-schema-id: <anonymous-schema-363>
|
||||
x-parser-schema-id: <anonymous-schema-362>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-360>
|
||||
title: Unsubscribe Response
|
||||
description: Response to statistics unsubscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_5
|
||||
id: StatisticsUpdate
|
||||
title: Statistics update
|
||||
description: Receive statistics updates
|
||||
type: send
|
||||
messages:
|
||||
- &ref_10
|
||||
id: Update
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Update
|
||||
description: 24-hour statistics for subscribed instruments
|
||||
type: object
|
||||
properties:
|
||||
- name: ch
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g.
|
||||
"fills", "orders").
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: sq
|
||||
type: integer
|
||||
description: Sequence number
|
||||
required: true
|
||||
- name: data
|
||||
type: object
|
||||
description: Array of statistics objects
|
||||
required: true
|
||||
properties:
|
||||
- name: iid
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
required: true
|
||||
- name: vol
|
||||
type: string
|
||||
description: 24-hour trading volume in contracts
|
||||
required: true
|
||||
- name: open
|
||||
type: string
|
||||
description: Opening price from 24 hours ago
|
||||
required: true
|
||||
- name: klines
|
||||
type: array
|
||||
description: Last 24-hour kline data
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: array
|
||||
description: |
|
||||
- `1767225600000` - Open time
|
||||
- `"100.00"` - Open price
|
||||
- `"105.00"` - High price
|
||||
- `"99.00"` - Low price
|
||||
- `"102.00"` - Close price
|
||||
- `"500.00"` - Volume (base unit)
|
||||
- `42` - Number of trades
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
title: Statistics Update
|
||||
type: object
|
||||
properties:
|
||||
ch:
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g. "fills",
|
||||
"orders").
|
||||
example: trades::1
|
||||
x-parser-schema-id: <anonymous-schema-370>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-371>
|
||||
sq:
|
||||
type: integer
|
||||
description: Sequence number
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-372>
|
||||
data:
|
||||
type: object
|
||||
description: Array of statistics objects
|
||||
properties:
|
||||
iid:
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
example: 1
|
||||
x-parser-schema-id: <anonymous-schema-374>
|
||||
vol:
|
||||
type: string
|
||||
description: 24-hour trading volume in contracts
|
||||
example: '1000.00'
|
||||
x-parser-schema-id: <anonymous-schema-375>
|
||||
open:
|
||||
type: string
|
||||
description: Opening price from 24 hours ago
|
||||
example: '100.50'
|
||||
x-parser-schema-id: <anonymous-schema-376>
|
||||
klines:
|
||||
type: array
|
||||
items:
|
||||
type: array
|
||||
description: |
|
||||
- `1767225600000` - Open time
|
||||
- `"100.00"` - Open price
|
||||
- `"105.00"` - High price
|
||||
- `"99.00"` - Low price
|
||||
- `"102.00"` - Close price
|
||||
- `"500.00"` - Volume (base unit)
|
||||
- `42` - Number of trades
|
||||
example:
|
||||
- 1767225600000
|
||||
- '100.00'
|
||||
- '105.00'
|
||||
- '99.00'
|
||||
- '102.00'
|
||||
- '500.00'
|
||||
- 42
|
||||
x-parser-schema-id: <anonymous-schema-378>
|
||||
description: Last 24-hour kline data
|
||||
x-parser-schema-id: <anonymous-schema-377>
|
||||
required:
|
||||
- iid
|
||||
- vol
|
||||
- open
|
||||
- klines
|
||||
x-parser-schema-id: <anonymous-schema-373>
|
||||
required:
|
||||
- ch
|
||||
- ts
|
||||
- sq
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-369>
|
||||
title: Update
|
||||
description: 24-hour statistics for subscribed instruments
|
||||
example: |-
|
||||
{
|
||||
"ch": "statistics::all",
|
||||
"ts": 1767225600000,
|
||||
"sq": 1234567890,
|
||||
"data": [
|
||||
{
|
||||
"iid": 1,
|
||||
"vol": "1000.00",
|
||||
"open": "100.50",
|
||||
"klines": [
|
||||
[
|
||||
1767225600000,
|
||||
"100.00",
|
||||
"105.00",
|
||||
"99.00",
|
||||
"102.00",
|
||||
"500.00",
|
||||
42
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Update
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
- *ref_2
|
||||
receiveOperations:
|
||||
- *ref_3
|
||||
- *ref_4
|
||||
- *ref_5
|
||||
sendMessages:
|
||||
- *ref_6
|
||||
- *ref_7
|
||||
receiveMessages:
|
||||
- *ref_8
|
||||
- *ref_9
|
||||
- *ref_10
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: statistics
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,647 @@
|
||||
> ## 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.
|
||||
|
||||
# Tickers
|
||||
|
||||
> Perps WebSocket ticker updates.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json tickers
|
||||
id: tickers
|
||||
title: Tickers
|
||||
description: Ticker updates. Pushed every 100ms.
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: TickersSubscribe
|
||||
title: Tickers subscribe
|
||||
description: Subscribe to tickers
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_6
|
||||
id: SubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe
|
||||
description: Subscribe to ticker updates for all instruments or a specific one
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: >
|
||||
Ticker subscription: `tickers::all` for every active
|
||||
instrument,
|
||||
|
||||
or `tickers::{iid}` (e.g. `tickers::1`) for a specific one.
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-301>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-302>
|
||||
chs:
|
||||
type: array
|
||||
description: |
|
||||
Ticker subscription: `tickers::all` for every active instrument,
|
||||
or `tickers::{iid}` (e.g. `tickers::1`) for a specific one.
|
||||
items:
|
||||
type: string
|
||||
pattern: ^tickers::(\d+|all)$
|
||||
x-parser-schema-id: <anonymous-schema-304>
|
||||
example:
|
||||
- tickers::all
|
||||
x-parser-schema-id: <anonymous-schema-303>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-300>
|
||||
title: Subscribe
|
||||
description: Subscribe to ticker updates for all instruments or a specific one
|
||||
example: |-
|
||||
{
|
||||
"req": "sub",
|
||||
"chs": [
|
||||
"tickers::all"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeRequest
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: tickers
|
||||
- &ref_3
|
||||
id: TickersSubscribeResponse
|
||||
title: Tickers subscribe response
|
||||
description: Tickers subscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_8
|
||||
id: SubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe Response
|
||||
description: Response to tickers subscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-306>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-310>
|
||||
x-parser-schema-id: <anonymous-schema-309>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-312>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-313>
|
||||
x-parser-schema-id: <anonymous-schema-311>
|
||||
x-parser-schema-id: <anonymous-schema-308>
|
||||
x-parser-schema-id: <anonymous-schema-307>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-305>
|
||||
title: Subscribe Response
|
||||
description: Response to tickers subscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_2
|
||||
id: TickersUnsubscribe
|
||||
title: Tickers unsubscribe
|
||||
description: Unsubscribe from tickers
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_7
|
||||
id: UnsubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe
|
||||
description: Unsubscribe from ticker updates
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: >
|
||||
Ticker subscription: `tickers::all` for every active
|
||||
instrument,
|
||||
|
||||
or `tickers::{iid}` (e.g. `tickers::1`) for a specific one.
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-315>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-316>
|
||||
chs:
|
||||
type: array
|
||||
description: |
|
||||
Ticker subscription: `tickers::all` for every active instrument,
|
||||
or `tickers::{iid}` (e.g. `tickers::1`) for a specific one.
|
||||
items:
|
||||
type: string
|
||||
pattern: ^tickers::(\d+|all)$
|
||||
x-parser-schema-id: <anonymous-schema-318>
|
||||
example:
|
||||
- tickers::all
|
||||
x-parser-schema-id: <anonymous-schema-317>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-314>
|
||||
title: Unsubscribe
|
||||
description: Unsubscribe from ticker updates
|
||||
example: |-
|
||||
{
|
||||
"req": "unsub",
|
||||
"chs": [
|
||||
"tickers::all"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeRequest
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_4
|
||||
id: TickersUnsubscribeResponse
|
||||
title: Tickers unsubscribe response
|
||||
description: Tickers unsubscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_9
|
||||
id: UnsubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe Response
|
||||
description: Response to tickers unsubscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-320>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-324>
|
||||
x-parser-schema-id: <anonymous-schema-323>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-326>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-327>
|
||||
x-parser-schema-id: <anonymous-schema-325>
|
||||
x-parser-schema-id: <anonymous-schema-322>
|
||||
x-parser-schema-id: <anonymous-schema-321>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-319>
|
||||
title: Unsubscribe Response
|
||||
description: Response to tickers unsubscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_5
|
||||
id: TickersUpdate
|
||||
title: Tickers update
|
||||
description: Receive ticker updates
|
||||
type: send
|
||||
messages:
|
||||
- &ref_10
|
||||
id: Update
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Update
|
||||
description: Real-time ticker updates for subscribed instruments
|
||||
type: object
|
||||
properties:
|
||||
- name: ch
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g.
|
||||
"fills", "orders").
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: sq
|
||||
type: integer
|
||||
description: Sequence number
|
||||
required: true
|
||||
- name: data
|
||||
type: object
|
||||
description: Array of ticker objects
|
||||
required: true
|
||||
properties:
|
||||
- name: iid
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
required: true
|
||||
- name: idx
|
||||
type: string
|
||||
description: Index price
|
||||
required: true
|
||||
- name: mark
|
||||
type: string
|
||||
description: Mark price
|
||||
required: true
|
||||
- name: last
|
||||
type: string
|
||||
description: Last traded price
|
||||
required: true
|
||||
- name: mid
|
||||
type: string
|
||||
description: Mid price
|
||||
required: true
|
||||
- name: oi
|
||||
type: string
|
||||
description: Open interest in number of contracts
|
||||
required: true
|
||||
- name: fr
|
||||
type: string
|
||||
description: Funding rate
|
||||
required: true
|
||||
- name: nxf
|
||||
type: integer
|
||||
description: Next funding timestamp in milliseconds
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
title: Ticker Update
|
||||
type: object
|
||||
properties:
|
||||
ch:
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g. "fills",
|
||||
"orders").
|
||||
example: trades::1
|
||||
x-parser-schema-id: <anonymous-schema-329>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-330>
|
||||
sq:
|
||||
type: integer
|
||||
description: Sequence number
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-331>
|
||||
data:
|
||||
type: object
|
||||
description: Array of ticker objects
|
||||
properties:
|
||||
iid:
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
example: 1
|
||||
x-parser-schema-id: <anonymous-schema-333>
|
||||
idx:
|
||||
type: string
|
||||
description: Index price
|
||||
example: '100.00'
|
||||
x-parser-schema-id: <anonymous-schema-334>
|
||||
mark:
|
||||
type: string
|
||||
description: Mark price
|
||||
example: '100.00'
|
||||
x-parser-schema-id: <anonymous-schema-335>
|
||||
last:
|
||||
type: string
|
||||
description: Last traded price
|
||||
example: '100.00'
|
||||
x-parser-schema-id: <anonymous-schema-336>
|
||||
mid:
|
||||
type: string
|
||||
description: Mid price
|
||||
example: '100.00'
|
||||
x-parser-schema-id: <anonymous-schema-337>
|
||||
oi:
|
||||
type: string
|
||||
description: Open interest in number of contracts
|
||||
example: '10.00'
|
||||
x-parser-schema-id: <anonymous-schema-338>
|
||||
fr:
|
||||
type: string
|
||||
description: Funding rate
|
||||
example: '0.0001'
|
||||
x-parser-schema-id: <anonymous-schema-339>
|
||||
nxf:
|
||||
type: integer
|
||||
description: Next funding timestamp in milliseconds
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-340>
|
||||
required:
|
||||
- iid
|
||||
- idx
|
||||
- mark
|
||||
- last
|
||||
- mid
|
||||
- oi
|
||||
- fr
|
||||
- nxf
|
||||
x-parser-schema-id: <anonymous-schema-332>
|
||||
required:
|
||||
- ch
|
||||
- ts
|
||||
- sq
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-328>
|
||||
title: Update
|
||||
description: Real-time ticker updates for subscribed instruments
|
||||
example: |-
|
||||
{
|
||||
"ch": "tickers::all",
|
||||
"ts": 1767225600000,
|
||||
"sq": 1234567890,
|
||||
"data": [
|
||||
{
|
||||
"iid": 1,
|
||||
"idx": "100.00",
|
||||
"mark": "100.00",
|
||||
"last": "100.00",
|
||||
"mid": "100.00",
|
||||
"oi": "10.00",
|
||||
"fr": "0.0001",
|
||||
"nxf": 1767225600000
|
||||
}
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Update
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
- *ref_2
|
||||
receiveOperations:
|
||||
- *ref_3
|
||||
- *ref_4
|
||||
- *ref_5
|
||||
sendMessages:
|
||||
- *ref_6
|
||||
- *ref_7
|
||||
receiveMessages:
|
||||
- *ref_8
|
||||
- *ref_9
|
||||
- *ref_10
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: tickers
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,647 @@
|
||||
> ## 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.
|
||||
|
||||
# Trades
|
||||
|
||||
> Perps WebSocket public trade updates.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json trades
|
||||
id: trades
|
||||
title: Trades
|
||||
description: Real-time trade stream.
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: TradesSubscribe
|
||||
title: Trades subscribe
|
||||
description: Subscribe to trades
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_6
|
||||
id: SubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe
|
||||
description: Subscribe to public trade updates for an instrument
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: >-
|
||||
Trades subscription in format "trades::{iid}" (e.g.,
|
||||
"trades::1")
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-150>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-151>
|
||||
chs:
|
||||
type: array
|
||||
description: >-
|
||||
Trades subscription in format "trades::{iid}" (e.g.,
|
||||
"trades::1")
|
||||
items:
|
||||
type: string
|
||||
pattern: ^trades::\d+$
|
||||
x-parser-schema-id: <anonymous-schema-153>
|
||||
example:
|
||||
- trades::1
|
||||
x-parser-schema-id: <anonymous-schema-152>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-149>
|
||||
title: Subscribe
|
||||
description: Subscribe to public trade updates for an instrument
|
||||
example: |-
|
||||
{
|
||||
"req": "sub",
|
||||
"chs": [
|
||||
"trades::1"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeRequest
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: trades
|
||||
- &ref_3
|
||||
id: TradesSubscribeResponse
|
||||
title: Trades subscribe response
|
||||
description: Trades subscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_8
|
||||
id: SubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe Response
|
||||
description: Response to trades subscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-155>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-159>
|
||||
x-parser-schema-id: <anonymous-schema-158>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-161>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-162>
|
||||
x-parser-schema-id: <anonymous-schema-160>
|
||||
x-parser-schema-id: <anonymous-schema-157>
|
||||
x-parser-schema-id: <anonymous-schema-156>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-154>
|
||||
title: Subscribe Response
|
||||
description: Response to trades subscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_2
|
||||
id: TradesUnsubscribe
|
||||
title: Trades unsubscribe
|
||||
description: Unsubscribe from trades
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_7
|
||||
id: UnsubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe
|
||||
description: Unsubscribe from public trade updates
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: >-
|
||||
Trades subscription in format "trades::{iid}" (e.g.,
|
||||
"trades::1")
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-164>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-165>
|
||||
chs:
|
||||
type: array
|
||||
description: >-
|
||||
Trades subscription in format "trades::{iid}" (e.g.,
|
||||
"trades::1")
|
||||
items:
|
||||
type: string
|
||||
pattern: ^trades::\d+$
|
||||
x-parser-schema-id: <anonymous-schema-167>
|
||||
example:
|
||||
- trades::1
|
||||
x-parser-schema-id: <anonymous-schema-166>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-163>
|
||||
title: Unsubscribe
|
||||
description: Unsubscribe from public trade updates
|
||||
example: |-
|
||||
{
|
||||
"req": "unsub",
|
||||
"chs": [
|
||||
"trades::1"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeRequest
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_4
|
||||
id: TradesUnsubscribeResponse
|
||||
title: Trades unsubscribe response
|
||||
description: Trades unsubscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_9
|
||||
id: UnsubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe Response
|
||||
description: Response to trades unsubscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-169>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-173>
|
||||
x-parser-schema-id: <anonymous-schema-172>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-175>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-176>
|
||||
x-parser-schema-id: <anonymous-schema-174>
|
||||
x-parser-schema-id: <anonymous-schema-171>
|
||||
x-parser-schema-id: <anonymous-schema-170>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-168>
|
||||
title: Unsubscribe Response
|
||||
description: Response to trades unsubscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_5
|
||||
id: TradesUpdate
|
||||
title: Trades update
|
||||
description: Receive trade updates
|
||||
type: send
|
||||
messages:
|
||||
- &ref_10
|
||||
id: Update
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Update
|
||||
description: Real-time trade updates for subscribed instruments
|
||||
type: object
|
||||
properties:
|
||||
- name: ch
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g.
|
||||
"fills", "orders").
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: sq
|
||||
type: integer
|
||||
description: Sequence number
|
||||
required: true
|
||||
- name: data
|
||||
type: object
|
||||
title: TradeResponse
|
||||
description: Array of trade objects
|
||||
required: true
|
||||
properties:
|
||||
- name: tid
|
||||
type: integer
|
||||
description: Trade ID
|
||||
required: true
|
||||
- name: iid
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
required: true
|
||||
- name: side
|
||||
type: string
|
||||
description: Side
|
||||
enumValues:
|
||||
- long
|
||||
- short
|
||||
required: true
|
||||
- name: p
|
||||
type: string
|
||||
description: Price
|
||||
required: true
|
||||
- name: qty
|
||||
type: string
|
||||
description: Quantity in no. of contracts
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations;
|
||||
Unix seconds for withdrawals (must match the on-chain
|
||||
EIP-712 struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: hash
|
||||
type: string
|
||||
description: On-chain transaction hash, "0x" if not yet mined
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
title: Trades Update
|
||||
type: object
|
||||
properties:
|
||||
ch:
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g. "fills",
|
||||
"orders").
|
||||
example: trades::1
|
||||
x-parser-schema-id: <anonymous-schema-178>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-179>
|
||||
sq:
|
||||
type: integer
|
||||
description: Sequence number
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-180>
|
||||
data:
|
||||
type: object
|
||||
description: Array of trade objects
|
||||
title: TradeResponse
|
||||
properties:
|
||||
tid:
|
||||
type: integer
|
||||
description: Trade ID
|
||||
example: 1
|
||||
x-parser-schema-id: <anonymous-schema-182>
|
||||
iid:
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
example: 1
|
||||
x-parser-schema-id: <anonymous-schema-183>
|
||||
side:
|
||||
type: string
|
||||
description: Side
|
||||
enum:
|
||||
- long
|
||||
- short
|
||||
x-parser-schema-id: <anonymous-schema-184>
|
||||
p:
|
||||
type: string
|
||||
description: Price
|
||||
example: '100.00'
|
||||
x-parser-schema-id: <anonymous-schema-185>
|
||||
qty:
|
||||
type: string
|
||||
description: Quantity in no. of contracts
|
||||
example: '10.00'
|
||||
x-parser-schema-id: <anonymous-schema-186>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations;
|
||||
Unix seconds for withdrawals (must match the on-chain
|
||||
EIP-712 struct verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-187>
|
||||
hash:
|
||||
type: string
|
||||
description: On-chain transaction hash, "0x" if not yet mined
|
||||
default: 0x
|
||||
example: >-
|
||||
0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
|
||||
x-parser-schema-id: <anonymous-schema-188>
|
||||
required:
|
||||
- tid
|
||||
- iid
|
||||
- side
|
||||
- p
|
||||
- qty
|
||||
- ts
|
||||
- hash
|
||||
x-parser-schema-id: <anonymous-schema-181>
|
||||
required:
|
||||
- ch
|
||||
- ts
|
||||
- sq
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-177>
|
||||
title: Update
|
||||
description: Real-time trade updates for subscribed instruments
|
||||
example: |-
|
||||
{
|
||||
"ch": "trades::1",
|
||||
"ts": 1767225600000,
|
||||
"sq": 1234567890,
|
||||
"data": [
|
||||
{
|
||||
"tid": 1,
|
||||
"iid": 1,
|
||||
"side": "long",
|
||||
"p": "100.00",
|
||||
"qty": "10.00",
|
||||
"ts": 1767225600000,
|
||||
"hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
|
||||
}
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Update
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
- *ref_2
|
||||
receiveOperations:
|
||||
- *ref_3
|
||||
- *ref_4
|
||||
- *ref_5
|
||||
sendMessages:
|
||||
- *ref_6
|
||||
- *ref_7
|
||||
receiveMessages:
|
||||
- *ref_8
|
||||
- *ref_9
|
||||
- *ref_10
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: trades
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,325 @@
|
||||
> ## 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.
|
||||
|
||||
# Update Leverage
|
||||
|
||||
> Perps WebSocket leverage updates.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json updateLeverage
|
||||
id: updateLeverage
|
||||
title: Update Leverage
|
||||
description: |
|
||||
Set leverage and margin type for an instrument.
|
||||
Requires proxy signature, see [proxy signing](/http/signing#2-proxy-signing).
|
||||
|
||||
<Badge color="gray" size="md">Action Weight: **1**</Badge>
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: UpdateLeverageSend
|
||||
title: Update leverage send
|
||||
description: Update leverage
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_3
|
||||
id: Request
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Update Leverage Request
|
||||
description: Client submits a signed leverage update request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: op
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: type
|
||||
type: string
|
||||
enumValues:
|
||||
- updateLeverage
|
||||
required: true
|
||||
- name: args
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: iid
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
required: true
|
||||
- name: lev
|
||||
type: integer
|
||||
description: Leverage
|
||||
required: true
|
||||
- name: cross
|
||||
type: boolean
|
||||
description: Whether to use cross margin mode
|
||||
required: true
|
||||
- name: sig
|
||||
type: string
|
||||
description: Signature in hex format
|
||||
required: true
|
||||
- name: salt
|
||||
type: integer
|
||||
description: Salt
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-114>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-115>
|
||||
op:
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- args
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- updateLeverage
|
||||
x-parser-schema-id: <anonymous-schema-117>
|
||||
args:
|
||||
type: object
|
||||
required:
|
||||
- iid
|
||||
- lev
|
||||
- cross
|
||||
properties:
|
||||
iid:
|
||||
type: integer
|
||||
description: Instrument ID
|
||||
example: 1
|
||||
x-parser-schema-id: <anonymous-schema-119>
|
||||
lev:
|
||||
type: integer
|
||||
description: Leverage
|
||||
example: 10
|
||||
x-parser-schema-id: <anonymous-schema-120>
|
||||
cross:
|
||||
type: boolean
|
||||
description: Whether to use cross margin mode
|
||||
x-parser-schema-id: <anonymous-schema-121>
|
||||
x-parser-schema-id: <anonymous-schema-118>
|
||||
x-parser-schema-id: <anonymous-schema-116>
|
||||
sig:
|
||||
type: string
|
||||
description: Signature in hex format
|
||||
example: 0x1234567890...
|
||||
x-parser-schema-id: <anonymous-schema-122>
|
||||
salt:
|
||||
type: integer
|
||||
description: Salt
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-123>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-124>
|
||||
required:
|
||||
- req
|
||||
- op
|
||||
- sig
|
||||
- salt
|
||||
- ts
|
||||
x-parser-schema-id: <anonymous-schema-113>
|
||||
title: Update Leverage Request
|
||||
description: Client submits a signed leverage update request
|
||||
example: |-
|
||||
{
|
||||
"req": "post",
|
||||
"op": {
|
||||
"type": "updateLeverage",
|
||||
"args": {
|
||||
"iid": 1,
|
||||
"lev": 10
|
||||
}
|
||||
},
|
||||
"sig": "0x1234567890...",
|
||||
"salt": 1234567890,
|
||||
"ts": 1767225600000
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Request
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: updateLeverage
|
||||
- &ref_2
|
||||
id: UpdateLeverageReceive
|
||||
title: Update leverage receive
|
||||
description: Update leverage response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_4
|
||||
id: Response
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Update Leverage Response
|
||||
description: Server responds with leverage update result
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: object
|
||||
required: true
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of the
|
||||
API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`, `unauthorized`,
|
||||
`not_found`. For `400` it is a human-readable validation
|
||||
detail whose wording may change. See the Error handling
|
||||
guide for the domain identifiers. (Post-only /
|
||||
Fill-or-Kill outcomes are order statuses such as
|
||||
`post_only_rejected`, not rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-126>
|
||||
data:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-129>
|
||||
x-parser-schema-id: <anonymous-schema-128>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-131>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-132>
|
||||
x-parser-schema-id: <anonymous-schema-130>
|
||||
x-parser-schema-id: <anonymous-schema-127>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-125>
|
||||
title: Update Leverage Response
|
||||
description: Server responds with leverage update result
|
||||
example: |-
|
||||
{
|
||||
"id": 6,
|
||||
"data": {
|
||||
"status": "ok"
|
||||
}
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Response
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
receiveOperations:
|
||||
- *ref_2
|
||||
sendMessages:
|
||||
- *ref_3
|
||||
receiveMessages:
|
||||
- *ref_4
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: updateLeverage
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
@@ -0,0 +1,647 @@
|
||||
> ## 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.
|
||||
|
||||
# Withdrawals
|
||||
|
||||
> Perps WebSocket private withdrawal updates.
|
||||
|
||||
|
||||
|
||||
## AsyncAPI
|
||||
|
||||
````yaml asyncapi-perps.json withdrawals
|
||||
id: withdrawals
|
||||
title: Withdrawals
|
||||
description: >-
|
||||
Real-time withdrawal status updates. Requires authentication, see
|
||||
[Auth](/ws/auth).
|
||||
servers:
|
||||
- id: production
|
||||
protocol: wss
|
||||
host: ws.perpetuals.polymarket.com
|
||||
bindings: []
|
||||
variables: []
|
||||
address: /v1/ws
|
||||
parameters: []
|
||||
bindings: []
|
||||
operations:
|
||||
- &ref_1
|
||||
id: WithdrawalsSubscribe
|
||||
title: Withdrawals subscribe
|
||||
description: Subscribe to withdrawals
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_6
|
||||
id: SubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe
|
||||
description: Subscribe to private withdrawal updates (requires prior auth)
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: 'Withdrawals private channel: "withdrawals"'
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
enumValues:
|
||||
- withdrawals
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-643>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-644>
|
||||
chs:
|
||||
type: array
|
||||
description: 'Withdrawals private channel: "withdrawals"'
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- withdrawals
|
||||
x-parser-schema-id: <anonymous-schema-646>
|
||||
example:
|
||||
- withdrawals
|
||||
x-parser-schema-id: <anonymous-schema-645>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-642>
|
||||
title: Subscribe
|
||||
description: Subscribe to private withdrawal updates (requires prior auth)
|
||||
example: |-
|
||||
{
|
||||
"req": "sub",
|
||||
"chs": [
|
||||
"withdrawals"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeRequest
|
||||
bindings: []
|
||||
extensions: &ref_0
|
||||
- id: x-parser-unique-object-id
|
||||
value: withdrawals
|
||||
- &ref_3
|
||||
id: WithdrawalsSubscribeResponse
|
||||
title: Withdrawals subscribe response
|
||||
description: Withdrawals subscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_8
|
||||
id: SubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Subscribe Response
|
||||
description: Response to withdrawals subscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-648>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-652>
|
||||
x-parser-schema-id: <anonymous-schema-651>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-654>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-655>
|
||||
x-parser-schema-id: <anonymous-schema-653>
|
||||
x-parser-schema-id: <anonymous-schema-650>
|
||||
x-parser-schema-id: <anonymous-schema-649>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-647>
|
||||
title: Subscribe Response
|
||||
description: Response to withdrawals subscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: SubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_2
|
||||
id: WithdrawalsUnsubscribe
|
||||
title: Withdrawals unsubscribe
|
||||
description: Unsubscribe from withdrawals
|
||||
type: receive
|
||||
messages:
|
||||
- &ref_7
|
||||
id: UnsubscribeRequest
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe
|
||||
description: Unsubscribe from private withdrawal updates
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: req
|
||||
type: string
|
||||
description: Request type
|
||||
enumValues:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
required: true
|
||||
- name: chs
|
||||
type: array
|
||||
description: 'Withdrawals private channel: "withdrawals"'
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: string
|
||||
enumValues:
|
||||
- withdrawals
|
||||
required: false
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Request
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-657>
|
||||
req:
|
||||
type: string
|
||||
description: Request type
|
||||
enum:
|
||||
- post
|
||||
- sub
|
||||
- unsub
|
||||
x-parser-schema-id: <anonymous-schema-658>
|
||||
chs:
|
||||
type: array
|
||||
description: 'Withdrawals private channel: "withdrawals"'
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- withdrawals
|
||||
x-parser-schema-id: <anonymous-schema-660>
|
||||
example:
|
||||
- withdrawals
|
||||
x-parser-schema-id: <anonymous-schema-659>
|
||||
required:
|
||||
- req
|
||||
- chs
|
||||
x-parser-schema-id: <anonymous-schema-656>
|
||||
title: Unsubscribe
|
||||
description: Unsubscribe from private withdrawal updates
|
||||
example: |-
|
||||
{
|
||||
"req": "unsub",
|
||||
"chs": [
|
||||
"withdrawals"
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeRequest
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_4
|
||||
id: WithdrawalsUnsubscribeResponse
|
||||
title: Withdrawals unsubscribe response
|
||||
description: Withdrawals unsubscribe response
|
||||
type: send
|
||||
messages:
|
||||
- &ref_9
|
||||
id: UnsubscribeResponse
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Unsubscribe Response
|
||||
description: Response to withdrawals unsubscribe request
|
||||
type: object
|
||||
properties:
|
||||
- name: id
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
required: false
|
||||
- name: data
|
||||
type: array
|
||||
title: Subscribe Response
|
||||
required: true
|
||||
properties:
|
||||
- name: item
|
||||
type: object
|
||||
required: false
|
||||
properties:
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- ok
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
enumValues:
|
||||
- err
|
||||
required: true
|
||||
- name: error
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
type: object
|
||||
title: Base Response
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: Correlation ID for request-response matching
|
||||
x-parser-schema-id: <anonymous-schema-662>
|
||||
data:
|
||||
title: Subscribe Response
|
||||
type: array
|
||||
items:
|
||||
oneOf:
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
x-parser-schema-id: <anonymous-schema-666>
|
||||
x-parser-schema-id: <anonymous-schema-665>
|
||||
- type: object
|
||||
required:
|
||||
- status
|
||||
- error
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- err
|
||||
x-parser-schema-id: <anonymous-schema-668>
|
||||
error:
|
||||
type: string
|
||||
description: >-
|
||||
Error identifier. For domain rejections and transport
|
||||
errors (`401`/`404`/`429`/`500`) this is a stable,
|
||||
machine-readable snake_case identifier that is part of
|
||||
the API contract and safe to branch on, e.g.
|
||||
`insufficient_margin`, `insufficient_balance`,
|
||||
`order_not_found`, `reduce_only_invalid`,
|
||||
`unauthorized`, `not_found`. For `400` it is a
|
||||
human-readable validation detail whose wording may
|
||||
change. See the Error handling guide for the domain
|
||||
identifiers. (Post-only / Fill-or-Kill outcomes are
|
||||
order statuses such as `post_only_rejected`, not
|
||||
rejections.)
|
||||
example: insufficient_margin
|
||||
x-parser-schema-id: <anonymous-schema-669>
|
||||
x-parser-schema-id: <anonymous-schema-667>
|
||||
x-parser-schema-id: <anonymous-schema-664>
|
||||
x-parser-schema-id: <anonymous-schema-663>
|
||||
required:
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-661>
|
||||
title: Unsubscribe Response
|
||||
description: Response to withdrawals unsubscribe request
|
||||
example: |-
|
||||
{
|
||||
"data": []
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: UnsubscribeResponse
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
- &ref_5
|
||||
id: WithdrawalsUpdate
|
||||
title: Withdrawals update
|
||||
description: Receive withdrawal updates
|
||||
type: send
|
||||
messages:
|
||||
- &ref_10
|
||||
id: Update
|
||||
contentType: application/json
|
||||
payload:
|
||||
- name: Update
|
||||
description: Withdrawal status updates for authenticated users
|
||||
type: object
|
||||
properties:
|
||||
- name: ch
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g.
|
||||
"fills", "orders").
|
||||
required: true
|
||||
- name: ts
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712
|
||||
struct verified against block.timestamp).
|
||||
required: true
|
||||
- name: sq
|
||||
type: integer
|
||||
description: Sequence number
|
||||
required: true
|
||||
- name: data
|
||||
type: object
|
||||
description: Array of withdrawal objects
|
||||
required: true
|
||||
properties:
|
||||
- name: withdraw_id
|
||||
type: integer
|
||||
description: Withdraw ID
|
||||
required: true
|
||||
- name: asset
|
||||
type: string
|
||||
description: Asset name
|
||||
required: true
|
||||
- name: amount
|
||||
type: string
|
||||
description: >-
|
||||
Raw token amount including decimals. For withdrawals this
|
||||
matches the uint256 amount in the EIP-712 signature (e.g.
|
||||
"100000000" for 100 USDC with 6 decimals).
|
||||
required: true
|
||||
- name: fee
|
||||
type: string
|
||||
description: Withdrawal transaction fee in decimalized asset units
|
||||
required: true
|
||||
- name: to
|
||||
type: string
|
||||
description: Destination address in hex format
|
||||
required: true
|
||||
- name: status
|
||||
type: string
|
||||
description: Withdrawal status
|
||||
enumValues:
|
||||
- pending
|
||||
- confirmed
|
||||
- removed
|
||||
- failed
|
||||
required: true
|
||||
- name: hash
|
||||
type: string
|
||||
description: On-chain transaction hash, "0x" if not yet mined
|
||||
required: true
|
||||
headers: []
|
||||
jsonPayloadSchema:
|
||||
title: Withdrawals Update
|
||||
type: object
|
||||
properties:
|
||||
ch:
|
||||
type: string
|
||||
description: >-
|
||||
Channel name for push data. Parameterized channels include the
|
||||
instrument ID (e.g. "trades::1", "book::1", "klines::1::1m",
|
||||
"tickers::all"). Private channels use plain names (e.g. "fills",
|
||||
"orders").
|
||||
example: trades::1
|
||||
x-parser-schema-id: <anonymous-schema-671>
|
||||
ts:
|
||||
type: integer
|
||||
description: >-
|
||||
Request timestamp. Unix milliseconds for most operations; Unix
|
||||
seconds for withdrawals (must match the on-chain EIP-712 struct
|
||||
verified against block.timestamp).
|
||||
example: 1767225600000
|
||||
x-parser-schema-id: <anonymous-schema-672>
|
||||
sq:
|
||||
type: integer
|
||||
description: Sequence number
|
||||
example: 1234567890
|
||||
x-parser-schema-id: <anonymous-schema-673>
|
||||
data:
|
||||
type: object
|
||||
description: Array of withdrawal objects
|
||||
properties:
|
||||
withdraw_id:
|
||||
type: integer
|
||||
description: Withdraw ID
|
||||
x-parser-schema-id: <anonymous-schema-675>
|
||||
asset:
|
||||
type: string
|
||||
description: Asset name
|
||||
example: USDC
|
||||
x-parser-schema-id: <anonymous-schema-676>
|
||||
amount:
|
||||
type: string
|
||||
description: >-
|
||||
Raw token amount including decimals. For withdrawals this
|
||||
matches the uint256 amount in the EIP-712 signature (e.g.
|
||||
"100000000" for 100 USDC with 6 decimals).
|
||||
example: '100000000'
|
||||
x-parser-schema-id: <anonymous-schema-677>
|
||||
fee:
|
||||
type: string
|
||||
description: Withdrawal transaction fee in decimalized asset units
|
||||
example: '5.00'
|
||||
x-parser-schema-id: <anonymous-schema-678>
|
||||
to:
|
||||
type: string
|
||||
description: Destination address in hex format
|
||||
example: '0x1234567890abcdef1234567890abcdef12345678'
|
||||
x-parser-schema-id: <anonymous-schema-679>
|
||||
status:
|
||||
type: string
|
||||
description: Withdrawal status
|
||||
enum:
|
||||
- pending
|
||||
- confirmed
|
||||
- removed
|
||||
- failed
|
||||
x-parser-schema-id: <anonymous-schema-680>
|
||||
hash:
|
||||
type: string
|
||||
description: On-chain transaction hash, "0x" if not yet mined
|
||||
default: 0x
|
||||
example: >-
|
||||
0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
|
||||
x-parser-schema-id: <anonymous-schema-681>
|
||||
required:
|
||||
- withdraw_id
|
||||
- asset
|
||||
- amount
|
||||
- fee
|
||||
- to
|
||||
- status
|
||||
- hash
|
||||
x-parser-schema-id: <anonymous-schema-674>
|
||||
required:
|
||||
- ch
|
||||
- ts
|
||||
- sq
|
||||
- data
|
||||
x-parser-schema-id: <anonymous-schema-670>
|
||||
title: Update
|
||||
description: Withdrawal status updates for authenticated users
|
||||
example: |-
|
||||
{
|
||||
"ch": "withdrawals",
|
||||
"ts": 1767225600000,
|
||||
"sq": 1234567890,
|
||||
"data": [
|
||||
{
|
||||
"asset": "USDC",
|
||||
"amount": "100000000",
|
||||
"fee": "5.00",
|
||||
"to": "0x1234567890abcdef1234567890abcdef12345678",
|
||||
"status": "pending",
|
||||
"hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
|
||||
}
|
||||
]
|
||||
}
|
||||
bindings: []
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: Update
|
||||
bindings: []
|
||||
extensions: *ref_0
|
||||
sendOperations:
|
||||
- *ref_1
|
||||
- *ref_2
|
||||
receiveOperations:
|
||||
- *ref_3
|
||||
- *ref_4
|
||||
- *ref_5
|
||||
sendMessages:
|
||||
- *ref_6
|
||||
- *ref_7
|
||||
receiveMessages:
|
||||
- *ref_8
|
||||
- *ref_9
|
||||
- *ref_10
|
||||
extensions:
|
||||
- id: x-parser-unique-object-id
|
||||
value: withdrawals
|
||||
securitySchemes: []
|
||||
|
||||
````
|
||||
Reference in New Issue
Block a user