You can obtain the latest trades (ticks) for a market as follows:
https://api.cryptoquote.io/v1/bars/ticks/ethusd.hitbtc/now?format=csv&key=your_api_key
Endpointbars/ticks
Support
Current and Historical values
API Call Counts
100 per API call.
API Plan
gold
symbolThe common/local symbol/ticker of the symbol
Example : BTCUSD
symbolThe common/local symbol/ticker of the symbol
Type: string
datereturns date of the return query data
Type: date
pricePrice of the symbol
Type: number
{
"requestSymbol": "ETHUSD",
"vendorSymbol": "ETHUSD.hitbtc",
"bars": {
"interval": "trades",
"symbol": "ETHUSD",
"bars": Array[3115][
{
"time": "2022-01-12T22:29:43.819Z",
"price": "3376.217",
"size": "0.6602"
},
{
"time": "2022-01-12T22:29:43.819Z",
"price": "3376.218",
"size": "0.1469"
},
{
"time": "2022-01-12T22:29:43.819Z",
"price": "3376.717",
"size": "0.1288"
}
]
}
}
REST
GET https://api.cryptoquote.io/v1/bars/ticks&https://api.cryptoquote.io/v1/bars/ticks/ethusd.hitbtc/now?format=csv&key=&key=your_api_key
Python
import requests
r = requests.get("https://api.cryptoquote.io/v1/bars/ticks&https://api.cryptoquote.io/v1/bars/ticks/ethusd.hitbtc/now?format=csv&key=&key=your_api_key")
data = r.json()
print(data)
Node.js
var http = require('http');
var buffer = '';
var options = {
host: 'https://api.cryptoquote.io/v1/bars/ticks&https://api.cryptoquote.io/v1/bars/ticks/ethusd.hitbtc/now?format=csv&key=&key=your_api_key',
port: 80,
path: 'https://api.cryptoquote.io/v1/bars/ticks&https://api.cryptoquote.io/v1/bars/ticks/ethusd.hitbtc/now?format=csv&key=&key=your_api_key',
headers: headers
};
callback = function(response) {
response.on('data', function (chunk) {
buffer += chunk;
});
response.on('end', function () {
// your code here if you want to use the results !
});
}
var req = http.get(options, callback).end();
C#
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("{$api_host}");
client.DefaultRequestHeaders.Clear();
//ADD Acept Header to tell the server what data type you want
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
//SET Parameters
HttpResponseMessage response = await client.GetAsync("https://api.cryptoquote.io/v1/bars/ticks&https://api.cryptoquote.io/v1/bars/ticks/ethusd.hitbtc/now?format=csv&key=&key=your_api_key");
if (response.IsSuccessStatusCode)
{
//Your custom response parser code
}
}
Java
String uri = "https://api.cryptoquote.io/v1/bars/ticks&https://api.cryptoquote.io/v1/bars/ticks/ethusd.hitbtc/now?format=csv&key=&key=your_api_key";
URL url = new URL(uri);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept", "application/json");
InputStream xml = connection.getInputStream();
R
1 - Install package
install.packages("RCurl")
install.packages("jsonlite")
2 - Request the data:
library('RCurl')
require('jsonlite')
json <- getURL(URLencode('https://api.cryptoquote.io/v1/bars/ticks&https://api.cryptoquote.io/v1/bars/ticks/ethusd.hitbtc/now?format=csv&key=&key=your_api_key'))
obj <- fromJSON(json)
PHP
$url = 'https://api.cryptoquote.io/v1/bars/ticks&https://api.cryptoquote.io/v1/bars/ticks/ethusd.hitbtc/now?format=csv&key=&key=your_api_key';
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($handle);
curl_close($handle);
//parse your data as per your needs....
Javascript
var url = 'https://api.cryptoquote.io/v1/bars/ticks&https://api.cryptoquote.io/v1/bars/ticks/ethusd.hitbtc/now?format=csv&key=&key=your_api_key';
$.ajax({
url: url,
type: "GET",
dataType: 'json'
}).done(function (data) {
console.log(data);
});