Get All Orders

Retrieve all orders of any status.

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 can access all orders with orderId, pairSymbol, startTime,endTime, page and limit parameters.

  • Can access all order information with /api/v1/allOrders endpoint.

  • Canceled, filled, partial and untouched orders can be viewed.

All Orders

GET https://api.btcturk.com/api/v1/allOrders

Query Parameters

NameTypeDescription

orderId

integer

If orderId set, it will return all orders greater than or equals to this order id

pairSymbol

string

BTCTRY, ETHTRY etc.

startTime

integer

start time

endTime

integer

end time

page

integer

page number

limit

string

default 100, max 1000

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": null,
  "code": 0,
  "data": [
    {
      "id": 9932534,
      "price": "20000.00",
      "amount": "0.001",
      "quantity": "0.001",
      "pairsymbol": "BTCTRY",
      "pairsymbolnormalized":"BTC_TRY",
      "type": "Buy",
      "method": "Limit",
      "orderClientId": "test",
      "time": 1543996112263,
      "updateTime": 1543996112263,
      "status": "Untouched"
    },
    {
      "id": 9932533,
      "price": "21000.00",
      "amount": "0.001",
      "quantity": "0.001",
      "pairsymbol": "BTCTRY",
      "pairsymbolnormalized":"BTC_TRY",
      "type": "Buy",
      "method": "Limit",
      "orderClientId": "test",
      "time": 1543994632920,
      "updateTime": 1543994632920,
      "status": "Untouched"
    },
    {
      "id": 9932523,
      "price": "2000.00",
      "amount": "0.01",
      "quantity": "0.01",
      "pairsymbol": "BTCTRY",
      "pairsymbolnormalized":"BTC_TRY",
      "type": "Buy",
      "method": "Limit",
      "orderClientId": "test",
      "time": 1543500891493,
      "updateTime": 1543501769613,
      "status": "Canceled"
    }
  ]
}

Code Example

<?php
$base = "https://api.btcturk.com";
$apiKey = "YOUR_API_PUBLIC_KEY";
$apiSecret = "YOUR_API_SECRET";
$method = "/api/v1/allOrders?pairSymbol=BTCTRY";
$uri = $base.$method;

$nonce = time()*1000;
$message = $apiKey.$nonce;
$signatureBytes = hash_hmac("sha256", $message, base64_decode($apiSecret), true);
$signature = base64_encode($signatureBytes);
$headers = array(
    "X-PCK: ".$apiKey,
    "X-Stamp: ".$nonce,
    "X-Signature: ".$signature,
    "Cache-Control: no-cache",
    "Content-Type: application/json");

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $uri);
curl_setopt($ch, CURLOPT_HTTP_VERSION, "CURL_HTTP_VERSION_1_2");
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);

if (curl_errno($ch)) {
    print_r(curl_error($ch));
}
$answer = json_decode($result);
print_r($answer);

Last updated