Cancel an Order

Cancel a single open order by {id}.

For all transactions related to the private endpoint, you must authorize before sending your request.

For more information you can check our Authentication V1 article.

You need to send request with [DELETE] method.

  • id parameter must be used for order cancellation.

  • Open orders can be canceled with https://api.btcturk.com/api/v1/order endpoint.

  • Upon submitting a cancellation request, ongoing validation checks and error messages will continue as defined.

  • If no validation errors occur, a status code of 200 (OK) is immediately returned to indicate receipt of the cancellation request.

  • Finalization of the cancellation request is sent through WebSocket channel 452. Clients should listen this channel for a final response to cancelation request.

Request example:

  • https://api.btcturk.com/api/v1/order?id=123456789

Cancel Order

DELETE https://api.btcturk.com/api/v1/order

Query Parameters

NameTypeDescription

id*

integer

id of the order

Headers

NameTypeDescription

X-PCK*

string

API public key. You can create the API key from the Account > API Access page in your exchange account.

X-Stamp*

integer

Nonce must be current timestamp in miliseconds. It is a must to sync your current time with API server time which is in miliseconds format. Our servers are using UTC timezone.

X-Signature*

string

Signature is a HMAC-SHA256 encoded message. The HMAC-SHA256 code must be generated using a private key that contains a timestamp as nonce and your API key.

{"success":true, "message": "SUCCESS", "code":0}

Code Example

// You can download ApiClient .net core complete library from github https://github.com/BTCTrader/broker-api-csharp-v2

var configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();

var publicKey = configuration["publicKey"];
var privateKey = configuration["privateKey"];
var resourceUrl = configuration["resourceUrl"];
var apiClientV1 = new ApiClientV1(publicKey, privateKey, resourceUrl);

var orderId = 123456;
var cancelOrder = apiClientV1.CancelOrder(orderId);

if (cancelOrder.Result)
{
    Console.WriteLine($"Successfully canceled order {orderId}");
}
else
{
    Console.WriteLine("Could not cancel order");
}

Error MessageDescription

NO_ORDER_MATCHES_YOUR_REQUEST

orderId not found. Check your orderId information.

ORDER_COULD_NOT_BE_CANCELED

Closed order cannot be cancelled. This error is received if the orderId belongs to the market order or order status is not partial or untouched or the operation fails.

ORDER_CANCEL_BLOCKED

Maintenance work is in progress for the trading pair. Visit our status page for more detailed information. https://status.btcturk.com/

Last updated