Subscriptions

Builds Websocket messages for the Subscriptions API.

Builds WS messages for Websocket Subscriptions

Usage

import { createVertexClient } from '@vertex-protocol/client';

const vertexClient = await createVertexClient('testnet', ...);

// Builds a subscription stream param as expected by the server via Websocket. 
const wsTradeStream = vertexClient.ws.subscription.buildSubscriptionParams(
    'trade',
    {
      product_id: 0,
    },
  );

// Builds a subscription request message as expected by the server via Websocket.
const wsTradeSubscriptionReq =
  vertexClient.ws.subscription.buildSubscriptionMessage(
    1,
    'subscribe',
    wsTradeStream,
  );

API Reference

Last updated