User Transactions
get
https://api.btcturk.com
/api/v1/users/transactions/trade
Trade

C# Code Example

1
// You can download ApiClient .net core complete library from github https://github.com/BTCTrader/broker-api-csharp-v2
2
3
var configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
4
5
var publicKey = configuration["publicKey"];
6
var privateKey = configuration["privateKey"];
7
var resourceUrl = configuration["resourceUrl"];
8
var apiClientV1 = new ApiClientV1(publicKey, privateKey, resourceUrl);
9
10
var startdate = new DateTime(2019, 11, 19);
11
var endatet = new DateTime(2019, 12, 19);
12
var userTrades = apiClientV1.GetUserTrades(new[] { "buy", "sell" }, new[] { "try", "btc" }, startdate.ToUnixTime(), endatet.ToUnixTime());
13
14
if (userTrades.Result.Success)
15
{
16
foreach (var userTrade in userTrades.Result.Data)
17
{
18
Console.WriteLine(userTrade);
19
}
20
}
Copied!

Python Code Example

1
import time, base64, hmac, hashlib, requests, json
2
3
base = "https://api.btcturk.com"
4
method = "/api/v1/users/transactions/trade?type=buy&type=sell&symbol=btc&symbol=try&symbol=usdt"
5
uri = base+method
6
7
apiKey = "YOUR_API_PUBLIC_KEY"
8
apiSecret = "YOUR_API_SECRET"
9
apiSecret = base64.b64decode(apiSecret)
10
11
stamp = str(int(time.time())*1000)
12
data = "{}{}".format(apiKey, stamp).encode("utf-8")
13
signature = hmac.new(apiSecret, data, hashlib.sha256).digest()
14
signature = base64.b64encode(signature)
15
headers = {"X-PCK": apiKey, "X-Stamp": stamp, "X-Signature": signature, "Content-Type" : "application/json"}
16
17
result = requests.get(url=uri, headers=headers)
18
result = result.json()
19
print(json.dumps(result, indent=2))
Copied!

PHP Code Example

1
<?php
2
$base = "https://api.btcturk.com";
3
$apiKey = "YOUR_API_PUBLIC_KEY";
4
$apiSecret = "YOUR_API_SECRET";
5
$method = "/api/v1/users/transactions/trade?type=buy&type=sell&symbol=btc&symbol=try&symbol=usdt";
6
$uri = $base.$method;
7
8
$nonce = time()*1000;
9
$message = $apiKey.$nonce;
10
$signatureBytes = hash_hmac("sha256", $message, base64_decode($apiSecret), true);
11
$signature = base64_encode($signatureBytes);
12
$headers = array(
13
"X-PCK: ".$apiKey,
14
"X-Stamp: ".$nonce,
15
"X-Signature: ".$signature,
16
"Cache-Control: no-cache",
17
"Content-Type: application/json");
18
19
$ch = curl_init();
20
curl_setopt($ch, CURLOPT_URL, $uri);
21
curl_setopt($ch, CURLOPT_HTTP_VERSION, "CURL_HTTP_VERSION_1_2");
22
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
23
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
24
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
25
$result = curl_exec($ch);
26
27
if (curl_errno($ch)) {
28
print_r(curl_error($ch));
29
}
30
$answer = json_decode($result);
31
print_r($answer);
Copied!
post
https://api.btcturk.com
/api/v1/users/transactions/crypto
Crypto

C# Code Example

1
// You can download ApiClient .net core complete library from github https://github.com/BTCTrader/broker-api-csharp-v2
2
3
var configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
4
5
var publicKey = configuration["publicKey"];
6
var privateKey = configuration["privateKey"];
7
var resourceUrl = configuration["resourceUrl"];
8
var apiClientV1 = new ApiClientV1(publicKey, privateKey, resourceUrl);
9
10
var userCryptoTransactions = apiClientV1.GetUserCryptoTransactions(new[] { "deposit", "withdrawal" }, new[] { "btc", "eth", "xrp" }, DateTime.UtcNow.AddDays(-30).ToUnixTime(), DateTime.UtcNow.ToUnixTime());
11
12
if (userCryptoTransactions.Result.Success)
13
{
14
foreach (var userCryptoTransaction in userCryptoTransactions.Result.Data)
15
{
16
Console.WriteLine(userCryptoTransaction);
17
}
18
}
Copied!

Python Code Example

1
import time, base64, hmac, hashlib, requests, json
2
3
base = "https://api.btcturk.com"
4
method = "/api/v1/users/transactions/crypto"
5
uri = base+method
6
7
apiKey = "YOUR_API_PUBLIC_KEY"
8
apiSecret = "YOUR_API_SECRET"
9
apiSecret = base64.b64decode(apiSecret)
10
11
stamp = str(int(time.time())*1000)
12
data = "{}{}".format(apiKey, stamp).encode("utf-8")
13
signature = hmac.new(apiSecret, data, hashlib.sha256).digest()
14
signature = base64.b64encode(signature)
15
headers = {"X-PCK": apiKey, "X-Stamp": stamp, "X-Signature": signature, "Content-Type" : "application/json"}
16
17
result = requests.get(url=uri, headers=headers)
18
result = result.json()
19
print(json.dumps(result, indent=2))
Copied!

