Skip to content

Spot Trading

Spot order placement, cancel, cancel-all, cancel-replace, and query.

Typical flow: place (POST /openapi/v1/order) → query open/history → cancel, cancel-all (POST /openapi/v1/order/cancelAll), or cancel-replace.

Important: POST /openapi/v1/order takes fields as URL query parameters (same style as common exchange OpenAPIs). There is no JSON request body. HMAC signs the full query string excluding signature.

Before you size an order, read GET /openapi/v1/exchangeInfo for that symbol’s filters (PRICE_FILTER, LOT_SIZE, MIN_NOTIONAL / NOTIONAL, and any price-band filters). Quantity and price limits are not hard-coded on the place-order API.

Place order by type

POST /openapi/v1/order accepts six type values. Required size and price fields change with the type; sending a forbidden field returns a parameter error. The same rules apply to the new order half of POST /openapi/v1/order/cancelReplace.

Legend for the matrix: required · either/or · by side · forbidden · optional (validated if sent).

type Meaning quantity (base) quoteOrderQty (quote) price stopPrice timeInForce
LIMIT Resting limit required forbidden required forbidden Optional; default GTC
MARKET Immediate market either/or either/or (mutex) Do not send forbidden Unused
STOP_LOSS Stop-loss market SELL required BUY required Do not send required Unused
TAKE_PROFIT Take-profit market SELL required BUY required Do not send required Unused
STOP_LOSS_LIMIT Stop-loss limit required forbidden required required Optional; default GTC
TAKE_PROFIT_LIMIT Take-profit limit required forbidden required required Optional; default GTC

Always send symbol, side (BUY / SELL), and type, plus timestamp and signature (and the API key header). Optional on every type: newClientOrderId, newOrderRespType (ACK / RESULT / FULL), stpFlag (CB / CN / CO; default CB), recvWindow.

Conditional market orders size by side after the trigger:

  • BUY + STOP_LOSS / TAKE_PROFIT → send only quoteOrderQty (spend this much quote)
  • SELL + STOP_LOSS / TAKE_PROFIT → send only quantity (sell this much base)

Trigger direction vs last trade price (last):

type BUY triggers when SELL triggers when
STOP_LOSS / STOP_LOSS_LIMIT last ≥ stopPrice last ≤ stopPrice
TAKE_PROFIT / TAKE_PROFIT_LIMIT last ≤ stopPrice last ≥ stopPrice

If the symbol has allowPlan=false in exchange info, all four conditional types are rejected.

Examples below use curl. Replace {host}, {apiKey}, {ts}, and {signature}. Sign the query string without signature, in the same parameter order you send.

LIMIT — Places a resting limit at price for quantity base. Use timeInForce to control how long it stays: GTC until cancelled, IOC fill what you can then cancel the rest, FOK fill all or reject.

curl -X POST "https://{host}/openapi/v1/order?symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC&quantity=0.001&price=50000&timestamp={ts}&signature={signature}" \
  -H "x-ptrader-apikey: {apiKey}"

MARKET — Immediate execution. Send exactly one of quantity or quoteOrderQty — not both and not neither. With quantity, you buy or sell a fixed base size; with quoteOrderQty, you spend or receive a fixed quote notional. Leave price and stopPrice out.

Buy with quote notional:

curl -X POST "https://{host}/openapi/v1/order?symbol=BTCUSDT&side=BUY&type=MARKET&quoteOrderQty=100&timestamp={ts}&signature={signature}" \
  -H "x-ptrader-apikey: {apiKey}"

Sell fixed base size:

curl -X POST "https://{host}/openapi/v1/order?symbol=BTCUSDT&side=SELL&type=MARKET&quantity=0.001&timestamp={ts}&signature={signature}" \
  -H "x-ptrader-apikey: {apiKey}"

STOP_LOSS — A stop that becomes a market order when stopPrice is hit. Size follows the side rule above (quoteOrderQty on buy, quantity on sell). Requires stopPrice; do not send price.

Sell when price falls:

curl -X POST "https://{host}/openapi/v1/order?symbol=BTCUSDT&side=SELL&type=STOP_LOSS&quantity=0.001&stopPrice=48000&timestamp={ts}&signature={signature}" \
  -H "x-ptrader-apikey: {apiKey}"

Buy when price rises:

