Financial Returns and Trading Volumes

symbol_returns_volume_categories


Results
This API allows to look at relationship between returns vs trading volume. It calculate the daily log returns, cumulative normalize returns, volume change and more. In addition, it discretize returns and volume change and re-organize them in 10 equal size buckets from -5 to +5 range labels to help identify returns and trading volume patterns.

Specification
Endpoint
symbol_returns_volume_categories?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



Sample Output
{
  "status": "ok",
  "info": {
    "symbol": {
      "symbol": "BTCUSD",
      "symbol_name": "Bitcoin/US Dollar",
      "exchange": "gemini",
      "symbol_pair": "BTC/USD"
    },
    "results": [
      {
        "date": "2022-03-24",
        "close_price": 43017.4,
        "volume": 324.53390217,
        "log_returns": 0.0208438969,
        "cumulative_normalize_returns": 1.0210626482,
        "volume_change": 0.6843046072,
        "log_returns_category": 3,
        "volume_change_category": 3
      },
      {
        "date": "2022-03-23",
        "close_price": 42130.03,
        "volume": 163.70817116,
        "log_returns": -0.0211323432,
        "cumulative_normalize_returns": 0.9997115953,
        "volume_change": -1.1264098097,
        "log_returns_category": -3,
        "volume_change_category": -5
      },
      {
        "date": "2022-03-22",
        "close_price": 43029.81,
        "volume": 504.96807439,
        "log_returns": 0.0489690794,
        "cumulative_normalize_returns": 1.0498849987,
        "volume_change": 0.9907102028,
        "log_returns_category": 5,
        "volume_change_category": 4
      },
      {
        "date": "2022-03-21",
        "close_price": 40973.44,
        "volume": 187.50115501,
        "log_returns": -0.0234647465,
        "cumulative_normalize_returns": 1.0255364962,
        "volume_change": 1.1101123372,
        "log_returns_category": -3,
        "volume_change_category": 5
      },
      {
        "date": "2022-03-20",
        "close_price": 41946.24,
        "volume": 61.78574462,
        "log_returns": 0.0052181096,
        "cumulative_normalize_returns": 1.0309018444,
        "volume_change": -0.8197828024,
        "log_returns_category": 1,
        "volume_change_category": -4
      },
      {
        "date": "2022-03-19",
        "close_price": 41727.93,
        "volume": 140.25405697,
        "log_returns": 0.0249140955,
        "cumulative_normalize_returns": 1.0569084517,
        "volume_change": -0.1954362242,
        "log_returns_category": 4,
        "volume_change_category": -1
      },
      {
        "date": "2022-03-18",
        "close_price": 40701.16,
        "volume": 170.52666797,
        "log_returns": -0.0041389703,
        "cumulative_normalize_returns": 1.0525429796,
        "volume_change": -0.4822199304,
        "log_returns_category": -1,
        "volume_change_category": -1
      },
      {
        "date": "2022-03-17",
        "close_price": 40869.97,
        "volume": 276.19623938,
        "log_returns": 0.0358701373,
        "cumulative_normalize_returns": 1.0909831463,
        "volume_change": -1.2201293776,
        "log_returns_category": 5,
        "volume_change_category": -5
      },
      {
        "date": "2022-03-16",
        "close_price": 39429.94,
        "volume": 935.64955839,
        "log_returns": 0.014963306,
        "cumulative_normalize_returns": 1.1074306083,
        "volume_change": 1.6152373366,
        "log_returns_category": 2,
        "volume_change_category": 5
      },
      {
        "date": "2022-03-15",
        "close_price": 38844.33,
        "volume": 186.04780677,
        "log_returns": 0.0008568627,
        "cumulative_normalize_returns": 1.1083799309,
        "volume_change": -0.3336195704,
        "log_returns_category": -1,
        "volume_change_category": -1
      },
      {
        "date": "2022-03-14",
        "close_price": 38811.06,
        "volume": 259.72496305,
        "log_returns": 0.0266260755,
        "cumulative_normalize_returns": 1.1382881408,
        "volume_change": -0.6323191566,
        "log_returns_category": 4,
        "volume_change_category": -2
      },
      {
        "date": "2022-03-13",
        "close_price": 37791.31,
        "volume": 488.79461612,
        "log_returns": -0.0319174977,
        "cumulative_normalize_returns": 1.1025305143,
        "volume_change": 1.2643740148,
        "log_returns_category": -4,
        "volume_change_category": 5
      },
      {
        "date": "2022-03-12",
        "close_price": 39016.97,
        "volume": 138.04343452,
        "log_returns": -0.0013812647,
        "cumulative_normalize_returns": 1.1010086791,
        "volume_change": -0.7976433229,
        "log_returns_category": -1,
        "volume_change_category": -3
      },
      {
        "date": "2022-03-11",
        "close_price": 39070.9,
        "volume": 306.49814446,
        "log_returns": 0.0019532307,
        "cumulative_normalize_returns": 1.1031613047,
        "volume_change": -0.7305915249,
        "log_returns_category": 1,
        "volume_change_category": -3
      },
      {
        "date": "2022-03-10",
        "close_price": 38994.66,
        "volume": 636.3846819,
        "log_returns": -0.0737054734,
        "cumulative_normalize_returns": 1.0247764568,
        "volume_change": -1.0769083626,
        "log_returns_category": -5,
        "volume_change_category": -4
      },
      {
        "date": "2022-03-09",
        "close_price": 41977.35,
        "volume": 1868.16433527,
        "log_returns": 0.0794537737,
        "cumulative_normalize_returns": 1.109520868,
        "volume_change": 0.4111640547,
        "log_returns_category": 5,
        "volume_change_category": 2
      },
      {
        "date": "2022-03-08",
        "close_price": 38771.15,
        "volume": 1238.36536401,
        "log_returns": 0.0200902536,
        "cumulative_normalize_returns": 1.1320368421,
        "volume_change": -0.1214271406,
        "log_returns_category": 3,
        "volume_change_category": 1
      },
      {
        "date": "2022-03-07",
        "close_price": 38000,
        "volume": 1398.24712105,
        "log_returns": -0.011211911,
        "cumulative_normalize_returns": 1.1194154331,
        "volume_change": 0.7339973655,
        "log_returns_category": -2,
        "volume_change_category": 4
      },
      {
        "date": "2022-03-06",
        "close_price": 38428.45,
        "volume": 671.13969812,
        "log_returns": -0.0252611036,
        "cumulative_normalize_returns": 1.0914919379,
        "volume_change": 0.1972251362,
        "log_returns_category": -4,
        "volume_change_category": 2
      },
      {
        "date": "2022-03-05",
        "close_price": 39411.56,
        "volume": 551.00956757,
        "log_returns": 0.0061990874,
        "cumulative_normalize_returns": 1.0982792075,
        "volume_change": -1.515297305,
        "log_returns_category": 2,
        "volume_change_category": -5
      },
      {
        "date": "2022-03-04",
        "close_price": 39168,
        "volume": 2507.51995526,
        "log_returns": -0.0807296888,
        "cumulative_normalize_returns": 1.0130999718,
        "volume_change": 0.6370479426,
        "log_returns_category": -5,
        "volume_change_category": 3
      },
      {
        "date": "2022-03-03",
        "close_price": 42461.16,
        "volume": 1326.10524172,
        "log_returns": -0.0341467575,
        "cumulative_normalize_returns": 0.9790898648,
        "volume_change": -0.0422630084,
        "log_returns_category": -5,
        "volume_change_category": 1
      },
      {
        "date": "2022-03-02",
        "close_price": 43936.11,
        "volume": 1383.35162013,
        "log_returns": -0.011431559,
        "cumulative_normalize_returns": 0.9679610722,
        "volume_change": -0.5994576995,
        "log_returns_category": -2,
        "volume_change_category": -2
      },
      {
        "date": "2022-03-01",
        "close_price": 44441.25,
        "volume": 2519.26442576,
        "log_returns": null,
        "cumulative_normalize_returns": null,
        "volume_change": null,
        "log_returns_category": null,
        "volume_change_category": null
      }
    ]
  },
  "total_records": 24,
  "page_size": 24,
  "current_page": 1,
  "total_pages": 1,
  "results": null
}