PHP Code Example

1
<?php
2
$base = "https://api.btcturk.com";
3
$apiKey = "YOUR_API_PUBLIC_KEY";
4
$apiSecret = "YOUR_API_SECRET";
5
$method = "/api/v1/users/transactions/crypto";
6
$uri = $base.$method;
7
8
$nonce = time()*1000;
9
$message = $apiKey.$nonce;
10
$signatureBytes = hash_hmac("sha256", $message, base64_decode($apiSecret), true);
11
$signature = base64_encode($signatureBytes);
12
$headers = array(
13
"X-PCK: ".$apiKey,
14
"X-Stamp: ".$nonce,
15
"X-Signature: ".$signature,
16
"Cache-Control: no-cache",
17
"Content-Type: application/json");
18
19
$ch = curl_init();
20
curl_setopt($ch, CURLOPT_URL, $uri);
21
curl_setopt($ch, CURLOPT_HTTP_VERSION, "CURL_HTTP_VERSION_1_2");
22
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
23
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
24
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
25
$result = curl_exec($ch);
26
27
if (curl_errno($ch)) {
28
print_r(curl_error($ch));
29
}
30
$answer = json_decode($result);
31
print_r($answer);
Copied!
post
https://api.btcturk.com
/api/v1/users/transactions/fiat
Fiat

C# Code Example

1
// You can download ApiClient .net core complete library from github https://github.com/BTCTrader/broker-api-csharp-v2
2
3
var configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
4
5
var publicKey = configuration["publicKey"];
6
var privateKey = configuration["privateKey"];
7
var resourceUrl = configuration["resourceUrl"];
8
var apiClientV1 = new ApiClientV1(publicKey, privateKey, resourceUrl);
9
10
var userFiatTransactions = apiClientV1.GetUserFiatTransactions(new[] { "deposit", "withdrawal" }, new[] { "try" }, DateTime.UtcNow.AddDays(-30).ToUnixTime(), DateTime.UtcNow.ToUnixTime());
11
12
if (userFiatTransactions.Result.Success)
13
{
14
foreach (var userFiatTransaction in userFiatTransactions.Result.Data)
15
{
16
Console.WriteLine(userFiatTransaction);
17
}
18
}
Copied!

Python Code Example

1
import time, base64, hmac, hashlib, requests, json
2
3
base = "https://api.btcturk.com"
4
method = "/api/v1/users/transactions/fiat"
5
uri = base+method
6
7
apiKey = "YOUR_API_PUBLIC_KEY"
8
apiSecret = "YOUR_API_SECRET"
9
apiSecret = base64.b64decode(apiSecret)
10
11
stamp = str(int(time.time())*1000)
12
data = "{}{}".format(apiKey, stamp).encode("utf-8")
13
signature = hmac.new(apiSecret, data, hashlib.sha256).digest()
14
signature = base64.b64encode(signature)
15
headers = {"X-PCK": apiKey, "X-Stamp": stamp, "X-Signature": signature, "Content-Type" : "application/json"}
16
17
result = requests.get(url=uri, headers=headers)
18
result = result.json()
19
print(json.dumps(result, indent=2))
Copied!

PHP Code Example

1
<?php
2
$base = "https://api.btcturk.com";
3
$apiKey = "YOUR_API_PUBLIC_KEY";
4
$apiSecret = "YOUR_API_SECRET";
5
$method = "/api/v1/users/transactions/fiat";
6
$uri = $base.$method;
7
8
$nonce = time()*1000;
9
$message = $apiKey.$nonce;
10
$signatureBytes = hash_hmac("sha256", $message, base64_decode($apiSecret), true);
11
$signature = base64_encode($signatureBytes);
12
$headers = array(
13
"X-PCK: ".$apiKey,
14
"X-Stamp: ".$nonce,
15
"X-Signature: ".$signature,
16
"Cache-Control: no-cache",
17
"Content-Type: application/json");
18
19
$ch = curl_init();
20
curl_setopt($ch, CURLOPT_URL, $uri);
21
curl_setopt($ch, CURLOPT_HTTP_VERSION, "CURL_HTTP_VERSION_1_2");
22
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
23
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
24
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
25
$result = curl_exec($ch);
26
27
if (curl_errno($ch)) {
28
print_r(curl_error($ch));
29
}
30
$answer = json_decode($result);
31
print_r($answer);
Copied!
Last modified 3mo ago