curl -X POST "https://{host}/openapi/v1/order?symbol=BTCUSDT&side=BUY&type=STOP_LOSS&quoteOrderQty=100&stopPrice=52000&timestamp={ts}&signature={signature}" \
  -H "x-ptrader-apikey: {apiKey}"

TAKE_PROFIT — Same field rules as STOP_LOSS, with the opposite trigger direction (see the trigger table).

Sell when price rises:

curl -X POST "https://{host}/openapi/v1/order?symbol=BTCUSDT&side=SELL&type=TAKE_PROFIT&quantity=0.001&stopPrice=55000&timestamp={ts}&signature={signature}" \
  -H "x-ptrader-apikey: {apiKey}"

Buy when price falls:

curl -X POST "https://{host}/openapi/v1/order?symbol=BTCUSDT&side=BUY&type=TAKE_PROFIT&quoteOrderQty=100&stopPrice=45000&timestamp={ts}&signature={signature}" \
  -H "x-ptrader-apikey: {apiKey}"

STOP_LOSS_LIMIT — After the trigger, the order rests as a limit at price. You must send quantity, price, and stopPrice; quoteOrderQty is forbidden. Align both price and stopPrice to tickSize from exchange info. timeInForce defaults to GTC.

curl -X POST "https://{host}/openapi/v1/order?symbol=BTCUSDT&side=SELL&type=STOP_LOSS_LIMIT&quantity=0.001&price=47900&stopPrice=48000&timeInForce=GTC&timestamp={ts}&signature={signature}" \
  -H "x-ptrader-apikey: {apiKey}"

TAKE_PROFIT_LIMIT — Same size/price fields as STOP_LOSS_LIMIT, with the take-profit trigger direction.

curl -X POST "https://{host}/openapi/v1/order?symbol=BTCUSDT&side=SELL&type=TAKE_PROFIT_LIMIT&quantity=0.001&price=55100&stopPrice=55000&timeInForce=GTC&timestamp={ts}&signature={signature}" \
  -H "x-ptrader-apikey: {apiKey}"

Pepperstone Crypto Public OpenAPI — Spot Trading 1.0.0

Pepperstone Crypto public REST API.

Authenticate with HMAC where required. See Authentication in the developer documentation for signing details. WebSocket market and private streams are documented separately. All times are UTC milliseconds unless noted.


Servers

Description URL
Production https://api.pcrypto.com

Spot Trading


GET /openapi/v1/historyOrders

Get order history

Description

Required Type: Spot trade (Read only OK for GET)

Historical orders.

Input parameters

Parameter In Type Required Default Description
x-ptrader-apikey header string Yes API key.
limit query integer No 500 Number of records to return. Range 1–1000.
recvWindow query integer No 5000 Request validity window in milliseconds. Range 1–60000.
signature query string Yes HMAC-SHA256 signature, hex-encoded. See Authentication → HMAC signing.
symbol query string No
timestamp query integer Yes Request timestamp in Unix milliseconds.

Responses

Success

Response fields

Array of QueryOrder:

Name Type Description
clientOrderId string
cummulativeQuoteQty number Decimal amount as a JSON number (BigDecimal on the wire).
executedQty number Decimal amount as a JSON number (BigDecimal on the wire).
isWorking boolean
orderId integer(int64) Order id. JSON numbers may exceed JavaScript Number.MAX_SAFE_INTEGER (9007199254740991); parse losslessly (JSON reviver, json-bigint, or BigInt) before cancel or query by id.
origQty number Decimal amount as a JSON number (BigDecimal on the wire).
origQuoteOrderQty number Decimal amount as a JSON number (BigDecimal on the wire).
price number Decimal amount as a JSON number (BigDecimal on the wire).
side string
status string
stopPrice number | null Stop/trigger price as a JSON number. null for LIMIT/MARKET (no trigger); a number for the four conditional types.
symbol string
time integer(int64)
timeInForce string
type string
updateTime integer(int64)

invalid_parameter

{
    "code": -1025,
    "msg": "Parameter 'limit' is not valid."
}

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/v1/myTrades

Get my trades

Description

Required Type: Spot trade (Read only OK for GET)

Historical trades. symbol required.

Input parameters

Parameter In Type Required Default Description
x-ptrader-apikey header string Yes API key.
limit query integer No 500 Number of records to return. Range 1–1000.
recvWindow query integer No 5000 Request validity window in milliseconds. Range 1–60000.
signature query string Yes HMAC-SHA256 signature, hex-encoded. See Authentication → HMAC signing.
symbol query string Yes
timestamp query integer Yes Request timestamp in Unix milliseconds.