REST
GET https://www.cryptoquote.io/analytics/v1/?api=symbol_returns_volume_categories&symbol=BTCUSD.gdax&start_date=2019-12-01&end_date=2020-01-27&price_field=close_price&period=14&key=your_api_key
Python
import requests 
r = requests.get("https://www.cryptoquote.io/analytics/v1/?api=symbol_returns_volume_categories&symbol=BTCUSD.gdax&start_date=2019-12-01&end_date=2020-01-27&price_field=close_price&period=14&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_volume_categories&symbol=BTCUSD.gdax&start_date=2019-12-01&end_date=2020-01-27&price_field=close_price&period=14&key=your_api_key',
	port: 80,
	path: 'https://www.cryptoquote.io/analytics/v1/?api=symbol_returns_volume_categories&symbol=BTCUSD.gdax&start_date=2019-12-01&end_date=2020-01-27&price_field=close_price&period=14&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_volume_categories&symbol=BTCUSD.gdax&start_date=2019-12-01&end_date=2020-01-27&price_field=close_price&period=14&key=your_api_key");
	if (response.IsSuccessStatusCode)
	{
		//Your custom response parser code
	}
}
Java
String uri = "https://www.cryptoquote.io/analytics/v1/?api=symbol_returns_volume_categories&symbol=BTCUSD.gdax&start_date=2019-12-01&end_date=2020-01-27&price_field=close_price&period=14&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_volume_categories&symbol=BTCUSD.gdax&start_date=2019-12-01&end_date=2020-01-27&price_field=close_price&period=14&key=your_api_key'))
obj <- fromJSON(json)
PHP
$url = 'https://www.cryptoquote.io/analytics/v1/?api=symbol_returns_volume_categories&symbol=BTCUSD.gdax&start_date=2019-12-01&end_date=2020-01-27&price_field=close_price&period=14&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_volume_categories&symbol=BTCUSD.gdax&start_date=2019-12-01&end_date=2020-01-27&price_field=close_price&period=14&key=your_api_key';
$.ajax({
		url: url,
		type: "GET",
		dataType: 'json'
}).done(function (data) {
	console.log(data);
});