User Data Stream¶
listenKey 创建、续期(update)与关闭 — 仅 API Key(无需 HMAC)。
生命周期:创建 → 至少每 30 分钟调用 update → 结束后 close。随后在 私有 WebSocket 上鉴权。
Pepperstone Crypto Public OpenAPI — User Data Stream 1.0.0¶
Pepperstone Crypto 公开 REST API。
需鉴权的接口使用 HMAC。签名规则见开发者文档「鉴权」章节。WebSocket 行情与私有流另见 WebSocket 文档。除另行说明外,时间均为 UTC 毫秒。
Servers¶
| Description | URL |
|---|---|
| Production | https://api.pcrypto.com |
User Data Stream¶
POST /openapi/v1/userDataStream¶
创建 listenKey
Description
所需类型:现货交易(亦接受 Read only)
创建 64 字符的 listenKey,用于私有 WebSocket 流。请用 update 续期;结束后调用 close。仅需 API Key,无需 HMAC。
输入参数
| 参数 | 位置 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|---|
x-ptrader-apikey |
header | string | 是 | API Key。 |
POST /openapi/v1/userDataStreamcurl -sS -X POST 'https://api.pcrypto.com/openapi/v1/userDataStream' \
-H 'x-ptrader-apikey: {apiKey}'{
"listenKey": "AbCdEfGhIjKlMnOpQrStUvWxYzabcdefghijklmnopqrstuvwxyz0123456789ab"
}Responses
Success
Response fields
| Name | Type | Description |
|---|---|---|
listenKey |
string |
rate_limited
Response fields
Error payload. Most API errors (including auth failures such as -1002) return HTTP 200 — see Error codes → HTTP status mapping. HTTP 400 for missing or invalid request parameters. HTTP 429 when rate limited.
| Name | Type | Description |
|---|---|---|
code |
integer | |
msg |
string |
POST /openapi/v1/userDataStream/update¶
续期 listenKey
Description
所需类型:现货交易(亦接受 Read only)
续期 listenKey(至少每 30 分钟调用一次)。仅需 API Key,无需 HMAC。
输入参数
| 参数 | 位置 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|---|
x-ptrader-apikey |
header | string | 是 | API Key。 | |
listenKey |
query | string | 是 |
POST /openapi/v1/userDataStream/updatecurl -sS -X POST 'https://api.pcrypto.com/openapi/v1/userDataStream/update?listenKey={listenKey}' \
-H 'x-ptrader-apikey: {apiKey}'Responses
Success
Response fields
Empty JSON object {}.
Empty object {}
missing_parameter
Response fields
Error payload. Most API errors (including auth failures such as -1002) return HTTP 200 — see Error codes → HTTP status mapping. HTTP 400 for missing or invalid request parameters. HTTP 429 when rate limited.
| Name | Type | Description |
|---|---|---|
code |
integer | |
msg |
string |
rate_limited
Response fields
Error payload. Most API errors (including auth failures such as -1002) return HTTP 200 — see Error codes → HTTP status mapping. HTTP 400 for missing or invalid request parameters. HTTP 429 when rate limited.
| Name | Type | Description |
|---|---|---|
code |
integer | |
msg |
string |
POST /openapi/v1/userDataStream/close¶
关闭 listenKey
Description
所需类型:现货交易(亦接受 Read only)
关闭 listenKey。仅需 API Key,无需 HMAC。
输入参数
| 参数 | 位置 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|---|
x-ptrader-apikey |
header | string | 是 | API Key。 | |
listenKey |
query | string | 是 |
POST /openapi/v1/userDataStream/closecurl -sS -X POST 'https://api.pcrypto.com/openapi/v1/userDataStream/close?listenKey={listenKey}' \
-H 'x-ptrader-apikey: {apiKey}'Responses
Success
Response fields
Empty JSON object {}.
Empty object {}
missing_parameter
Response fields
Error payload. Most API errors (including auth failures such as -1002) return HTTP 200 — see Error codes → HTTP status mapping. HTTP 400 for missing or invalid request parameters. HTTP 429 when rate limited.
| Name | Type | Description |
|---|---|---|
code |
integer | |
msg |
string |
rate_limited
Response fields
Error payload. Most API errors (including auth failures such as -1002) return HTTP 200 — see Error codes → HTTP status mapping. HTTP 400 for missing or invalid request parameters. HTTP 429 when rate limited.
| Name | Type | Description |
|---|---|---|
code |
integer | |
msg |
string |
Schemas¶
EmptyObject¶
ErrorBody¶
| Name | Type | Description |
|---|---|---|
code |
integer | |
msg |
string |
ListenKey¶
| Name | Type | Description |
|---|---|---|
listenKey |
string |
Security schemes¶
| Name | Type | Scheme | Description |
|---|---|---|---|
| ApiKeyHmac | apiKey | 需要请求头 `x-ptrader-apikey`,以及 `timestamp` 与 `signature`。签名规则见「鉴权」文档。 | |
| ApiKeyOnly | apiKey | 仅需 API Key 请求头(无需 HMAC)。用于 listenKey 的创建、续期与关闭。 |
Tags¶
| Name | Description |
|---|---|
| User Data Stream |