Responses

Success

Response fields

Array of Trade:

Name Type Description
commission number Decimal amount as a JSON number (BigDecimal on the wire).
commissionAsset string
id integer(int64)
isBestMatch boolean
isBuyer boolean
isMaker boolean
orderId integer(int64) Order id. JSON numbers may exceed JavaScript Number.MAX_SAFE_INTEGER (9007199254740991); parse losslessly (JSON reviver, json-bigint, or BigInt) before cancel or query by id.
price number Decimal amount as a JSON number (BigDecimal on the wire).
qty number Decimal amount as a JSON number (BigDecimal on the wire).
quoteQty number Decimal amount as a JSON number (BigDecimal on the wire).
symbol 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


GET /openapi/v1/openOrders

Get open orders

Description

Required Type: Spot trade (Read only OK for GET)

List open orders. symbol optional.

Input parameters

Parameter In Type Required Default Description
x-ptrader-apikey header string Yes API key.
recvWindow query integer No 5000 Request validity window in milliseconds. Range 1–60000.
signature query string Yes HMAC-SHA256 signature, hex-encoded. See Authentication → HMAC signing.
symbol query string No
timestamp query integer Yes Request timestamp in Unix milliseconds.

Notes

  • Omit symbol to return open orders for all symbols.

Responses

Success

Response fields

Array of QueryOrder:

Name Type Description
clientOrderId string
cummulativeQuoteQty number Decimal amount as a JSON number (BigDecimal on the wire).
executedQty number Decimal amount as a JSON number (BigDecimal on the wire).
isWorking boolean
orderId integer(int64) Order id. JSON numbers may exceed JavaScript Number.MAX_SAFE_INTEGER (9007199254740991); parse losslessly (JSON reviver, json-bigint, or BigInt) before cancel or query by id.
origQty number Decimal amount as a JSON number (BigDecimal on the wire).
origQuoteOrderQty number Decimal amount as a JSON number (BigDecimal on the wire).
price number Decimal amount as a JSON number (BigDecimal on the wire).
side string
status string
stopPrice number | null Stop/trigger price as a JSON number. null for LIMIT/MARKET (no trigger); a number for the four conditional types.
symbol string
time integer(int64)
timeInForce string
type string
updateTime integer(int64)

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


POST /openapi/v1/order

Place order

Description

Required Type: Spot trade

Place a spot order. All fields are query parameters (no JSON body). Required size/price fields depend on type — see REST → Spot Trading (Place order by type). Always send symbol, side, and type. Read exchangeInfo.filters before sizing. Six types: LIMIT, MARKET, STOP_LOSS, TAKE_PROFIT, STOP_LOSS_LIMIT, TAKE_PROFIT_LIMIT.

Input parameters

Parameter In Type Required Default Description
x-ptrader-apikey header string Yes API key.
newClientOrderId query string No Client order id. The server generates a UUID when omitted.
newOrderRespType query string No ACK, RESULT, or FULL.
price query string No Limit price as a decimal string.
quantity query string No Base-asset size as a decimal string.
quoteOrderQty query string No Quote-asset notional as a decimal string.
recvWindow query integer No 5000 Request validity window in milliseconds. Range 1–60000.
side query string Yes BUY or SELL.
signature query string Yes HMAC-SHA256 signature, hex-encoded. See Authentication → HMAC signing.
stopPrice query string No Trigger price as a decimal string.
stpFlag query string No CB Self-trade prevention: CB (cancel both), CN (cancel new), or CO (cancel old).
symbol query string Yes Trading pair id (e.g. BTCUSDT). Case-insensitive; prefer uppercase.
timeInForce query string No GTC GTC, IOC, or FOK.
timestamp query integer Yes Request timestamp in Unix milliseconds.
type query string Yes One of LIMIT, MARKET, STOP_LOSS, TAKE_PROFIT, STOP_LOSS_LIMIT, TAKE_PROFIT_LIMIT.

