Software development kit

Use our official SDK libraries and access our products with easy steps


npm install
yarn add

Rest client usage

import { ExchangeGate } from '';

const egRest = new ExchangeGate.Rest(API_KEY);

Realtime client usage

import { ExchangeGate } from '';

const egRealtime = new ExchangeGate.Realtime(API_KEY);

Socket events

Available events

error, connect, disconnect, connectAbort, close, connecting, kickOut, subscribe, subscribeFail, unsubscribe, subscribeStateChange, subscribeRequest

Listening events

const socketEvents = ['connect', 'connecting', 'error', 'disconnect', 'close'];
for (const socketEvent of socketEvents) {
    egRealtime.onSocketEvent(socketEvent, (e) => {
        console.log('onSocketEvent', socketEvent, e);

Remote Procedure Call's

Any of REST API methods also available over WS as RPC

const rpcClient = egRealtime.rpc;


Subscribe stream events
(Example using ExchangeGate account subscription details stream)

const streamSubscription =;
const streamConsumerA = streamSubscription.consumer();
const streamConsumerB = streamSubscription.consumer();

(async () => {
    for await (const event of streamConsumerA) {
    console.log('stream-A closed');

(async () => {
    for await (const event of streamConsumerB) {
    console.log('stream-B closed');

Kill consumer-A but preserve subscription and any other consumers


UnSubscribe stream and close all stream consumers

// OR;

!NOTE! It is safe to issue stream subscription multiple times within single connection;
// this will be same subscription - no double spend;

Disconnect from socket server


Follow our products sections

For specific API interaction, follow our products sections