BtcTurk | Kripto API Documentation
  • General Information
  • API Access Permissions
  • Data Center
  • Recent changes
  • Authentication
    • Authentication V1
    • Usage
  • Public Endpoints
    • All Public Endpoints
    • Get Exchange Info
    • Get Tickers
    • Get OrderBook
    • Get Trades
    • Get OHLC Data
    • Get Kline Data
  • Private Endpoints
    • All Private Endpoints
    • Get Account Balance
    • Get User Transactions
    • Get Fiat Transactions
    • Get Crypto Transactions
    • Get Open Orders
    • Get All Orders
    • Get Single Order
    • Submit an Order
    • Cancel an Order
  • Rate Limits
  • Websocket Feed
    • WebSocket Authentication
    • Channel, Event and Model
    • Models
    • TradingView
  • Errors
  • Error Handling For Order Operations
    • Retry Strategy Guideline
  • Pairs Scale (Quantity/Price)
  • FAQ (Frequently Asked Questions)
  • Contact Us
Powered by GitBook
On this page
  • Trades
  • Code Example

Was this helpful?

  1. Public Endpoints

Get Trades

Gets a list the latest trades for a product.

  • 2 parameters can be used for the trades enpoint:

    • pairSymbol

    • last

  • You can send pairSymbol parameter in this format BTCUSDT

  • Max of 50 latest trades can be used for the trades parameter

There are 2 possible options:

Without last parameter

https://api.btcturk.com/api/v2/trades?pairSymbol=BTCUSDT

Default 50 trades of BTCUSDT

With last parameter

https://api.btcturk.com/api/v2/trades?pairSymbol=BTCUSDT&last=30

30 trades of BTCUSDT

Trades

GET https://api.btcturk.com/api/v2/trades

Query Parameters

Name
Type
Description

pairSymbol

string

BTCTRY, ETHTRY etc.

last

integer

Indicates how many last trades you want. Max is 50.

  {
  "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"
    }
    ]
  }

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("BTCTRY", 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());
}
<?php
$base = "https://api.btcturk.com";
$method = "/api/v2/trades?pairSymbol=BTCTRY&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);
import time, base64, hmac, hashlib, requests, json

base = "https://api.btcturk.com"
method = "/api/v2/trades?pairSymbol=BTCTRY&last=50"
uri = base+method

result = requests.get(url=uri)
result = result.json()
print(json.dumps(result, indent=2))
uri := "https://api.btcturk.com/api/v2/trades?pairSymbol=BTCUSDT"

request, _ := http.NewRequest("GET", uri, nil)

request.Header.Add("Content-Type", "application/json")

response, _ := http.DefaultClient.Do(request)

defer response.Body.Close()
body, _ := ioutil.ReadAll(response.Body)

fmt.Println(response)
fmt.Println(string(body))
const base = 'https://api.btcturk.com'
const method = '/api/v2/trades?pairSymbol=BTCUSDT'
const uri = base+method;

const options = {method: 'GET', headers: {'Content-type': 'application/json'}};

fetch(uri, options)
    .then(res => res.json())
    .then(json => console.log(json))
    .catch(err => console.error('error:' + err));
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.btcturk.com/api/v2/trades?pairSymbol=BTCUSDT")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-type"] = 'application/json'

response = http.request(request)
puts response.read_body

PreviousGet OrderBookNextGet OHLC Data

Last updated 2 years ago

Was this helpful?