Notes

  • Required size and price fields depend on type. See Place order by type.
  • quantity: required for LIMIT, STOP_LOSS_LIMIT, TAKE_PROFIT_LIMIT, and for STOP_LOSS / TAKE_PROFIT on SELL. For MARKET, send either quantity or quoteOrderQty.
  • quoteOrderQty: required for STOP_LOSS / TAKE_PROFIT on BUY. Not allowed on LIMIT, STOP_LOSS_LIMIT, or TAKE_PROFIT_LIMIT.
  • price: required for LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT. Do not send it for MARKET, STOP_LOSS, or TAKE_PROFIT.
  • stopPrice: required for STOP_LOSS, TAKE_PROFIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT. Not allowed on LIMIT or MARKET.
  • timeInForce applies to LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT only.
  • newOrderRespType defaults to FULL for LIMIT and MARKET, and to ACK for other types.

Responses

Success

Response fields

Place-order response. Shape depends on newOrderRespType: ACK → NewOrderAck, RESULT → NewOrderResult, FULL → NewOrderFull.

Variant 1 — NewOrderAck

Name Type Description
clientOrderId string
orderId integer(int64) Order id. JSON numbers may exceed JavaScript Number.MAX_SAFE_INTEGER (9007199254740991); parse losslessly (JSON reviver, json-bigint, or BigInt) before cancel or query by id.
symbol string
transactTime integer(int64)

Variant 2 — NewOrderResult

Name Type Description
clientOrderId string
cummulativeQuoteQty number Decimal amount as a JSON number (BigDecimal on the wire).
executedQty number Decimal amount as a JSON number (BigDecimal on the wire).
orderId integer(int64) Order id. JSON numbers may exceed JavaScript Number.MAX_SAFE_INTEGER (9007199254740991); parse losslessly (JSON reviver, json-bigint, or BigInt) before cancel or query by id.
origQty number Decimal amount as a JSON number (BigDecimal on the wire).
origQuoteOrderQty number Decimal amount as a JSON number (BigDecimal on the wire).
price number Decimal amount as a JSON number (BigDecimal on the wire).
side string
status string
stopPrice number | null Stop/trigger price as a JSON number. null for LIMIT/MARKET (no trigger); a number for the four conditional types.
symbol string
timeInForce string
transactTime integer(int64)
type string

Variant 3 — NewOrderFull

Name Type Description
clientOrderId string
cummulativeQuoteQty number Decimal amount as a JSON number (BigDecimal on the wire).
executedQty number Decimal amount as a JSON number (BigDecimal on the wire).
fills Array<FillTrade>
orderId integer(int64) Order id. JSON numbers may exceed JavaScript Number.MAX_SAFE_INTEGER (9007199254740991); parse losslessly (JSON reviver, json-bigint, or BigInt) before cancel or query by id.
origQty number Decimal amount as a JSON number (BigDecimal on the wire).
origQuoteOrderQty number Decimal amount as a JSON number (BigDecimal on the wire).
price number Decimal amount as a JSON number (BigDecimal on the wire).
side string
status string
stopPrice number | null Stop/trigger price as a JSON number. null for LIMIT/MARKET (no trigger); a number for the four conditional types.
symbol string
timeInForce string
transactTime integer(int64)
type string

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/v1/order

Get order

Description

Required Type: Spot trade (Read only OK for GET)

Query one order. Provide orderId or origClientOrderId (exactly one identifier).

Input parameters

Parameter In Type Required Default Description
x-ptrader-apikey header string Yes API key.
orderId query string No Exchange order id.
origClientOrderId query string No Client order id from place order (newClientOrderId).
recvWindow query integer No 5000 Request validity window in milliseconds. Range 1–60000.
signature query string Yes HMAC-SHA256 signature, hex-encoded. See Authentication → HMAC signing.
timestamp query integer Yes Request timestamp in Unix milliseconds.

Notes

  • Send orderId or origClientOrderId; at least one is required.
  • If both are sent, orderId is used.

Responses

Success

Response fields

Name Type Description
clientOrderId string
cummulativeQuoteQty number Decimal amount as a JSON number (BigDecimal on the wire).
executedQty number Decimal amount as a JSON number (BigDecimal on the wire).
isWorking boolean
orderId integer(int64) Order id. JSON numbers may exceed JavaScript Number.MAX_SAFE_INTEGER (9007199254740991); parse losslessly (JSON reviver, json-bigint, or BigInt) before cancel or query by id.
origQty number Decimal amount as a JSON number (BigDecimal on the wire).
origQuoteOrderQty number Decimal amount as a JSON number (BigDecimal on the wire).
price number Decimal amount as a JSON number (BigDecimal on the wire).
side string
status string
stopPrice number | null Stop/trigger price as a JSON number. null for LIMIT/MARKET (no trigger); a number for the four conditional types.
symbol string
time integer(int64)
timeInForce string
type string
updateTime integer(int64)

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


