LogoLogo
  • Home Page
  • Documentation
    • API Overview
    • Partner API Authentication
    • Onboarding
    • Partner Webhooks
    • Status Codes for Financial Operations
    • Prices
  • WEBSOCKETS
    • Websocket Prices
      • Prices
      • Schemas
  • API REFERENCE
    • Authorization
      • Schemas
    • User Management
      • Users
      • Schemas
    • Customers
      • General
      • Legal Entities
      • Natural Persons
      • Customer Labels
      • Search Nace Sectors
      • Onboarding Wizard
      • Schemas
    • Documents
      • Documents
      • Schemas
    • Onboardings
      • Onboarding
      • Offboarding
      • Schemas
    • Products
      • General
      • Schemas
    • Asset Management
      • Trading
        • Assets
        • Schemas
      • Digital assets
        • Create Order
        • General
        • Assets
        • Schemas
      • Strategy
        • Schemas
    • Transaction History
      • Schemas
    • Transfers
      • General
      • Create Incoming Test Transfer
      • Schemas
    • Partner Documents
      • Schemas
    • Webhooks
      • Schemas
  • PARTNER APIS
    • Partner Webhooks
      • Schemas
Powered by GitBook
On this page
  • Communication Diagram
  • OpenAPI models
  1. Documentation

Prices

Last updated 6 days ago

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.

{
  "type": "PRICE_SUBSCRIPTION",
  "priceSubscription": {
    "markets": [
      {
        "currency": "EUR",
        "cryptoSymbol": "BTC"
      },
      {
        "currency": "EUR",
        "cryptoSymbol": "ETH"
      }
    ]
  }
}

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.

{
  "type": "PRICES",
  "prices": [
    {
      "market": {
        "currency": "EUR",
        "cryptoSymbol": "BTC"
      },
      "time": "2024-07-10T08:01:22.783+02:00",
      "asks": [
        {
          "price": "54577.54",
          "quantity": "0.01832255"
        },
        {
          "price": "54578.84",
          "quantity": "0.07328847"
        },
        ...
      ],
      "bids": [
        {
          "price": "54564.14",
          "quantity": "0.01832705"
        },
        {
          "price": "54559.06",
          "quantity": "0.07331504"
        },
        ...
      ]
    },
    ...
  ]
}

If at any point in time an error is encountered, the server will send a single ERROR message and will immediately close the connection:

{
  "type": "ERROR",
  "error": "Error message",
  "connectionId": "0116ec3f-6237-4c13-97b0-c3de46c5f6f1"
}

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.

Communication Diagram

Example communication diagram

OpenAPI models

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:

WebSocketResponse
WebSocketRequest
WebSocketResponse
Websocket Prices
WebSocketRequest
WebSocketResponse
Websocket Prices