Crypto Data API
getCrypto
The getCrypto API provides price data by symbol for spot market cryptocurrencies, including Bitcoin, Ethereum, Ripple, Litecoin and more. Bitcoin futures are available through getQuote. In addition to last price, other fields such as open, high, low, close, price change, percent change are available.
View All APIsContact Us to Get Access
Inputs
symbolsrequired
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
symbol
always returned
always returned
The symbol or code that identifies the cryptocurrency
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
name
always returned
always returned
The name that identifies the cryptocurrency
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
lastPrice
always returned
always returned
The last price the cryptocurrency traded at.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
open
always returned
always returned
The price at which the cryptocurrency opened for trading.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
high
always returned
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)
A numeric type defining a number with fractional parts. (example: 2.14)
low
always returned
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)
A numeric type defining a number with fractional parts. (example: 2.14)
previousClose
always returned
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)
A numeric type defining a number with fractional parts. (example: 2.14)
netChange
always returned
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)
A numeric type defining a number with fractional parts. (example: 2.14)
percentChange
always returned
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)
A numeric type defining a number with fractional parts. (example: 2.14)
bid
always returned
always returned
The current bid price.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
ask
always returned
always returned
The current ask price.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
volume
always returned
always returned
24 hour volume is composed of the exchanges included in our data feed and reflects the notional number of contracts traded in the prior rolling 24 hour window. Volume is measured in the asset found in the numerator of the pair.
int
A numeric type defining a whole number. (example: 2)
A numeric type defining a whole number. (example: 2)
serverTimestamp
always returned
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>.
A date and time in the format of YYYY-MM-DD HH:MI:SS<TIMEZONE_OFFSET>.
tradeTimestamp
always returned
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>.
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": 97475.03,
"open": 97854.78,
"high": 99575.21,
"low": 96483.69,
"previousClose": 97608.48,
"netChange": 852.3399999999965,
"percentChange": 0.88,
"bid": 97467.2,
"ask": 97510.09,
"volume": 7796,
"serverTimestamp": "2024-12-21T08:48:04-06:00",
"tradeTimestamp": "2024-12-21T08:48:03-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>97475.03</lastPrice>
<open>97854.78</open>
<high>99575.21</high>
<low>96483.69</low>
<previousClose>97608.48</previousClose>
<netChange>852.34</netChange>
<percentChange>0.88</percentChange>
<bid>97467.2</bid>
<ask>97510.09</ask>
<volume>7796</volume>
<serverTimestamp>2024-12-21T08:48:04-06:00</serverTimestamp>
<tradeTimestamp>2024-12-21T08:48:03-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","97475.03","97854.78","99575.21","96483.69","97608.48","852.34","0.88","97467.2","97510.09","7796","2024-12-21T08:48:04-06:00","2024-12-21T08:48:03-06:00"
PHP
<?php
$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');
$params = [
'apikey' => 'YOUR_API_KEY',
'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("YOUR_API_KEY", "^BTCUSD")
Perl
use SOAP::Lite;
use SOAP::WSDL;
my $ondemand = SOAP::Lite
-> service('https://ondemand.websol.barchart.com/service?wsdl');
my $result = $ondemand->getCrypto('YOUR_API_KEY', '^BTCUSD');
print $result;
Python
from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')
result = ondemand.service.getCrypto('YOUR_API_KEY', '^BTCUSD')
print(result)
Ruby
require 'savon'
ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')
response = ondemand.call(
:getCrypto,
message: {
apikey: 'YOUR_API_KEY',
symbols: '^BTCUSD',
}
)
response.body