POST /openapi/v1/order/cancelReplace

Cancel and replace order

Description

Required Type: Spot trade

Cancel an existing order then place a new one. New-order size/price fields follow the same type rules as POST /openapi/v1/order (see REST → Spot Trading). Also requires cancelReplaceMode and cancelOrderId or cancelOrigClientOrderId.

Input parameters

Parameter In Type Required Default Description
x-ptrader-apikey header string Yes API key.
cancelOrderId query string No Exchange order id of the order to cancel.
cancelOrigClientOrderId query string No Client order id of the order to cancel.
cancelReplaceMode query string Yes STOP_ON_FAILURE or ALLOW_FAILURE.
newClientOrderId query string No Client order id. The server generates a UUID when omitted.
newOrderRespType query string No ACK, RESULT, or FULL.
price query string No Limit price as a decimal string.
quantity query string No Base-asset size as a decimal string.
quoteOrderQty query string No Quote-asset notional as a decimal string.
recvWindow query integer No 5000 Request validity window in milliseconds. Range 1–60000.
side query string Yes BUY or SELL.
signature query string Yes HMAC-SHA256 signature, hex-encoded. See Authentication → HMAC signing.
stopPrice query string No Trigger price as a decimal string.
stpFlag query string No CB Self-trade prevention: CB (cancel both), CN (cancel new), or CO (cancel old).
symbol query string Yes Trading pair id (e.g. BTCUSDT). Case-insensitive; prefer uppercase.
timeInForce query string No GTC GTC, IOC, or FOK.
timestamp query integer Yes Request timestamp in Unix milliseconds.
type query string Yes One of LIMIT, MARKET, STOP_LOSS, TAKE_PROFIT, STOP_LOSS_LIMIT, TAKE_PROFIT_LIMIT.

Notes

  • Send cancelOrderId or cancelOrigClientOrderId to identify the order to cancel.
  • Required size and price fields depend on type. See Place order by type.
  • quantity: required for LIMIT, STOP_LOSS_LIMIT, TAKE_PROFIT_LIMIT, and for STOP_LOSS / TAKE_PROFIT on SELL. For MARKET, send either quantity or quoteOrderQty.
  • quoteOrderQty: required for STOP_LOSS / TAKE_PROFIT on BUY. Not allowed on LIMIT, STOP_LOSS_LIMIT, or TAKE_PROFIT_LIMIT.
  • price: required for LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT. Do not send it for MARKET, STOP_LOSS, or TAKE_PROFIT.
  • stopPrice: required for STOP_LOSS, TAKE_PROFIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT. Not allowed on LIMIT or MARKET.
  • timeInForce applies to LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT only.
  • newOrderRespType defaults to FULL for LIMIT and MARKET, and to ACK for other types.

Responses

Success

Response fields

Cancel-replace result: CancelReplaceBothSuccess when both sides succeed, or CancelReplaceWithError (code / msg / data) when cancel and/or the new order fails.

Variant 1 — CancelReplaceBothSuccess

Cancel-replace success: cancelResult and newOrderResult are both SUCCESS.

Name Type Description
cancelResponse CancelReplaceCancelResponse
cancelResult string
newOrderResponse NewOrderResponse
newOrderResult string

Variant 2 — CancelReplaceWithError

code / msg plus data when cancel-replace partially or fully fails.

Name Type Description
code integer
data CancelReplaceFailedData
msg string

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


POST /openapi/v1/order/cancel

Cancel order

Description

Required Type: Spot trade

Cancel a single order by orderId or origClientOrderId.

Input parameters

Parameter In Type Required Default Description
x-ptrader-apikey header string Yes API key.
orderId query string No Exchange order id.
origClientOrderId query string No Client order id from place order (newClientOrderId).
recvWindow query integer No 5000 Request validity window in milliseconds. Range 1–60000.
signature query string Yes HMAC-SHA256 signature, hex-encoded. See Authentication → HMAC signing.
timestamp query integer Yes Request timestamp in Unix milliseconds.

Notes

  • Send orderId or origClientOrderId; at least one is required.

