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 onlyquoteOrderQty(spend this much quote)SELL+STOP_LOSS/TAKE_PROFIT→ send onlyquantity(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×tamp={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"eOrderQty=100×tamp={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×tamp={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×tamp={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"eOrderQty=100&stopPrice=52000×tamp={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×tamp={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"eOrderQty=100&stopPrice=45000×tamp={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×tamp={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×tamp={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. |
GET /openapi/v1/historyOrderscurl -sS -X GET 'https://api.pcrypto.com/openapi/v1/historyOrders?limit=50&recvWindow=5000&signature={signature}×tamp={ts}' \
-H 'x-ptrader-apikey: {apiKey}'[
{
"symbol": "BTCUSDT",
"orderId": 28457,
"clientOrderId": "myOrder1",
"price": "10000",
"origQty": "1.5",
"executedQty": "0",
"cummulativeQuoteQty": "0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": null,
"time": 1713100000000,
"updateTime": 1713100000000,
"isWorking": true,
"origQuoteOrderQty": "0"
}
]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
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/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. |
GET /openapi/v1/myTradescurl -sS -X GET 'https://api.pcrypto.com/openapi/v1/myTrades?limit=50&recvWindow=5000&signature={signature}&symbol=BTCUSDT×tamp={ts}' \
-H 'x-ptrader-apikey: {apiKey}'[
{
"symbol": "BTCUSDT",
"id": 28457,
"orderId": 100234,
"price": "10000",
"qty": "1.5",
"quoteQty": "15000",
"commission": "0.0015",
"commissionAsset": "BTC",
"time": 1713100000000,
"isBuyer": true,
"isMaker": false,
"isBestMatch": true
}
]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
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/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
symbolto return open orders for all symbols.
GET /openapi/v1/openOrderscurl -sS -X GET 'https://api.pcrypto.com/openapi/v1/openOrders?recvWindow=5000&signature={signature}×tamp={ts}' \
-H 'x-ptrader-apikey: {apiKey}'[
{
"symbol": "BTCUSDT",
"orderId": 28457,
"clientOrderId": "myOrder1",
"price": "10000",
"origQty": "1.5",
"executedQty": "0",
"cummulativeQuoteQty": "0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": null,
"time": 1713100000000,
"updateTime": 1713100000000,
"isWorking": true,
"origQuoteOrderQty": "0"
}
]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
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 forLIMIT,STOP_LOSS_LIMIT,TAKE_PROFIT_LIMIT, and forSTOP_LOSS/TAKE_PROFITonSELL. ForMARKET, send eitherquantityorquoteOrderQty.quoteOrderQty: required forSTOP_LOSS/TAKE_PROFITonBUY. Not allowed onLIMIT,STOP_LOSS_LIMIT, orTAKE_PROFIT_LIMIT.price: required forLIMIT,STOP_LOSS_LIMIT, andTAKE_PROFIT_LIMIT. Do not send it forMARKET,STOP_LOSS, orTAKE_PROFIT.stopPrice: required forSTOP_LOSS,TAKE_PROFIT,STOP_LOSS_LIMIT, andTAKE_PROFIT_LIMIT. Not allowed onLIMITorMARKET.timeInForceapplies toLIMIT,STOP_LOSS_LIMIT, andTAKE_PROFIT_LIMITonly.newOrderRespTypedefaults toFULLforLIMITandMARKET, and toACKfor other types.
POST /openapi/v1/ordercurl -sS -X POST 'https://api.pcrypto.com/openapi/v1/order?newOrderRespType=RESULT&price=10000&quantity=0.001"eOrderQty=100&recvWindow=5000&side=BUY&signature={signature}&stopPrice=48000&stpFlag=CB&symbol=BTCUSDT&timeInForce=GTC×tamp={ts}&type=LIMIT' \
-H 'x-ptrader-apikey: {apiKey}'{
"symbol": "BTCUSDT",
"orderId": 28457,
"clientOrderId": "myOrder1",
"transactTime": 1713100000000,
"price": "10000",
"origQty": "1.5",
"executedQty": "1.5",
"cummulativeQuoteQty": "15000",
"status": "FILLED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": null,
"origQuoteOrderQty": "0",
"fills": [
{
"price": "10000",
"qty": "1.5",
"commission": "0.0015",
"commissionAsset": "BTC",
"tradeId": "56"
}
]
}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
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/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
orderIdororigClientOrderId; at least one is required. - If both are sent,
orderIdis used.
GET /openapi/v1/ordercurl -sS -X GET 'https://api.pcrypto.com/openapi/v1/order?recvWindow=5000&signature={signature}×tamp={ts}' \
-H 'x-ptrader-apikey: {apiKey}'{
"symbol": "BTCUSDT",
"orderId": 28457,
"clientOrderId": "myOrder1",
"price": "10000",
"origQty": "1.5",
"executedQty": "0",
"cummulativeQuoteQty": "0",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": null,
"time": 1713100000000,
"updateTime": 1713100000000,
"isWorking": true,
"origQuoteOrderQty": "0"
}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
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
cancelOrderIdorcancelOrigClientOrderIdto identify the order to cancel. - Required size and price fields depend on
type. See Place order by type. quantity: required forLIMIT,STOP_LOSS_LIMIT,TAKE_PROFIT_LIMIT, and forSTOP_LOSS/TAKE_PROFITonSELL. ForMARKET, send eitherquantityorquoteOrderQty.quoteOrderQty: required forSTOP_LOSS/TAKE_PROFITonBUY. Not allowed onLIMIT,STOP_LOSS_LIMIT, orTAKE_PROFIT_LIMIT.price: required forLIMIT,STOP_LOSS_LIMIT, andTAKE_PROFIT_LIMIT. Do not send it forMARKET,STOP_LOSS, orTAKE_PROFIT.stopPrice: required forSTOP_LOSS,TAKE_PROFIT,STOP_LOSS_LIMIT, andTAKE_PROFIT_LIMIT. Not allowed onLIMITorMARKET.timeInForceapplies toLIMIT,STOP_LOSS_LIMIT, andTAKE_PROFIT_LIMITonly.newOrderRespTypedefaults toFULLforLIMITandMARKET, and toACKfor other types.
POST /openapi/v1/order/cancelReplacecurl -sS -X POST 'https://api.pcrypto.com/openapi/v1/order/cancelReplace?cancelReplaceMode=STOP_ON_FAILURE&newOrderRespType=RESULT&price=10000&quantity=0.001"eOrderQty=100&recvWindow=5000&side=BUY&signature={signature}&stopPrice=48000&stpFlag=CB&symbol=BTCUSDT&timeInForce=GTC×tamp={ts}&type=LIMIT' \
-H 'x-ptrader-apikey: {apiKey}'{
"cancelResult": "SUCCESS",
"newOrderResult": "SUCCESS",
"cancelResponse": {
"symbol": "BTCUSDT",
"orderId": 28457,
"clientOrderId": "myOrder1",
"transactTime": 1713100000000,
"price": "10000",
"origQty": "1.5",
"executedQty": "0",
"origQuoteOrderQty": "0",
"cummulativeQuoteQty": "0",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stpFlag": "",
"stopPrice": null
},
"newOrderResponse": {
"symbol": "BTCUSDT",
"orderId": 28457,
"clientOrderId": "myOrder1",
"transactTime": 1713100000000
}
}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
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/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
orderIdororigClientOrderId; at least one is required.
POST /openapi/v1/order/cancelcurl -sS -X POST 'https://api.pcrypto.com/openapi/v1/order/cancel?recvWindow=5000&signature={signature}×tamp={ts}' \
-H 'x-ptrader-apikey: {apiKey}'{
"symbol": "BTCUSDT",
"orderId": 28457,
"clientOrderId": "myOrder1",
"price": "10000",
"origQty": "1.5",
"executedQty": "0",
"cummulativeQuoteQty": "0",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": null,
"origQuoteOrderQty": "0"
}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
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. |
POST /openapi/v1/order/cancelAllcurl -sS -X POST 'https://api.pcrypto.com/openapi/v1/order/cancelAll?confirmCancelAll=True&recvWindow=5000&signature={signature}&symbol=BTCUSDT×tamp={ts}' \
-H 'x-ptrader-apikey: {apiKey}'[
{
"symbol": "BTCUSDT",
"orderId": 28457,
"clientOrderId": "myOrder1",
"price": "10000",
"origQty": "1.5",
"executedQty": "0",
"cummulativeQuoteQty": "0",
"status": "CANCELED",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"stopPrice": null,
"origQuoteOrderQty": "0"
}
]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
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¶
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 |