Stream prices (WebSocket)

GET
/ws

The Hermes WebSocket protocol. Open the socket with a GET upgrade, then send JSON text messages:

  • {"type":"subscribe","ids":[…],"verbose":false,"binary":false,"ignore_invalid_price_ids":false} is answered {"type":"response","status":"success"}, then the last value of each feed and every later update arrive as {"type":"price_update","price_feed":{…}}.
  • {"type":"unsubscribe","ids":[…]} is answered the same way.
  • A malformed message, an unknown type, an unknown or malformed ID, or more than 500 IDs is answered {"type":"response","status":"error","error":"…"}; the socket stays open.

IDs travel in the message body, so a subscription is not bound by the URL length: this is the way to follow more than 200 feeds on one connection.

verbose adds metadata to each price_feed, binary adds an empty vaa. allow_out_of_order is accepted and changes nothing. The server pings every 30 seconds and closes the socket after 24 hours (1000), when the client sends more than 5 messages per second with a burst of 20 or stops reading (1008), and when it restarts (1001). A message is at most 64 KiB.

Query Parameters

channel?string

Update cadence of the SSE stream and the WebSocket. A fixed-rate channel sends a feed at most once per tick, only when it changed. fixed_rate@50ms is refused. Validated and ignored on the other routes.

Default"fixed_rate@1000ms"

Value in

  • "real_time"
  • "fixed_rate@200ms"
  • "fixed_rate@1000ms"

Response Body

text/plain

text/plain

text/plain

curl -X GET "https://example.com/ws"
Empty