Prices
Last updated
Last updated
Our API exposes a WebSocket based endpoint which allows partners to subscribe to an incoming stream of digital asset prices.
After establishing an HTTPS connection to endpoint
the client is expected to upgrade the connection to WebSocket protocol (a step handled automatically by most WebSocket client libraries).
After a successful upgrade the client is expected to send a single PRICE_SUBSCRIPTION
message, specifying which fiat currency/digital asset pair prices are supposed to be streamed. Attribute markets
is optional and if omitted will indicate that the subscription should include all EUR
and cryptoSymbol
pairs supported by the platform.
Upon successful processing of the PRICE_SUBSCRIPTION
message the server will begin to produce PRICES
messages containing array of sets of Asks and Bids for requested currency
/ cryptoSymbol
pair.
This stream of messages will continue until an error is encountered or either the client or server terminate the connection.
To maintain the session, our prices provider service, server will send PRICES
message every second with empty asks
and bids
arrays in market if no price change.
If at any point in time an error is encountered, the server will send a single ERROR
message and will immediately close the connection:
The connectionId
attribute is meant to be used as a reference identifier provided to us if there is a need to investigate a specific error occurence.
Once the PRICE_SUBSCRIPTION
message has been processed and PRICES
messages start to flow the server does not expect to receive any additional
messages. If the client would like to modify the list of subscribed assets then a new connection should be established and a new PRICE_SUBSCRIPTION
message should be sent.
The client should assume that the WebSocket connection might be closed by the server at any time and in such case a new connection should be established again.
Example communication diagram
These structures serve as wrappers to all current and future message types and for consumer's convenience their content
can always be differentiated by value of TYPE
attribute (PRICES_SUBSCRIPTION
, PRICES
, ERROR
) and its accompanying blocks.
Our OpenAPI specification contains definitions of both request and response messages used by the endpoint: