跳转至

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)。大小写不敏感,建议大写。

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

{
    "code": -1010,
    "msg": "Missing required parameter 'symbol'"
}

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

{
    "code": -1003,
    "msg": "Too many requests; current request has 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)。大小写不敏感,建议大写。

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

{
    "code": -1010,
    "msg": "Missing required parameter 'symbol'"
}

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

{
    "code": -1003,
    "msg": "Too many requests; current request has 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)。大小写不敏感,建议大写。

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

{
    "code": -1010,
    "msg": "Missing required parameter 'symbol'"
}

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

{
    "code": -1003,
    "msg": "Too many requests; current request has 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)。大小写不敏感,建议大写。

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

{
    "code": -1003,
    "msg": "Too many requests; current request has 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)。大小写不敏感,建议大写。

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

{
    "code": -1003,
    "msg": "Too many requests; current request has 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)。大小写不敏感,建议大写。

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

{
    "code": -1003,
    "msg": "Too many requests; current request has 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)。大小写不敏感,建议大写。

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

{
    "code": -1010,
    "msg": "Missing required parameter 'symbol'"
}

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

{
    "code": -1003,
    "msg": "Too many requests; current request has 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:

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:

TickerPrice

Name Type Description
price string
symbol string

TickerPriceResponse

Single price object, or an array when listing.

One of:

Security schemes

Name Type Scheme Description
ApiKeyHmac apiKey 需要请求头 `x-ptrader-apikey`,以及 `timestamp` 与 `signature`。签名规则见「鉴权」文档。
ApiKeyOnly apiKey 仅需 API Key 请求头(无需 HMAC)。用于 listenKey 的创建、续期与关闭。

Tags

Name Description
Market Data