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": 101481.96,
"open": 100026.91,
"high": 101846.61,
"low": 99274.49,
"previousClose": 99795.8,
"netChange": 1686.1700000000128,
"percentChange": 1.69,
"bid": 101478.66,
"ask": 101493.63,
"volume": 6031,
"serverTimestamp": "2024-12-13T14:01:58-06:00",
"tradeTimestamp": "2024-12-13T14:01:56-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>101481.96</lastPrice>
<open>100026.91</open>
<high>101846.61</high>
<low>99274.49</low>
<previousClose>99795.8</previousClose>
<netChange>1686.17</netChange>
<percentChange>1.69</percentChange>
<bid>101478.66</bid>
<ask>101493.63</ask>
<volume>6031</volume>
<serverTimestamp>2024-12-13T14:01:58-06:00</serverTimestamp>
<tradeTimestamp>2024-12-13T14:01:56-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","101481.96","100026.91","101846.61","99274.49","99795.8","1686.17","1.69","101478.66","101493.63","6031","2024-12-13T14:01:58-06:00","2024-12-13T14:01:56-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