getCrypto API

The getCrypto API provides price data by symbol for cryptocurrencies. In addition to last price, other fields such as open, high, low, close, price change, percent change are available.

All APIs

Contact Us to Get Access

Inputs

symbols required

A valid cryptocurrency symbol. Multiple symbols separated by a comma may be used.

Type
list (A comma or semi-colon delimited string.) 
Example
^BTCUSD 

Outputs

Name / Requirement
Description
Type
symbol
always returned
The symbol or code that identifies the cryptocurrency
string
A sequence of characters. (example: GOOG)
name
always returned
The name that identifies the cryptocurrency
string
A sequence of characters. (example: GOOG)
lastPrice
always returned
The last price the cryptocurrency traded at.
double
A numeric type defining a number with fractional parts. (example: 2.14)
open
always returned
The price at which the cryptocurrency opened for trading.
double
A numeric type defining a number with fractional parts. (example: 2.14)
high
always returned
The highest price at which the cryptocurrency traded for the session.
double
A numeric type defining a number with fractional parts. (example: 2.14)
low
always returned
The lowest price at which the cryptocurrency traded for the session.
double
A numeric type defining a number with fractional parts. (example: 2.14)
previousClose
always returned
The price at which the cryptocurrency closed the previous trade day.
double
A numeric type defining a number with fractional parts. (example: 2.14)
netChange
always returned
The price change between the last price and previous close price.
double
A numeric type defining a number with fractional parts. (example: 2.14)
percentChange
always returned
The percent change between the last price and previous close price.
double
A numeric type defining a number with fractional parts. (example: 2.14)
bid
always returned
The current bid price.
double
A numeric type defining a number with fractional parts. (example: 2.14)
ask
always returned
The current ask price.
double
A numeric type defining a number with fractional parts. (example: 2.14)
volume
always returned
24 hour volume is composed of the exchanges included in our data feed and reflects the notional USD traded in that rolling 24 hour window
int
A numeric type defining a whole number. (example: 2)
serverTimestamp
always returned
The time the message was generated on the server.
dateTime
A date and time in the format of YYYY-MM-DD HH:MI:SS<TIMEZONE_OFFSET>.
tradeTimestamp
always returned
The exchange timestamp for the last traded price.
dateTime
A date and time in the format of YYYY-MM-DD HH:MI:SS<TIMEZONE_OFFSET>.

Status Code Responses

200
OK
Success
400
Bad Request
The request was invalid, please see the message for more information.
500
Internal Server Error
Something is not working correctly, please contact support.


JSON

GET

GET https://ondemand.websol.barchart.com/getCrypto.json?apikey=<YOUR API KEY>&symbols=%5EBTCUSD
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getCrypto.json
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=<YOUR API KEY>&symbols=%5EBTCUSD

Response

{
    "status": {
        "code": 200,
        "message": "Success."
    },
    "results": [
        {
            "symbol": "^BTCUSD",
            "name": "Bitcoin - USD",
            "lastPrice": 7842.8,
            "open": 7895.86,
            "high": 8011.19,
            "low": 7522.16,
            "previousClose": 7895.76,
            "netChange": -52.96,
            "percentChange": -0.67,
            "bid": 7838.53,
            "ask": 7843.69,
            "volume": 196135,
            "serverTimestamp": "2017-11-17T04:47:34-06:00",
            "tradeTimestamp": "2017-11-17T04:47:34-06:00"
        }
    ]
}

XML

GET

GET https://ondemand.websol.barchart.com/getCrypto.xml?apikey=<YOUR API KEY>&symbols=%5EBTCUSD
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getCrypto.xml
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=<YOUR API KEY>&symbols=%5EBTCUSD

Response


<?xml version="1.0" encoding="utf-8"?>
 <getCrypto>
  <status>
   <code>200</code>
   <message>Success.</message>
  </status>
  <item>
   <symbol>^BTCUSD</symbol>
   <name>Bitcoin - USD</name>
   <lastPrice>7842.8</lastPrice>
   <open>7895.86</open>
   <high>8011.19</high>
   <low>7522.16</low>
   <previousClose>7895.76</previousClose>
   <netChange>-52.96</netChange>
   <percentChange>-0.67</percentChange>
   <bid>7838.53</bid>
   <ask>7843.69</ask>
   <volume>196135</volume>
   <serverTimestamp>2017-11-17T04:47:34-06:00</serverTimestamp>
   <tradeTimestamp>2017-11-17T04:47:34-06:00</tradeTimestamp>
  </item>
 </getCrypto>

CSV

GET

GET https://ondemand.websol.barchart.com/getCrypto.csv?apikey=<YOUR API KEY>&symbols=%5EBTCUSD
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getCrypto.csv
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=<YOUR API KEY>&symbols=%5EBTCUSD

Response

symbol,name,lastPrice,open,high,low,previousClose,netChange,percentChange,bid,ask,volume,serverTimestamp,tradeTimestamp
"^BTCUSD","Bitcoin - USD","7842.8","7895.86","8011.19","7522.16","7895.76","-52.96","-0.67","7838.53","7843.69","196135","2017-11-17T04:47:34-06:00","2017-11-17T04:47:34-06:00"


PHP

<?php

$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');

$params = [
    'symbols' => '^BTCUSD',
];

$result = $ondemand->getCrypto($params);
var_dump($result);

Classic ASP

Dim ondemand
Dim result

Set ondemand = Server.CreateObject("MSSOAP.SoapClient30")
ondemand.ClientProperty("ServerHTTPRequest") = True
ondemand.MSSoapInit("https://ondemand.websol.barchart.com/service?wsdl")

Set result = ondemand.getCrypto("^BTCUSD")

Perl

use SOAP::Lite;
use SOAP::WSDL;

my $ondemand = SOAP::Lite
    -> service('https://ondemand.websol.barchart.com/service?wsdl');

my $result = $ondemand->getCrypto('^BTCUSD');

print $result;

Python

from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')

result = client.service.getCrypto('^BTCUSD')

print result

Ruby

require 'savon'

ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')

response = ondemand.call(
    :getCrypto,
    message: {
        symbols: '^BTCUSD',
    }
)

response.body