Market Data Feed
Cryptocurrency market data feed process
Overview
Bakkt provides a data feed via websocket connection for live cryptocurrency market data. Clients can use the data feed to stream cryptocurrency quotes directly to investors via their application.
Workflow
Get the Authorization Token
- Prior to retrieving the market data feed, clients must get an authorization token using the Request Authorization Token (i.e., Login) endpoint. The token allows clients to successfully use the Request Websockets and Transfer Status URLs (i.e., Configuration) endpoint.
curl -X 'POST' \
'https://XXXX-api.uat.apexcrypto.com/apex-crypto/api/v2/login' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"logonId": "username",
"password": "password"
}'
{
"token": "XbifasdSFD0EiJRnPJQqwRcqduFStK7svPTLge_sQ"
}
Connect to the Websocket
- Client platforms can consume the market data by connecting to a websocket. Clients need a framework to handle the JSON serialization to communicate with the Market Data Session (e.g., Twirp).
Receive the Market Data URL
- Clients only need to retrieve the Market Data WebSocket URL for this information once. The streaming data feed provides investors with current market data regarding cryptocurrency including the symbol and current price. The Request Websockets and Transfer Status URLs endpoint provides clients with the cryptocurrency market data to provide to investors.
curl -X 'POST' \
'https://xxxx-api.uat.apexcrypto.com/apex-crypto/api/v2/config'\
-H 'accept: application/json' \
-H 'Authorization: "XbifasdSFD0EiJRnPJQqwRcqduFStK7svPTLge_sQ"'\
-H 'Content-Type: application/json' \
-d '{}'
{
"streamingOrderEntryEventUrl": "wss://xxxx-api.uat.apexcrypto.com/socket/order_entry/events",
"streamingQuoteUrl": "wss://xxxx-api.uat.apexcrypto.com/socket/quotes",
"streamingTransferStatusUrl": "wss://xxxx-api.uat.apexcrypto.com/socket/transfers/status"
}
Use the Websocket Stream via Command Line
- Users can then use the Market Data Websocket URL in a command line to view the cryptocurrency streaming output including symbol, current price, bid size, asking prize and amount, along with a timestamp of the feed.
wscat -c wss://xxx-api.uat.apexcrypto.com/socket/quotes?token=XbifasdSFD0EiJRnPJQqwRcqduFStK7svPTLge_sQ
Connected (press CTRL+C to quit)
{"symbol":"GRTUSD","bid_price":"0.43513","bid_size":"4000","ask_price":"0.44456","ask_size":"4000","timestamp":"2022-02-18T10:38:26.342428354Z"}
{"symbol":"DASHUSD","bid_price":"107.77","bid_size":"20","ask_price":"110.2","ask_size":"20","timestamp":"2022-02-18T10:38:26.398695727Z"}
Websocket Drivers
The following list provides links to commonly-used websocket drivers for more popular programming languages.
Updated 10 months ago