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": 97055.23,
"open": 94238.27,
"high": 97800.8,
"low": 93975.12,
"previousClose": 94437.66,
"netChange": 2617.5699999999924,
"percentChange": 2.77,
"bid": 97051.09,
"ask": 97064.14,
"volume": 23130,
"serverTimestamp": "2024-11-21T01:15:39-06:00",
"tradeTimestamp": "2024-11-21T01:15:37-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>97055.23</lastPrice>
<open>94238.27</open>
<high>97800.8</high>
<low>93975.12</low>
<previousClose>94437.66</previousClose>
<netChange>2617.57</netChange>
<percentChange>2.77</percentChange>
<bid>97051.09</bid>
<ask>97064.14</ask>
<volume>23130</volume>
<serverTimestamp>2024-11-21T01:15:39-06:00</serverTimestamp>
<tradeTimestamp>2024-11-21T01:15:37-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","97055.23","94238.27","97800.8","93975.12","94437.66","2617.57","2.77","97051.09","97064.14","23130","2024-11-21T01:15:39-06:00","2024-11-21T01:15:37-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