Responses

Success

Response fields

Name Type Description
clientOrderId string
cummulativeQuoteQty number Decimal amount as a JSON number (BigDecimal on the wire).
executedQty number Decimal amount as a JSON number (BigDecimal on the wire).
orderId integer(int64) Order id. JSON numbers may exceed JavaScript Number.MAX_SAFE_INTEGER (9007199254740991); parse losslessly (JSON reviver, json-bigint, or BigInt) before cancel or query by id.
origQty number Decimal amount as a JSON number (BigDecimal on the wire).
origQuoteOrderQty number Decimal amount as a JSON number (BigDecimal on the wire).
price number Decimal amount as a JSON number (BigDecimal on the wire).
side string
status string
stopPrice number | null Stop/trigger price as a JSON number. null for LIMIT/MARKET (no trigger); a number for the four conditional types.
symbol string
timeInForce string
type 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


POST /openapi/v1/order/cancelAll

Cancel all open orders

Description

Required Type: Spot trade

Cancel all open orders for a symbol. Requires confirmCancelAll=true.

Input parameters

Parameter In Type Required Default Description
x-ptrader-apikey header string Yes API key.
confirmCancelAll query boolean Yes Must be true to confirm cancelling all open orders for the symbol.
recvWindow query integer No 5000 Request validity window in milliseconds. Range 1–60000.
signature query string Yes HMAC-SHA256 signature, hex-encoded. See Authentication → HMAC signing.
symbol query string Yes Trading pair, e.g. BTCUSDT.
timestamp query integer Yes Request timestamp in Unix milliseconds.

Responses

Success

Response fields

Array of CancelOrder:

Name Type Description
clientOrderId string
cummulativeQuoteQty number Decimal amount as a JSON number (BigDecimal on the wire).
executedQty number Decimal amount as a JSON number (BigDecimal on the wire).
orderId integer(int64) Order id. JSON numbers may exceed JavaScript Number.MAX_SAFE_INTEGER (9007199254740991); parse losslessly (JSON reviver, json-bigint, or BigInt) before cancel or query by id.
origQty number Decimal amount as a JSON number (BigDecimal on the wire).
origQuoteOrderQty number Decimal amount as a JSON number (BigDecimal on the wire).
price number Decimal amount as a JSON number (BigDecimal on the wire).
side string
status string
stopPrice number | null Stop/trigger price as a JSON number. null for LIMIT/MARKET (no trigger); a number for the four conditional types.
symbol string
timeInForce string
type string

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

CancelOrder

Name Type Description
clientOrderId string
cummulativeQuoteQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
executedQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
orderId integer(int64) Order id. JSON numbers may exceed JavaScript `Number.MAX_SAFE_INTEGER` (9007199254740991); parse losslessly (JSON reviver, json-bigint, or `BigInt`) before cancel or query by id.
origQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
origQuoteOrderQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
price number Decimal amount as a JSON number (`BigDecimal` on the wire).
side string
status string
stopPrice number | null Stop/trigger price as a JSON number. `null` for `LIMIT`/`MARKET` (no trigger); a number for the four conditional types.
symbol string
timeInForce string
type string

CancelReplaceBothSuccess

Name Type Description
cancelResponse CancelReplaceCancelResponse
cancelResult string
newOrderResponse NewOrderResponse
newOrderResult string

CancelReplaceCancelResponse

Name Type Description
clientOrderId string
cummulativeQuoteQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
executedQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
orderId integer(int64) Order id. JSON numbers may exceed JavaScript `Number.MAX_SAFE_INTEGER` (9007199254740991); parse losslessly (JSON reviver, json-bigint, or `BigInt`) before cancel or query by id.
origQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
origQuoteOrderQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
price number Decimal amount as a JSON number (`BigDecimal` on the wire).
side string
status string
stopPrice number | null Stop/trigger price as a JSON number. `null` for `LIMIT`/`MARKET` (no trigger); a number for the four conditional types.
stpFlag string
symbol string
timeInForce string
transactTime integer(int64)
type string

CancelReplaceFailedData

Name Type Description
cancelResponse
cancelResult string
newOrderResponse `NewOrder*` on success, `ErrorRet` on failure, or null if not attempted.
newOrderResult string

CancelReplaceResponse

