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
DELETEhttps://api.btcturk.com/api/v1/order
Query Parameters
Name
Type
Description
id*
integer
id of the order
Headers
Name
Type
Description
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-v2var configuration =newConfigurationBuilder().AddJsonFile("appsettings.json").Build();var publicKey =configuration["publicKey"];var privateKey =configuration["privateKey"];var resourceUrl =configuration["resourceUrl"];var apiClientV1 =newApiClientV1(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");}
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/