Trades

get
Trades

https://api.btcturk.com/api/v2/trades
Request
Response
Request
Query Parameters
pairSymbol
required
string
BTC_TRY, ETH_TRY etc.
last
optional
integer
Indicates how many last trades you want. Max is 50.
Response
200: OK
{
"success": true,
"message": null,
"code": 0,
"data": [
{
"pair": BTCTRY,
"pairNormalized": BTC_TRY,
"numerator": BTC,
"denominator": TRY,
"date": 1533650242300,
"tid": "636692470417865271",
"price": "33490",
"amount": "0.00032747"
},
{
"pair": BTCTRY,
"pairNormalized": BTC_TRY,
"numerator": BTC,
"denominator": TRY,
"date": 1533650237143,
"tid": "636692470367947749",
"price": "33245",
"amount": "0.00471901"
}
]
}

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 trades = apiClientV1.GetLastTrades("BTC_TRY", 10);
if (trades.Result.Success)
{
Console.WriteLine("Last 10 trades in the market");
foreach (var trade in trades.Result.Data)
{
Console.WriteLine(trade.ToString());
}
}
else
{
Console.WriteLine(trades.Result.ToString());
}

Python Code Example

import time, base64, hmac, hashlib, requests, json
base = "https://api.btcturk.com"
method = "/api/v2/trades?pairSymbol=BTC_TRY&last=50"
uri = base+method
result = requests.get(url=uri)
result = result.json()
print(json.dumps(result, indent=2))

PHP Code Example

<?php
$base = "https://api.btcturk.com";
$method = "/api/v2/trades?pairSymbol=BTC_TRY&last=50";
$uri = $base.$method;
$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);
$result = curl_exec($ch);
if (curl_errno($ch)) {
print_r(curl_error($ch));
}
$answer = json_decode($result);
print_r($answer);