User Transactions

get
Trade

https://api.btcturk.com/api/v1/users/transactions/trade
Request
Response
Request
Headers
X-PCK
required
string
API public key. You can create the API key from the Account > API Access page in your exchange account.
X-Stamp
required
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
required
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.
Query Parameters
orderId
optional
integer
long, Optional you can not combine this parameter with other parameters. So you should send this parameter alone.
type
required
array
string array, {"buy", "sell"}
symbol
required
array
string array, {"btc", "try", ...etc.}
startDate
optional
integer
long, Optional timestamp if null will return last 30 days
endDate
optional
integer
long, Optional timestamp if null will return last 30 days
Response
200: OK
{
"success": true,
"message": "SUCCESS",
"code": 0,
"data": [
{
"price": "313000.00",
"numeratorSymbol": "BTC",
"denominatorSymbol": "TRY",
"orderType": "sell",
"orderId": 22632304,
"id": 5758565,
"timestamp": 1628690323897,
"amount": "-0.00040000",
"fee": "-0.19098258",
"tax": "-0.03437687"
},
{
"price": "399742.00",
"numeratorSymbol": "BTC",
"denominatorSymbol": "TRY",
"orderType": "buy",
"orderId": 22632299,
"id": 5758564,
"timestamp": 1628690307310,
"amount": "0.00024971",
"fee": "-0.15226792",
"tax": "-0.02740823"
},
{
"price": "429715.00",
"numeratorSymbol": "BTC",
"denominatorSymbol": "TRY",
"orderType": "buy",
"orderId": 21075506,
"id": 5754843,
"timestamp": 1627556216413,
"amount": "0.00023229",
"fee": "-0.15226792",
"tax": "-0.02740823"
}
]
}

C# 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 startdate = new DateTime(2019, 11, 19);
var endatet = new DateTime(2019, 12, 19);
var userTrades = apiClientV1.GetUserTrades(new[] { "buy", "sell" }, new[] { "try", "btc" }, startdate.ToUnixTime(), endatet.ToUnixTime());
if (userTrades.Result.Success)
{
foreach (var userTrade in userTrades.Result.Data)
{
Console.WriteLine(userTrade);
}
}

Python Code Example

import time, base64, hmac, hashlib, requests, json
base = "https://api.btcturk.com"
method = "/api/v1/users/transactions/trade?type=buy&type=sell&symbol=btc&symbol=try&symbol=usdt"
uri = base+method
apiKey = "YOUR_API_PUBLIC_KEY"
apiSecret = "YOUR_API_SECRET"
apiSecret = base64.b64decode(apiSecret)
stamp = str(int(time.time())*1000)
data = "{}{}".format(apiKey, stamp).encode("utf-8")
signature = hmac.new(apiSecret, data, hashlib.sha256).digest()
signature = base64.b64encode(signature)
headers = {"X-PCK": apiKey, "X-Stamp": stamp, "X-Signature": signature, "Content-Type" : "application/json"}
result = requests.get(url=uri, headers=headers)
result = result.json()
print(json.dumps(result, indent=2))

PHP Code Example

<?php
$base = "https://api.btcturk.com";
$apiKey = "YOUR_API_PUBLIC_KEY";
$apiSecret = "YOUR_API_SECRET";
$method = "/api/v1/users/transactions/trade?type=buy&type=sell&symbol=btc&symbol=try&symbol=usdt";
$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);

post
Crypto

https://api.btcturk.com/api/v1/users/transactions/crypto
Request
Response
Request
Headers
X-PCK
required
string
API public key. You can create the API key from the Account > API Access page in your exchange account.
X-Stamp
required
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
required
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.
Query Parameters
type
required
array
string array, {"deposit", "withdrawal"}
symbol
required
array
string array, {"btc", "eth", ...etc.}
startDate
optional
integer
long, Optional timestamp if null will return last 30 days
endDate
optional
integer
long, Optional timestamp if null will return last 30 da
Response
200: OK
{
"success": true,
"message": "SUCCESS",
"code": 0,
"data": [
{
"balanceType": "Deposit",
"currencySymbol": "XRP",
"id": 676961,
"timestamp": 1544079921450,
"funds": 10.8,
"amount": 0.9,
"fee": 0,
"tax": 0
},
{
"balanceType": "Withdrawal",
"currencySymbol": "XRP",
"id": 516136,
"timestamp": 1544079921450,
"funds": 8.9,
"amount": -1,
"fee": 0,
"tax": 0
} ...
]
}

