Market Data¶
行情 REST 仅使用 /openapi/quote/v1。旧版 /openapi/v1 行情别名已移除,请求会返回 404。
这些接口用于快照(深度、成交、K 线、ticker)。持续深度更新请将 REST 快照与 WebSocket 本地订单簿同步 流程配合使用。
Pepperstone Crypto Public OpenAPI — Market Data 1.0.0¶
Pepperstone Crypto 公开 REST API。
需鉴权的接口使用 HMAC。签名规则见开发者文档「鉴权」章节。WebSocket 行情与私有流另见 WebSocket 文档。除另行说明外,时间均为 UTC 毫秒。
Servers¶
| Description | URL |
|---|---|
| Production | https://api.pcrypto.com |
Market Data¶
GET /openapi/quote/v1/avgPrice¶
获取均价
Description
所需类型:—(无需 API Key)
输入参数
| 参数 | 位置 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|---|
symbol |
query | string | 是 | 交易对(如 BTCUSDT)。大小写不敏感,建议大写。 |
GET /openapi/quote/v1/avgPricecurl -sS -X GET 'https://api.pcrypto.com/openapi/quote/v1/avgPrice?symbol=BTCUSDT'{
"mins": 5,
"price": "9.09671867"
}Responses
Success
Response fields
Average price. mins is always 5; price is a decimal string.
| Name | Type | Description |
|---|---|---|
mins |
integer | |
price |
number | Decimal amount as a JSON number (BigDecimal on the wire). |
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 |
GET /openapi/quote/v1/depth¶
获取深度
Description
所需类型:—(无需 API Key)
输入参数
| 参数 | 位置 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|---|
limit |
query | integer | 否 | 100 |
|
symbol |
query | string | 是 | 交易对(如 BTCUSDT)。大小写不敏感,建议大写。 |
GET /openapi/quote/v1/depthcurl -sS -X GET 'https://api.pcrypto.com/openapi/quote/v1/depth?limit=20&symbol=BTCUSDT'{
"lastUpdateId": 1027024,
"bids": [
[
"4.00000000",
"431.00000000"
]
],
"asks": [
[
"4.00000200",
"12.00000000"
]
]
}Responses
Success
Response fields
Order book depth snapshot. bids / asks are [price, qty] string pairs.
| Name | Type | Description |
|---|---|---|
asks |
Array<Array<string>> | [[price, qty], …] |
bids |
Array<Array<string>> | [[price, qty], …] |
lastUpdateId |
integer(int64) |
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 |
GET /openapi/quote/v1/klines¶
获取 K 线
Description
所需类型:—(无需 API Key)
K 线历史。响应为对象数组,字段:time、open、high、low、close、volume(价格/数量为小数字符串;time 为开盘时间毫秒)。可选 startTime / endTime(Unix 毫秒)限定区间;仅传 startTime 时 endTime 默认为当前时间。
输入参数
| 参数 | 位置 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|---|
endTime |
query | integer | 否 | 可选区间终点(Unix 毫秒)。 | |
interval |
query | string | 是 | ||
limit |
query | integer | 否 | 500 |
|
startTime |
query | integer | 否 | 可选区间起点(Unix 毫秒)。仅传此项时,endTime 默认为当前时间。 |
|
symbol |
query | string | 是 | 交易对(如 BTCUSDT)。大小写不敏感,建议大写。 |
GET /openapi/quote/v1/klinescurl -sS -X GET 'https://api.pcrypto.com/openapi/quote/v1/klines?interval=1m&limit=10&symbol=BTCUSDT'[
{
"time": "1713100000000",
"open": "0.01634790",
"high": "0.80000000",
"low": "0.01575800",
"close": "0.01577100",
"volume": "148976.11427815"
}
]Responses
Success
Response fields
Array of Kline:
One candlestick. Fields: time (open time, ms, string), open / high / low / close / volume (decimal strings; volume may be null).
| Name | Type | Description |
|---|---|---|
close |
string | Close price as a decimal string. |
high |
string | High price as a decimal string. |
low |
string | Low price as a decimal string. |
open |
string | Open price as a decimal string. |
time |
string | Kline open time in Unix milliseconds (serialized as a string). |
volume |
string | null | Base-asset volume as a decimal string; may be null. |
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 |
GET /openapi/quote/v1/ticker/24hr¶
获取 24 小时行情
Description
所需类型:—(无需 API Key)
输入参数
| 参数 | 位置 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|---|
symbol |
query | string | 否 | 交易对(如 BTCUSDT)。大小写不敏感,建议大写。 |
GET /openapi/quote/v1/ticker/24hrcurl -sS -X GET 'https://api.pcrypto.com/openapi/quote/v1/ticker/24hr'{
"symbol": "BTCUSDT",
"priceChange": "-94.99999800",
"priceChangePercent": "-95.960",
"weightedAvgPrice": "0.29628482",
"prevClosePrice": "0.10002000",
"lastPrice": "4.00000200",
"lastQty": "200.00000000",
"bidPrice": "4.00000000",
"bidQty": "100.00000000",
"askPrice": "4.00000200",
"askQty": "100.00000000",
"openPrice": "99.00000000",
"highPrice": "100.00000000",
"lowPrice": "0.10000000",
"volume": "8913.30000000",
"quoteVolume": "15.30000000",
"openTime": 1713100000000,
"closeTime": 1713186400000,
"firstId": 0,
"lastId": 100,
"count": 101
}Responses
Success
Response fields
Single 24hr ticker object, or an array when listing all symbols.
Variant 1 — Ticker24hr
24hr ticker for one symbol.
| Name | Type | Description |
|---|---|---|
askPrice |
string | |
askQty |
string | |
bidPrice |
string | |
bidQty |
string | |
closeTime |
integer(int64) | |
count |
integer(int64) | |
firstId |
integer(int64) | |
highPrice |
string | |
lastId |
integer(int64) | |
lastPrice |
string | |
lastQty |
string | |
lowPrice |
string | |
openPrice |
string | |
openTime |
integer(int64) | |
prevClosePrice |
string | |
priceChange |
string | |
priceChangePercent |
string | |
quoteVolume |
string | |
symbol |
string | |
volume |
string | |
weightedAvgPrice |
string |
Variant 2
Array of Ticker24hr:
24hr ticker for one symbol.
| Name | Type | Description |
|---|---|---|
askPrice |
string | |
askQty |
string | |
bidPrice |
string | |
bidQty |
string | |
closeTime |
integer(int64) | |
count |
integer(int64) | |
firstId |
integer(int64) | |
highPrice |
string | |
lastId |
integer(int64) | |
lastPrice |
string | |
lastQty |
string | |
lowPrice |
string | |
openPrice |
string | |
openTime |
integer(int64) | |
prevClosePrice |
string | |
priceChange |
string | |
priceChangePercent |
string | |
quoteVolume |
string | |
symbol |
string | |
volume |
string | |
weightedAvgPrice |
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 |
GET /openapi/quote/v1/ticker/bookTicker¶
获取最优挂单
Description
所需类型:—(无需 API Key)
输入参数
| 参数 | 位置 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|---|
symbol |
query | string | 否 | 交易对(如 BTCUSDT)。大小写不敏感,建议大写。 |
GET /openapi/quote/v1/ticker/bookTickercurl -sS -X GET 'https://api.pcrypto.com/openapi/quote/v1/ticker/bookTicker'{
"symbol": "BTCUSDT",
"bidPrice": "4",
"bidQty": "100",
"askPrice": "4.000002",
"askQty": "100"
}Responses
Success
Response fields
Single book ticker object, or an array when listing all symbols.
Variant 1 — BookTicker
Best bid/ask for one symbol.
| Name | Type | Description |
|---|---|---|
askPrice |
number | Decimal amount as a JSON number (BigDecimal on the wire). |
askQty |
number | Decimal amount as a JSON number (BigDecimal on the wire). |
bidPrice |
number | Decimal amount as a JSON number (BigDecimal on the wire). |
bidQty |
number | Decimal amount as a JSON number (BigDecimal on the wire). |
symbol |
string |
Variant 2
Array of BookTicker:
Best bid/ask for one symbol.
| Name | Type | Description |
|---|---|---|
askPrice |
number | Decimal amount as a JSON number (BigDecimal on the wire). |
askQty |
number | Decimal amount as a JSON number (BigDecimal on the wire). |
bidPrice |
number | Decimal amount as a JSON number (BigDecimal on the wire). |
bidQty |
number | Decimal amount as a JSON number (BigDecimal on the wire). |
symbol |
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 |
GET /openapi/quote/v1/ticker/price¶
获取最新成交价
Description
所需类型:—(无需 API Key)
输入参数
| 参数 | 位置 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|---|
symbol |
query | string | 否 | 交易对(如 BTCUSDT)。大小写不敏感,建议大写。 |
GET /openapi/quote/v1/ticker/pricecurl -sS -X GET 'https://api.pcrypto.com/openapi/quote/v1/ticker/price'{
"symbol": "BTCUSDT",
"price": "4.00000200"
}Responses
Success
Response fields
Single price object, or an array when listing.
Variant 1 — TickerPrice
Latest price. price is a decimal string.
| Name | Type | Description |
|---|---|---|
price |
string | |
symbol |
string |
Variant 2
Array of TickerPrice:
Latest price. price is a decimal string.
| Name | Type | Description |
|---|---|---|
price |
string | |
symbol |
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 |
GET /openapi/quote/v1/trades¶
获取最近成交
Description
所需类型:—(无需 API Key)
输入参数
| 参数 | 位置 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|---|
limit |
query | integer | 否 | 500 |
|
symbol |
query | string | 是 | 交易对(如 BTCUSDT)。大小写不敏感,建议大写。 |
GET /openapi/quote/v1/tradescurl -sS -X GET 'https://api.pcrypto.com/openapi/quote/v1/trades?limit=20&symbol=BTCUSDT'[
{
"id": 28457,
"price": "4.00000100",
"qty": "12.00000000",
"quoteQty": "48.000012",
"time": 1713100000000,
"isBuyerMaker": true
}
]Responses
Success
Response fields
Array of MarketTrade:
Recent public trade. Prices and quantities are decimal strings; id / time are numbers.
| Name | Type | Description |
|---|---|---|
id |
integer(int64) | |
isBuyerMaker |
boolean | |
price |
string | |
qty |
string | |
quoteQty |
string | |
time |
integer(int64) |
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¶
AvgPrice¶
| Name | Type | Description |
|---|---|---|
mins |
integer | |
price |
number | Decimal amount as a JSON number (`BigDecimal` on the wire). |
BookTicker¶
| Name | Type | Description |
|---|---|---|
askPrice |
number | Decimal amount as a JSON number (`BigDecimal` on the wire). |
askQty |
number | Decimal amount as a JSON number (`BigDecimal` on the wire). |
bidPrice |
number | Decimal amount as a JSON number (`BigDecimal` on the wire). |
bidQty |
number | Decimal amount as a JSON number (`BigDecimal` on the wire). |
symbol |
string |
BookTickerResponse¶
Single book ticker object, or an array when listing all symbols.
One of:
- BookTicker
- Array<BookTicker>
ErrorBody¶
| Name | Type | Description |
|---|---|---|
code |
integer | |
msg |
string |
Kline¶
| Name | Type | Description |
|---|---|---|
close |
string | Close price as a decimal string. |
high |
string | High price as a decimal string. |
low |
string | Low price as a decimal string. |
open |
string | Open price as a decimal string. |
time |
string | Kline open time in Unix milliseconds (serialized as a string). |
volume |
string | null | Base-asset volume as a decimal string; may be null. |
KlineArray¶
Type: Array<Kline>
MarketTrade¶
| Name | Type | Description |
|---|---|---|
id |
integer(int64) | |
isBuyerMaker |
boolean | |
price |
string | |
qty |
string | |
quoteQty |
string | |
time |
integer(int64) |
PartialDepth¶
| Name | Type | Description |
|---|---|---|
asks |
Array<Array<string>> | [[price, qty], …] |
bids |
Array<Array<string>> | [[price, qty], …] |
lastUpdateId |
integer(int64) |
Ticker24hr¶
| Name | Type | Description |
|---|---|---|
askPrice |
string | |
askQty |
string | |
bidPrice |
string | |
bidQty |
string | |
closeTime |
integer(int64) | |
count |
integer(int64) | |
firstId |
integer(int64) | |
highPrice |
string | |
lastId |
integer(int64) | |
lastPrice |
string | |
lastQty |
string | |
lowPrice |
string | |
openPrice |
string | |
openTime |
integer(int64) | |
prevClosePrice |
string | |
priceChange |
string | |
priceChangePercent |
string | |
quoteVolume |
string | |
symbol |
string | |
volume |
string | |
weightedAvgPrice |
string |
Ticker24hrResponse¶
Single 24hr ticker object, or an array when listing all symbols.
One of:
- Ticker24hr
- Array<Ticker24hr>
TickerPrice¶
| Name | Type | Description |
|---|---|---|
price |
string | |
symbol |
string |
TickerPriceResponse¶
Single price object, or an array when listing.
One of:
- TickerPrice
- Array<TickerPrice>
Security schemes¶
| Name | Type | Scheme | Description |
|---|---|---|---|
| ApiKeyHmac | apiKey | 需要请求头 `x-ptrader-apikey`,以及 `timestamp` 与 `signature`。签名规则见「鉴权」文档。 | |
| ApiKeyOnly | apiKey | 仅需 API Key 请求头(无需 HMAC)。用于 listenKey 的创建、续期与关闭。 |
Tags¶
| Name | Description |
|---|---|
| Market Data |