Returns Distribution

symbol_returns_distribution


Results
Historical returns with counts and percentage distribution for a global symbol for any given historical date range

Specification
Endpoint
symbol_returns_distribution?symbol={symbol}&start_date={start_date}&end_date={end_date}

Support
Current and Historical values

API Call Counts
50 per API call.

API Plan
gold



Input Parameters
symbol

The common/local symbol/ticker of the symbol

Example : BTCUSD


start_date

Start Date

Example : 2019-01-01


end_date

End Date

Example : 2019-01-01



Output Descriptions
symbol

The common/local symbol/ticker of the symbol

Type: string


symbol_name

The name of the symbol

Type: string


exchange

the exchange code e.g. gemini

Type: string


symbol_pair

the exchange symbol pairs

Type: string


returns_range

The range of returns values. e.g 1,2 represent range from 1 to 2

Type: number


returns_counts

The range counts value

Type: number



Sample Output
{
  "status": "ok",
  "total_records": 10,
  "page_size": 10,
  "current_page": 1,
  "total_pages": 1,
  "results": {
    "symbol": "BTCUSD",
    "symbol_name": "Bitcoin/US Dollar",
    "exchange": "gemini",
    "symbol_pair": "BTC/USD",
    "returns_distribution": [
      {
        "returns_range": "-10.371751323558,-1.114929173568",
        "returns_count": 21
      },
      {
        "returns_range": "-0.66593023685291,-0.43654781438161",
        "returns_count": 3
      },
      {
        "returns_range": "-0.38412043380563,-0.24915889117922",
        "returns_count": 3
      },
      {
        "returns_range": "-0.054458022060761,0.0080292766921216",
        "returns_count": 3
      },
      {
        "returns_range": "0.3229822923764,0.45983257389769",
        "returns_count": 5
      },
      {
        "returns_range": "0.58077922077922,0.78231656003972",
        "returns_count": 4
      },
      {
        "returns_range": "1.0409906355376,1.0409906355376",
        "returns_count": 1
      },
      {
        "returns_range": "1.1139813259125,1.2260229856113",
        "returns_count": 5
      },
      {
        "returns_range": "1.436825010172,1.5269923353714",
        "returns_count": 2
      },
      {
        "returns_range": "2.0293421052632,14.81232186337",
        "returns_count": 13
      }
    ]
  }
}

REST
GET https://www.cryptoquote.io/analytics/v1/?api=symbol_returns_distribution&symbol=BTCUSD.gdax&start_date=2019-11-01&end_date=2019-12-31&key=your_api_key
Python
import requests 
r = requests.get("https://www.cryptoquote.io/analytics/v1/?api=symbol_returns_distribution&symbol=BTCUSD.gdax&start_date=2019-11-01&end_date=2019-12-31&key=your_api_key")
data = r.json()
print(data)
Node.js
var http = require('http');
var buffer = '';
var options = {
	host: 'https://www.cryptoquote.io/analytics/v1/?api=symbol_returns_distribution&symbol=BTCUSD.gdax&start_date=2019-11-01&end_date=2019-12-31&key=your_api_key',
	port: 80,
	path: 'https://www.cryptoquote.io/analytics/v1/?api=symbol_returns_distribution&symbol=BTCUSD.gdax&start_date=2019-11-01&end_date=2019-12-31&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://www.cryptoquote.io/analytics/v1/?api=symbol_returns_distribution&symbol=BTCUSD.gdax&start_date=2019-11-01&end_date=2019-12-31&key=your_api_key");
	if (response.IsSuccessStatusCode)
	{
		//Your custom response parser code
	}
}
Java
String uri = "https://www.cryptoquote.io/analytics/v1/?api=symbol_returns_distribution&symbol=BTCUSD.gdax&start_date=2019-11-01&end_date=2019-12-31&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://www.cryptoquote.io/analytics/v1/?api=symbol_returns_distribution&symbol=BTCUSD.gdax&start_date=2019-11-01&end_date=2019-12-31&key=your_api_key'))
obj <- fromJSON(json)
PHP
$url = 'https://www.cryptoquote.io/analytics/v1/?api=symbol_returns_distribution&symbol=BTCUSD.gdax&start_date=2019-11-01&end_date=2019-12-31&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://www.cryptoquote.io/analytics/v1/?api=symbol_returns_distribution&symbol=BTCUSD.gdax&start_date=2019-11-01&end_date=2019-12-31&key=your_api_key';
$.ajax({
		url: url,
		type: "GET",
		dataType: 'json'
}).done(function (data) {
	console.log(data);
});