Historical Data
Please note that Alpaca Crypto Data is in beta - we welcome any feedback to improve our offering.
Alpaca provides crypto data from multiple venues and does not route orders to all venues even though it offers data.
List of crypto exchanges which are supported by Alpaca.
Exchange Code | Name of Exchange |
---|---|
CBSE | Coinbase |
ERSX | ErisX |
FTX | FTX |
Common behavior
Base URL
The Crypto Data API provides historical data through multiple endpoints. These endpoints have the same URL prefix (omitted from now on):
https://data.alpaca.markets/v1beta1/crypto
This URL is the same for both subscription plans, there is no limitation
Authentication The authentication is done the same way as with the Trading API, simply set the following HTTP headers:
APCA-API-KEY-ID
APCA-API-SECRET-KEY
Limiting
Use the limit
query parameter. The value should be in the range 1 - 10000 (endpoints included) with 1000 being the default if unspecified.
Paging
To support querying long timespans continuously we support paging in our API. If the result you have received contains a next_page_token
that is not null
there may be more data available in the timeframe you have chosen. Include the token you have received as the page_token
query parameter for the next request you make while leaving the other parameters unchanged to continue where the previous response left off.
Ordering
The results are ordered in ascending order by time.
Timestamps
The timestamps for trades, quotes, and bars correspond to when a trade was executed or a quote was generated on the exchange or OTC desk.
Trades
The Trades API provides historcial trade data for a given crypto symbol on a specified date.
[GET] Returns trades for the queried crypto symbol
Parameters
Path Parameters
Query Parameters
Response
A trades response object.Errors
Response
{
"trades": [
{
"t": "2021-04-01T00:00:00.348Z",
"x": "CBSE",
"p": 58800.01,
"s": 8.473e-05,
"tks": "B",
"i": 151521553
},
...
],
"symbol": "BTCUSD",
"next_page_token": "QlRDVVNEfDIwMjEtMDQtMDFUMDA6MDI6MTcuMDc0MDAwMDAwWnxDQlNFfDA5MjIzMzcyMDM3MDA2Mjk4MzYw"
}
Properties
Latest trade
The Latest trade API provides the latest trade data for a given crypto symbol.
[GET] Returns latest trade for the queried crypto symbol
Parameters
Path Parameters
Query Parameters
Response
A Trade response object.Errors
Response
{
"symbol": "BTCUSD",
"trade": {
"t": "2021-09-18T11:14:46.80939002Z",
"x": "ERSX",
"p": 48577.3,
"s": 1.3003,
"tks": "B",
"i": 0
}
}
Properties
Quotes
The Quotes API provides quotes for a given crypto symbol at a specified date.
[GET] Returns quotes for the queried crypto symbol
Parameters
Path Parameters
Query Parameters
Response
A quotes response object.Errors
Response
{
"quotes": [
{
"t": "2021-04-01T00:00:10.495Z",
"x": "CBSE",
"bp": 58798.69,
"bs": 0.12,
"ap": 58805.39,
"as": 0.0131436
},
...
],
"symbol": "BTCUSD",
"next_page_token": "QlRDVVNEfDIwMjEtMDQtMDFUMDg6NDg6NTYuODUyMDAwMDAwWnxDQlNFfDY2OTBCRkQ1"
}
Properties
Latest quote
The Latest quote API provides the latest quote data for a given ticker symbol.
[GET] Returns latest quote for the queried crypto symbol
Parameters
Path Parameters
Query Parameters
Response
A quotes response object.Errors
Response
{
"symbol": "BTCUSD",
"quote": {
"t": "2021-09-18T11:32:24.108Z",
"x": "ERSX",
"bp": 48132.12,
"bs": 0.5456,
"ap": 49126.6,
"as": 0.7596
}
}
Properties
Bars
The Bars API returns aggregate historical data for the requested securities.
[GET] Returns bars for the queried crypto symbol
Parameters
Path Parameters
Query Parameters
1Min
, 15Min
, 1Hour
, 1Day
. Limits: 1Min-59Min, 1Hour-23Hour.Response
A bars response object.Errors
Response
{
"bars": [
{
"t": "2021-04-01T00:00:00Z",
"x": "CBSE",
"o": 58800.01,
"h": 58838,
"l": 58756.07,
"c": 58837.71,
"v": 9.43435863,
"n": 375,
"vw": 58792.3224699778
},
...
],
"symbol": "BTCUSD",
"next_page_token": "QlRDVVNEfE18MjAyMS0wNC0wMVQxNjozOTowMC4wMDAwMDAwMDBafENCU0U="
}
Properties
XBBO
The XBBO API best bid and offer across venues.
[GET] Returns latest Cross Best Bid and Offer for the queried crypto symbol.
Parameters
Path Parameters
Query Parameters
Response
A quotes response object.Errors
Response
{
"t": "2021-08-30T14:25:35.129Z",
"ax": "ERSX",
"ap": 48025.71,
"as": 1.122,
"bx": "CBSE",
"bp": 47845.81,
"bs": 1.65113,
}