Skip to content

L1 aggregated order book snapshot (Alpha)

SEND Server to Client on wss://api.valr.com/ws/trade

(Alpha) Level 1 aggregated order book snapshot. Sent once on subscription, followed by OB_L1_DIFF messages for incremental updates. Uses a compressed wire format with shortened keys for efficiency.

Compressed key mapping:

  • ps = currencyPairSymbol
  • d = data
  • lc = LastChange
  • a = Asks (array of [price, quantity] arrays)
  • b = Bids (array of [price, quantity] arrays)
  • sq = SequenceNumber
  • cs = Checksum

Subscription

This event requires an explicit subscription. Send a SUBSCRIBE message after connecting:

json
{
    "type": "SUBSCRIBE",
    "subscriptions": [
        {
            "event": "OB_L1_SNAPSHOT"
        }
    ]
}

Message

Event type: OB_L1_SNAPSHOT

Example

json
"{\n    \"type\": \"OB_L1_SNAPSHOT\",\n    \"ps\": \"BTCUSDC\",\n    \"d\": {\n        \"lc\": 1644301604645,\n        \"a\": [\n            [\"45363\", \"0.01102078\"],\n            [\"45364\", \"0.00200000\"]\n        ],\n        \"b\": [\n            [\"45147\", \"0.011\"],\n            [\"45100\", \"0.5\"]\n        ],\n        \"sq\": 5,\n        \"cs\": 1234567890\n    }\n}"

Channel

Channel: trade Address: wss://api.valr.com/ws/trade