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
  • Response
  • OHLC Data
  • Code Example

Was this helpful?

  1. Public Endpoints

Get OHLC Data

This is the data that is shown in our charting interface.

open, high, low, close, volume, total and average information can be viewed with OHLC enpoint.

Response

{
    "pair": "BTCUSDT",
    "time": 1639526400,
    "open": 48250.0,
    "high": 49500.0,
    "low": 46601.0,
    "close": 48820.0,
    "volume": 199.490950394233,
    "total": 9634561.91977406,
    "average": 48295.73,
    "dailyChangeAmount": 570.0,
    "dailyChangePercentage": 1.18
  }
  • Can be used with pair, from and to parameters

    • https://graph-api.btcturk.com/v1/ohlcs?pair=BTCUSDT&from=1638316800&to=1639526400

The from and to parameters must be used with Unix time in seconds.

OHLC Data

GET https://graph-api.btcturk.com/v1/ohlcs

Query Parameters

Name
Type
Description

pair

string

BTC_TRY, ETH_TRY etc.

from

integer

Unix time in seconds

to

integer

Unix time in seconds

[
  {
    "pair": "BTCTRY",
    "time": 1582070400,
    "open": 61940,
    "high": 62698,
    "low": 58500,
    "close": 58801,
    "volume": 549.1858885452384,
    "total": 33566080.63598728,
    "average": 61119.71,
    "dailyChangeAmount": -3139,
    "dailyChangePercentage": -5.07
  },
  {
    "pair": "BTCTRY",
    "time": 1582156800,
    "open": 59150,
    "high": 61000,
    "low": 58477,
    "close": 59100,
    "volume": 663.4533811472954,
    "total": 39211283.23027989,
    "average": 59101.79,
    "dailyChangeAmount": -50,
    "dailyChangePercentage": -0.08
  },
  {
    "pair": "BTCTRY",
    "time": 1582243200,
    "open": 59104,
    "high": 60399,
    "low": 58801,
    "close": 59704,
    "volume": 387.62553661495724,
    "total": 23127026.682461508,
    "average": 59663.32,
    "dailyChangeAmount": 600,
    "dailyChangePercentage": 1.02
  }
]

Code Example

<?php
$base = "https://graph-api.btcturk.com";
$method = "/v1/ohlcs?pair=BTCTRY";
$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://graph-api.btcturk.com"
method = "/v1/ohlcs?pair=BTCTRY"
uri = base+method

result = requests.get(url=uri)
result = result.json()
print(json.dumps(result, indent=2))t
uri := "https://graph-api.btcturk.com/v1/ohlcs?pair=BTCUSDT&from=1638316800&to=1639526400"

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://graph-api.btcturk.com'
const method = '/v1/ohlcs?pair=BTCUSDT&from=1638316800&to=1639526400'
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://graph-api.btcturk.com/v1/ohlcs?pair=BTCUSDT&from=1638316800&to=1639526400
")

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 TradesNextGet Kline Data

Last updated 2 years ago

Was this helpful?