Skip to main content

WebSocket Guide

Overview​

The BlockWyre platform provides a WebSocket API that allows you to receive real-time market data. By connecting to the WebSocket endpoint, you can subscribe to specific currency pairs and receive live updates on market prices.

Connecting to the WebSocket​

Endpoint​

To connect to the WebSocket API, use the following endpoint:

Endpoint

WSS

/api/v1/market

Authentication​

You must include your API key as a query parameter when connecting to the WebSocket endpoint. The connection URL should look like this:

/api/v1/market?Authorization={apiKey}

Example Connection URL​

wss://api.blockwyre.com/api/v1/market?Authorization={apiKey}

Subscribing to Market Data​

Once connected to the WebSocket, you need to subscribe to the desired currency pairs to receive real-time updates.

Subscription Payload​

Send the following payload to subscribe to specific currency pairs:

{
"type": "subscribe",
"products": ["BTC-USD", "ETH-USD"]
}

Receiving Real-Time Updates​

After subscribing, you will start receiving real-time messages with market data.

Example Real-Time Message​

{
"type": "tick",
"data": {
"product": "BTC-USD",
"bid": "1000000.00",
"ask": "1000000.00",
"time": "2024-12-01T01:00:00.000Z"
}
}

Message Structure​

  • type: The type of message. For real-time market data, this will be "tick".
  • data: The data payload containing market information.
    • product: The currency pair being updated (e.g., "BTC-USD").
    • bid: The current bid price for the currency pair.
    • ask: The current ask price for the currency pair.
    • time: The timestamp of the market data.

Key Terminology​

  • WebSocket: A protocol providing full-duplex communication channels over a single TCP connection.
  • API Key: A unique key used to authenticate requests to the BlockWyre API.
  • Product: A pair of currencies being traded (e.g., "BTC-USD").
  • Bid Price: The highest price a buyer is willing to pay for a currency pair.
  • Ask Price: The lowest price a seller is willing to accept for a currency pair.

Conclusion​

The BlockWyre WebSocket API is a powerful tool for receiving real-time market data. By connecting to the WebSocket endpoint and subscribing to specific currency pairs, you can stay updated with live market prices. For any further assistance or questions, please contact BlockWyre support.

Support and Resources​

If you need assistance or have any questions, our support team is here to help. You can contact our support team at support@blockwyre.com.

Stay Updated​

Stay up-to-date with the latest news, updates, and features from BlockWyre by following us on social media:

We are excited to have you on board and look forward to seeing how you leverage BlockWyre's powerful tools to enhance your financial operations. Happy integrating!