Historical Crypto Data #
Looking for the old v1beta1 or v1beta2 endpoints?
The v1beta1 and v1beta2 endpoints were marked deprecated, and will be removed shortly. Please use the latest v1beta3 endpoints.
If you still need the reference to the older versions, you can find them here: v1beta1, v1beta2.
How is v1beta3 different from v1beta2?
Since Alpaca now executes your crypto orders in its own exchange, the v1beta3 crypto market data endpoints no longer distribute data from other providers, but from Alpaca itself.
The orderbooks and quotes are the actual orderbooks / top of orderbooks of the Alpaca exchange. The trades and the bars generated from them include all the trades executed on the Alpaca exchange. However, for better data quality and in order to provide historical data before the Alpaca exchange started, they are enriched by other providers as well.
Moreover, you may notice that the URL now includes a required path parameter: the crypto feed. So for example
/v1beta1/crypto/trades
becomes/v1beta3/crypto/us/trades
. We’re planning to extend our offering with other feeds in the future, but for now,us
is the only possible option there.
Trades #
The crypto trades API provides historical trade data for a list of crypto symbols between the specified dates.
Returns trades for the queried crypto symbols
GET /v1beta3/crypto/us/trades
next_page_token
you will eventually reach the next symbols if any trades were found for them.
Parameters
Query Parameters
Attribute | Type | Requirement | Description |
---|---|---|---|
symbols |
string | Required |
Comma separated list of symbols. |
start |
string | Optional |
The inclusive start of the interval. Format RFC-3339 or YYYY-MM-DD. If missing, the default value is the beginning of the current dayin Central Time. |
end |
string | Optional |
The inclusive end of the interval. Format RFC-3339 or YYYY-MM-DD. If missing, the default value is the current time. |
limit |
int | Optional |
Number of maximum data points to return in a response. The limit applies to the total number of data points, not per symbol! You can use the next_page_token to fetch the next at most limit responses. |
page_token |
string | Optional |
Pagination token to continue from. The value to pass here is returned in specific requests when more data is available than the request limit allows. |
Response
A trades response object.Errors #
400 - Bad Request
One of the request parameters is invalid. See the returned message for details
404 - Not found
The requested object was not found.
Response #
{
"next_page_token": null,
"trades": {
"BTC/USD": [
{
"i": 6350104,
"p": 26278.36,
"s": 0.00076,
"t": "2023-03-17T10:00:00.265Z",
"tks": "B"
}
],
"ETH/USD": [
{
"i": 3354481,
"p": 1722.24,
"s": 0.0007,
"t": "2023-03-17T10:00:00.694Z",
"tks": "B"
}
]
}
}
Properties #
Attribute | Type | Description |
---|---|---|
t |
string | Timestamp in RFC-3339 format with nanosecond precision. |
p |
number | Trade price. |
s |
double | Trade size. |
tks |
string | TakerSide of the trade (buy, sell, or unspecified) |
i |
int | Trade ID. |
Latest Trade #
The Latest trade API provides the latest trade data for given crypto symbols.
Returns latest trade for the queried crypto symbols
GET /v1beta3/crypto/us/latest/trades
Parameters
Query Parameters
Attribute | Type | Requirement | Description |
---|---|---|---|
symbols |
string | Required |
Comma separated list of symbols. |
Response
A Trade response object.Errors #
400 - Bad Request
One of the request parameters is invalid. See the returned message for details
404 - Not found
The requested object was not found.
Response #
{
"trades": {
"SOL/USD": {
"i": 354445,
"p": 20.59,
"s": 4,
"t": "2023-03-17T12:10:27.492Z",
"tks": "S"
},
"BTC/USD": {
"i": 6399686,
"p": 26802.45,
"s": 0.00024,
"t": "2023-03-17T12:10:43.116Z",
"tks": "B"
},
"ALGO/USD": {
"i": 64965,
"p": 0.2189,
"s": 9,
"t": "2023-03-17T12:10:07.848Z",
"tks": "B"
}
}
}
Properties #
Attribute | Type | Description |
---|---|---|
t |
string | Timestamp in RFC-3339 format with nanosecond precision. |
p |
number | Trade price. |
s |
double | Trade size. |
tks |
string | TakerSide of the trade (buy, sell, or unspecified) |
i |
int | Trade ID. |
Quotes #
Unlike the previous versions, v1beta3 no longer offers historical quotes. If you feel like they would be a must for you, let us know!
Latest Quote #
The Latest Quote API provides the latest quote data for given ticker symbols.
Returns latest quotes for the queried crypto symbols
GET /v1beta3/crypto/us/latest/quotes
Parameters
Query Parameters
Attribute | Type | Requirement | Description |
---|---|---|---|
symbols |
string | Required |
Comma separated list of symbols. |
Response
A quotes response object.Errors #
400 - Bad Request
One of the request parameters is invalid. See the returned message for details
404 - Not found
The requested object was not found.
Response #
{
"quotes": {
"ETH/USD": {
"ap": 1755.243,
"as": 3.2423141,
"bp": 1753.118,
"bs": 3.21233921,
"t": "2023-03-17T12:08:19.610856898Z"
},
"BTC/USD": {
"ap": 26850.99769,
"as": 0.26342221,
"bp": 26819.2226552,
"bs": 0.26101472,
"t": "2023-03-17T12:08:22.700343417Z"
}
}
}
Properties #
Attribute | Type | Description |
---|---|---|
t |
string | Timestamp in RFC-3339 format with nanosecond precision. |
ap |
number | Ask price. |
as |
int | Ask size. |
bp |
number | Bid price. |
bs |
int | Bid size. |
Bars #
The crypto bars API provides historical bars aggregates for a list of crypto symbols between the specified dates.
Returns bars for the queried crypto symbols
GET /v1beta3/crypto/us/bars
next_page_token
you will eventually reach the next symbols if any bars were found for them.
Parameters
Query Parameters
Attribute | Type | Requirement | Description |
---|---|---|---|
symbols |
string | Required |
Comma separated list of symbols. |
timeframe |
string | Required |
The timeframe of the bar aggregation. 5Min for example creates 5 minute aggregates. You can use the following values: - [1-59]Min / T - [1-23]Hour / H - 1Day / D - 1Week / W - [1,2,3,4,6,12]Month / M |
start |
string | Optional |
The inclusive start of the interval. Format RFC-3339 or YYYY-MM-DD. If missing, the default value is the beginning of the current day in Central Time. |
end |
string | Optional |
The inclusive end of the interval. Format RFC-3339 or YYYY-MM-DD. If missing, the default value is the current time. |
limit |
int | Optional |
Number of maximum data points to return in a response. The limit applies to the total number of data points, not per symbol! You can use the next_page_token to fetch the next at most limit responses. |
page_token |
string | Optional |
Pagination token to continue from. The value to pass here is returned in specific requests when more data is available than the request limit allows. |
Response
A bars response object.Errors #
400 - Bad Request
One of the request parameters is invalid. See the returned message for details
404 - Not found
The requested object was not found.
Response #
{
"bars": {
"BTC/USD": [
{
"c": 26104.97,
"h": 26106.24,
"l": 26081.73,
"n": 91,
"o": 26101.99,
"t": "2023-03-17T08:00:00Z",
"v": 1.91233,
"vw": 26097.8321098346
}
]
},
"next_page_token": "QlRDL1VTRHxNfDIwMjMtMDMtMTdUMDg6MDA6MDAuMDAwMDAwMDAwWg=="
}
Properties #
Attribute | Type | Description |
---|---|---|
bars |
object | Bars object. |
t |
string | Timestamp in RFC-3339 format with nanosecond precision. |
o |
number | Open price. |
h |
number | High price. |
l |
number | Low price. |
c |
number | Close price. |
v |
int | Volume. |
n |
int | Number of trades. |
vw |
number | Volume weighted average price. |
Latest Bars #
The Latest Bars API returns aggregate historical data for the requested crypto symbols.
Returns latest bars for the queried crypto symbol
GET /v1beta3/crypto/us/latest/bars
Parameters
Query Parameters
Attribute | Type | Requirement | Description |
---|---|---|---|
symbols |
string | Required |
Comma separated list of symbols. |
Response
A quotes response object.Errors #
400 - Bad Request
One of the request parameters is invalid. See the returned message for details
404 - Not found
The requested object was not found.
Response #
{
"bars": {
"BTC/USD": {
"c": 26777.16,
"h": 26822.41,
"l": 26775.63,
"n": 227,
"o": 26796.99,
"t": "2023-03-17T12:12:00Z",
"v": 10.055751343,
"vw": 26802.668632937
},
"DOGE/USD": {
"c": 0.0752,
"h": 0.0752,
"l": 0.0752,
"n": 4,
"o": 0.0752,
"t": "2023-03-17T12:12:00Z",
"v": 11894,
"vw": 0.0752
}
}
}
Properties #
Attribute | Type | Description |
---|---|---|
bars |
object | Bars object. |
t |
string | Timestamp in RFC-3339 format with nanosecond precision. |
o |
number | Open price. |
h |
number | High price. |
l |
number | Low price. |
c |
number | Close price. |
v |
int | Volume. |
n |
int | Number of trades. |
vw |
number | Volume weighted average price. |
Snapshot #
The Snapshot API returns the latest trade, latest quote, latest minute bar, latest daily bar, and previous daily bar data for crypto symbols.
Returns the snapshot for the queried crypto symbol.
GET /v1beta3/crypto/us/snapshots
Parameters
Query Parameters
Attribute | Type | Requirement | Description |
---|---|---|---|
symbols |
string | Required |
Comma separated list of symbols. |
Response
A snapshot response object.Errors #
400 - Bad Request
One of the request parameters is invalid. See the returned message for details
404 - Not found
The requested object was not found.
Response #
{
"snapshots": {
"ETH/USD": {
"dailyBar": {
"c": 1750.87,
"h": 1766.455819,
"l": 1697.37,
"n": 21743,
"o": 1704.1,
"t": "2023-03-17T05:00:00Z",
"v": 20335.1255272,
"vw": 1727.3249410664
},
"latestQuote": {
"ap": 1751.7355498,
"as": 3.19828904,
"bp": 1749.5599,
"bs": 3.20802956,
"t": "2023-03-17T12:14:23.100393714Z"
},
"latestTrade": {
"i": 3364327,
"p": 1750.98,
"s": 0.4498,
"t": "2023-03-17T12:14:26.936Z",
"tks": "B"
},
"minuteBar": {
"c": 1750.87,
"h": 1751.6,
"l": 1749.8,
"n": 81,
"o": 1751.59,
"t": "2023-03-17T12:13:00Z",
"v": 59.2298,
"vw": 1750.4146159703
},
"prevDailyBar": {
"c": 1705.19,
"h": 1730,
"l": 1641.36,
"n": 93298,
"o": 1645.97,
"t": "2023-03-16T05:00:00Z",
"v": 78992.459481654,
"vw": 1670.3839444467
}
}
}
}
Properties #
Attribute | Type | Description |
---|---|---|
symbol |
string | Symbol that was queried for. |
latestTrade |
object | Latest trade object. |
latestQuote |
object | Latest quote object. |
minuteBar |
object | Minute bar object. |
dailyBar |
object | Daily bar object. |
prevDailyBar |
object | Previous daily close bar object. |
Latest Orderbook #
The Latest Orderbook API returns the latest orderbook for crypto symbols.
Returns latest orderbook for the queried crypto symbols
GET /v1beta3/crypto/us/latest/orderbooks
Parameters
Query Parameters
Attribute | Type | Requirement | Description |
---|---|---|---|
symbols |
string | Required |
Comma separated list of symbols. |
Response
A orderbooks response object.Errors #
400 - Bad Request
One of the request parameters is invalid. See the returned message for details
404 - Not found
The requested object was not found.
Response #
{
"orderbooks": {
"BAT/USD": {
"a": [
{"p": 0.2489367, "s": 7001.272274},
{"p": 0.2506, "s": 14116.439117},
{"p": 0.2523294, "s": 21024.138872},
{"p": 0.3073, "s": 400},
{"p": 0.34255, "s": 10542},
{"p": 0.3627, "s": 350},
{"p": 1.2, "s": 42}
],
"b": [
{"p": 0.24810475, "s": 6985.022789},
{"p": 0.246451, "s": 14019.5712199},
{"p": 0.244772, "s": 21293.95058047},
{"p": 0.23255, "s": 50},
{"p": 0.229675, "s": 50},
{"p": 0.227775, "s": 75},
{"p": 0.2256, "s": 75},
{"p": 0.223325, "s": 300},
{"p": 0.222625, "s": 75},
{"p": 0.220525, "s": 100},
{"p": 0.21835, "s": 123},
{"p": 0.21685, "s": 143},
{"p": 0.214275, "s": 200},
{"p": 0.2114, "s": 200},
{"p": 0.209825, "s": 250},
{"p": 0.208425, "s": 600},
{"p": 0.207925, "s": 300},
{"p": 0.20575, "s": 300},
{"p": 0.202975, "s": 300},
{"p": 0.200375, "s": 200},
{"p": 0.1985, "s": 441},
{"p": 0.1976, "s": 65},
{"p": 0.19285, "s": 431},
{"p": 0.17865, "s": 1400},
{"p": 0.168725, "s": 200},
{"p": 0.1588, "s": 300},
{"p": 0.15225, "s": 400},
{"p": 0.142025, "s": 700},
{"p": 0.1331, "s": 1000},
{"p": 0.09925, "s": 1234}
],
"t": "2023-03-17T12:15:32.272473264Z"
}
}
}
Properties #
Attribute | Type | Description |
---|---|---|
t |
string | Timestamp in RFC-3339 format with nanosecond precision. |
b |
array | Bids |
a |
array | Asks |