Cancel-replace result: `CancelReplaceBothSuccess` when both sides succeed, or `CancelReplaceWithError` (`code` / `msg` / `data`) when cancel and/or the new order fails.

One of:

CancelReplaceWithError

Name Type Description
code integer
data CancelReplaceFailedData
msg string

ErrorBody

Name Type Description
code integer
msg string

ErrorRet

Name Type Description
code integer
msg string

FillTrade

Name Type Description
commission number Decimal amount as a JSON number (`BigDecimal` on the wire).
commissionAsset string
price number Decimal amount as a JSON number (`BigDecimal` on the wire).
qty number Decimal amount as a JSON number (`BigDecimal` on the wire).
tradeId integer(int64) Trade id (`Long`). May exceed JavaScript `Number.MAX_SAFE_INTEGER`; parse losslessly when correlating fills.

NewOrderAck

Name Type Description
clientOrderId string
orderId integer(int64) Order id. JSON numbers may exceed JavaScript `Number.MAX_SAFE_INTEGER` (9007199254740991); parse losslessly (JSON reviver, json-bigint, or `BigInt`) before cancel or query by id.
symbol string
transactTime integer(int64)

NewOrderFull

Name Type Description
clientOrderId string
cummulativeQuoteQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
executedQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
fills Array<FillTrade>
orderId integer(int64) Order id. JSON numbers may exceed JavaScript `Number.MAX_SAFE_INTEGER` (9007199254740991); parse losslessly (JSON reviver, json-bigint, or `BigInt`) before cancel or query by id.
origQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
origQuoteOrderQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
price number Decimal amount as a JSON number (`BigDecimal` on the wire).
side string
status string
stopPrice number | null Stop/trigger price as a JSON number. `null` for `LIMIT`/`MARKET` (no trigger); a number for the four conditional types.
symbol string
timeInForce string
transactTime integer(int64)
type string

NewOrderResponse

Place-order response. Shape depends on `newOrderRespType`: `ACK` → `NewOrderAck`, `RESULT` → `NewOrderResult`, `FULL` → `NewOrderFull`.

One of:

NewOrderResult

Name Type Description
clientOrderId string
cummulativeQuoteQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
executedQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
orderId integer(int64) Order id. JSON numbers may exceed JavaScript `Number.MAX_SAFE_INTEGER` (9007199254740991); parse losslessly (JSON reviver, json-bigint, or `BigInt`) before cancel or query by id.
origQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
origQuoteOrderQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
price number Decimal amount as a JSON number (`BigDecimal` on the wire).
side string
status string
stopPrice number | null Stop/trigger price as a JSON number. `null` for `LIMIT`/`MARKET` (no trigger); a number for the four conditional types.
symbol string
timeInForce string
transactTime integer(int64)
type string

QueryOrder

Name Type Description
clientOrderId string
cummulativeQuoteQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
executedQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
isWorking boolean
orderId integer(int64) Order id. JSON numbers may exceed JavaScript `Number.MAX_SAFE_INTEGER` (9007199254740991); parse losslessly (JSON reviver, json-bigint, or `BigInt`) before cancel or query by id.
origQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
origQuoteOrderQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
price number Decimal amount as a JSON number (`BigDecimal` on the wire).
side string
status string
stopPrice number | null Stop/trigger price as a JSON number. `null` for `LIMIT`/`MARKET` (no trigger); a number for the four conditional types.
symbol string
time integer(int64)
timeInForce string
type string
updateTime integer(int64)

Trade

Name Type Description
commission number Decimal amount as a JSON number (`BigDecimal` on the wire).
commissionAsset string
id integer(int64)
isBestMatch boolean
isBuyer boolean
isMaker boolean
orderId integer(int64) Order id. JSON numbers may exceed JavaScript `Number.MAX_SAFE_INTEGER` (9007199254740991); parse losslessly (JSON reviver, json-bigint, or `BigInt`) before cancel or query by id.
price number Decimal amount as a JSON number (`BigDecimal` on the wire).
qty number Decimal amount as a JSON number (`BigDecimal` on the wire).
quoteQty number Decimal amount as a JSON number (`BigDecimal` on the wire).
symbol string
time integer(int64)

Security schemes

Name Type Scheme Description
ApiKeyHmac apiKey
ApiKeyOnly apiKey API key header only (no HMAC). Used for listenKey create, keepalive, and close.

Tags

Name Description
Spot Trading