Skip to main content
The Anchorage Digital WebSocket API supports the WebSocket protocol for real-time market data. Endpoint: wss://api.anchorage.com/ws/v2/trading

Protocol

This WebSocket API uses a bidirectional protocol that encodes all messages as JSON objects. Each message includes a messageType attribute for handling message types appropriately.

Subscribe

Send a subscribe message with the appropriate messageType to specify which channel you want to receive.

Customer-specific market data

Subscribes to market data scoped to a specific account or subaccount by passing either the optional accountId or subaccountId field. By account:
{
  "messageType": "MarketDataSnapshotRequest",
  "timestamp": "2023-01-24T08:22:18.598364",
  "payload": {
    "type": "subscribe",
    "symbol": "BTC-USD",
    "reqId": "0d921bca-6599-4841-95ee-7b6984e2486f",
    "accountId": "f7823b57-aeb2-11f0-a565-3ecdccd5480d"
  }
}
By subaccount:
{
  "messageType": "MarketDataSnapshotRequest",
  "timestamp": "2023-01-24T08:22:18.598364",
  "payload": {
    "type": "subscribe",
    "symbol": "BTC-USD",
    "reqId": "0d921bca-6599-4841-95ee-7b6984e2486f",
    "subaccountId": "5db3bae2-c3c6-4d7d-97af-47c923135661"
  }
}
FieldTypeRequiredDescription
symbolstringYesTrading pair, e.g. BTC-USD
reqIdstring (UUID)YesUnique request ID for this subscription
accountIdstring (UUID)NoScopes the feed to a specific account. Use either accountId or subaccountId, not both.
subaccountIdstring (UUID)NoScopes the feed to a specific subaccount. Use either accountId or subaccountId, not both.
subaccountId applies to RIA customers only.

Global market data

Subscribes to market data without any account filter. All participants receive the same feed.
{
  "messageType": "MarketDataSnapshotRequest",
  "timestamp": "2023-01-24T08:22:18.598364",
  "payload": {
    "type": "subscribe",
    "symbol": "BTC-USD",
    "reqId": "0d921bca-6599-4841-95ee-7b6984e2486f"
  }
}

Unsubscribe

To unsubscribe from a channel, send an unsubscribe message with the same symbol. The reqId does not need to match the original subscription request.
{
  "messageType": "MarketDataSnapshotRequest",
  "timestamp": "2023-01-24T09:04:57.146353",
  "payload": {
    "type": "unsubscribe",
    "symbol": "BTC-USD",
    "reqId": "88f401f3-f0d1-4f1d-85cc-3d0b377e8c9a"
  }
}

Sequence numbers

Messages include a sequence number: an incrementing integer starting at 1. Each message is exactly one greater than the previous.

Supported channels

ChannelDescription
MarketDataSnapshotRequestMarket depth updates