C# 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 userCryptoTransactions = apiClientV1.GetUserCryptoTransactions(new[] { "deposit", "withdrawal" }, new[] { "btc", "eth", "xrp" }, DateTime.UtcNow.AddDays(-30).ToUnixTime(), DateTime.UtcNow.ToUnixTime());
if (userCryptoTransactions.Result.Success)
{
foreach (var userCryptoTransaction in userCryptoTransactions.Result.Data)
{
Console.WriteLine(userCryptoTransaction);
}
}

Python Code Example

import time, base64, hmac, hashlib, requests, json
base = "https://api.btcturk.com"
method = "/api/v1/users/transactions/crypto"
uri = base+method
apiKey = "YOUR_API_PUBLIC_KEY"
apiSecret = "YOUR_API_SECRET"
apiSecret = base64.b64decode(apiSecret)
stamp = str(int(time.time())*1000)
data = "{}{}".format(apiKey, stamp).encode("utf-8")
signature = hmac.new(apiSecret, data, hashlib.sha256).digest()
signature = base64.b64encode(signature)
headers = {"X-PCK": apiKey, "X-Stamp": stamp, "X-Signature": signature, "Content-Type" : "application/json"}
result = requests.get(url=uri, headers=headers)
result = result.json()
print(json.dumps(result, indent=2))

PHP Code Example

<?php
$base = "https://api.btcturk.com";
$apiKey = "YOUR_API_PUBLIC_KEY";
$apiSecret = "YOUR_API_SECRET";
$method = "/api/v1/users/transactions/crypto";
$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);

post
Fiat

https://api.btcturk.com/api/v1/users/transactions/fiat
Request
Response
Request
Headers
X-PCK
required
string
Account > API Access page in your exchange account.
X-Stamp
required
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
required
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.
Query Parameters
type
required
array
string array, {"deposit", "withdrawal"}
symbol
required
array
string array, {"try"}
startDate
optional
integer
long, Optional timestamp if null will return last 30 days
endDate
optional
integer
long, Optional timestamp if null will return last 30 da
Response
200: OK
{
"success": true,
"message": "SUCCESS",
"code": 0,
"data": [
{
"balanceType": "Deposit",
"currencySymbol": "TRY",
"id": 93214,
"timestamp": 1544079972687,
"funds": 100000,
"amount": 1000,
"fee": 0,
"tax": 0
},
{
"balanceType": "Deposit",
"currencySymbol": "TRY",
"id": 919664,
"timestamp": 1544079972687,
"funds": 100000.04,
"amount": 100000,
"fee": 0,
"tax": 0
} ...
}

C# 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 userFiatTransactions = apiClientV1.GetUserFiatTransactions(new[] { "deposit", "withdrawal" }, new[] { "try" }, DateTime.UtcNow.AddDays(-30).ToUnixTime(), DateTime.UtcNow.ToUnixTime());
if (userFiatTransactions.Result.Success)
{
foreach (var userFiatTransaction in userFiatTransactions.Result.Data)
{
Console.WriteLine(userFiatTransaction);
}
}

Python Code Example

import time, base64, hmac, hashlib, requests, json
base = "https://api.btcturk.com"
method = "/api/v1/users/transactions/fiat"
uri = base+method
apiKey = "YOUR_API_PUBLIC_KEY"
apiSecret = "YOUR_API_SECRET"
apiSecret = base64.b64decode(apiSecret)
stamp = str(int(time.time())*1000)
data = "{}{}".format(apiKey, stamp).encode("utf-8")
signature = hmac.new(apiSecret, data, hashlib.sha256).digest()
signature = base64.b64encode(signature)
headers = {"X-PCK": apiKey, "X-Stamp": stamp, "X-Signature": signature, "Content-Type" : "application/json"}
result = requests.get(url=uri, headers=headers)
result = result.json()
print(json.dumps(result, indent=2))

PHP Code Example

<?php
$base = "https://api.btcturk.com";
$apiKey = "YOUR_API_PUBLIC_KEY";
$apiSecret = "YOUR_API_SECRET";
$method = "/api/v1/users/transactions/fiat";
$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);