CancelPendingTrade¶
Info
DELETE https://{some_domain}/trade/cancel
Cancels a pending trade order by its order ID.
Authorization¶
All requests must include header a JWT token:
Authorization: <JWT_TOKEN>
The token is issued by the authentication method (/sign/in) and contains session info (login, type, expiration).
Request¶
Content-Type: application/json
Body Parameters¶
| Field | Type | Required | Description |
|---|---|---|---|
order |
int | Yes | Pending order ID |
Response¶
Success (200)¶
{
"data": "ok"
}
Error Responses¶
| Code | Error | Description |
|---|---|---|
| 400 | INVALID_DATA |
Validation failed, missing or incorrect request fields |
| 401 | CANCEL_PENDING_TRADE_ERROR |
Cancel operation failed (see message for detailed reason) |
Example¶
Request¶
DELETE https://{some_domain}/trade/cancel
Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json
{
"order": 123456
}
Examples¶
curl -X DELETE "https://{some_domain}/trade/cancel" -H "Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." -H "Content-Type: application/json" --data-raw '{
"order": 123456
}'
const url = "https://{some_domain}/trade/cancel";
const jwt = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...";
async function cancelPendingTrade() {
const resp = await fetch(url, {
method: "DELETE",
headers: {
"Authorization": jwt,
"Content-Type": "application/json"
},
body: JSON.stringify({ order: 123456 })
});
console.log("Status:", resp.status);
const data = await resp.json().catch(() => ({}));
console.log("Body:", data);
}
cancelPendingTrade().catch(console.error);
<?php
$url = "https://{some_domain}/trade/cancel";
$jwt = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...";
$payload = [ "order" => 123456 ];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: " . $jwt,
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($response === false) {
$error = curl_error($ch);
curl_close($ch);
throw new RuntimeException("cURL error: " . $error);
}
curl_close($ch);
header("Content-Type: application/json");
echo json_encode([
"status" => $httpCode,
"body" => json_decode($response, true)
], JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);