WebSocket API Documentation

AggregateOHLCV Emitter

Subscription

To start receiving AggregateOHLCV events, you must join the room by sending a subscribe-to-emitter message with the following payload:

{
    "emitterName": "AggregateOHLCVEmitter"
}

Unsubscription

To leave the room, send the same payload with unsubscribe-from-emitter:

{
    "emitterName": "AggregateOHLCVEmitter"
}

Event Payload

The AggregateOHLCV event is emitted every 10 minutes, providing aggregated data for preconfigured currency pairs. The interval can be configured in the System Config.

Example Payload:

{
    "data": {
        "rangeDateStart": "2023-12-11T14:27:45.901Z",
        "rangeDateEnd": "2023-12-11T14:37:45.901Z",
        "aggregatedPairs": {
            "BTC/EUR": {
                "open": null,
                "high": null,
                "low": null,
                "close": null,
                "volume": null,
                "aggregatedAveragePrice": null
            },
            "BTC/USDT": {
                "open": 41847.2,
                "high": 41958.97,
                "low": 41813.1,
                "close": 41923.435,
                "volume": 1389.9607819399996,
                "aggregatedAveragePrice": 41886.035
            }
        }
    }
}

Note: null values indicate no data available for the specified period.


Pricing Emitter

The Pricing Emitter controls multiple rooms, each corresponding to different types of pricing data such as Trade, Ticker, OrderBook, CandleStick, and ExchangeRate. You can join these rooms by sending subscribe-to-emitter calls with the appropriate payload specifying the type and market ID. Once subscribed, the Pricing Emitter will stream real-time data to you as soon as it is saved in the database, ensuring you receive the latest updates promptly.

Events like Pricing_ExchangeRate_201 are structured by combining different components: a constant prefix Pricing_, which identifies the emitter type, a datatype segment such as ExchangeRate_, which specifies the type of data being provided, and a market ID 201, which uniquely identifies the market or trading pair the data pertains to. This structured naming convention helps in clearly identifying and categorizing different types of events in the WebSocket API.

Subscription

To start receiving events (Trade, Ticker, OrderBook, CandleStick), you must join the PricingEmitter room by sending a subscribe-to-emitter message with the following payload:

{
    "emitterName": "PricingEmitter",
    "payload": {
        "type": "OrderBook",  // Replace with "Trade", "Ticker", or "CandleStick" as needed
        "marketId": 1         // Replace with the specific market ID
    }
}

Unsubscription

To leave the room, send the same payload with unsubscribe-from-emitter:

{
    "emitterName": "PricingEmitter",
    "payload": {
        "type": "OrderBook",  // Replace with "Trade", "Ticker", or "CandleStick" as needed
        "marketId": 1         // Replace with the specific market ID
    }
}

Trade Event

This event emits Trade data for a specified exchange and currency pair as soon as it is collected.

Example Payload for Pricing_Trade_68:

{
    "exchange": "binance",
    "symbol": "BTC/USDT",
    "payload": {
        "tradesInfo": [
            [1, 42000.03, 0.00058, 1702305540000],
            [1, 42000.03, 0.00054, 1702305540001],
            [1, 42000.03, 0.00113, 1702305540001],
            [1, 42000.03, 0.00232, 1702305540002],
            [1, 42000.03, 0.00227, 1702305540002]
        ],
        "intervalStart": 1702305540000,
        "intervalEnd": 1702305600000,
        "marketId": 68
    },
    "type": "Trade"
}

Ticker Event

This event provides Ticker data for a specified exchange and currency pair as soon as it is collected.

Example Payload for Pricing_Ticker_68:

{
    "exchange": "binance",
    "symbol": "BTC/USDT",
    "payload": {
        "high": 44046,
        "low": 40400,
        "bid": 41977,
        "bidVolume": 0.53876,
        "ask": 41977.01,
        "askVolume": 4.80016,
        "vwap": 42501.30907775,
        "open": 43797.46,
        "close": 41977,
        "last": 41977,
        "previousClose": 43797.45,
        "change": -1820.46,
        "percentage": -4.157,
        "average": 42887.23,
        "baseVolume": 53508.02676,
        "quoteVolume": 2274161183.467364,
        "intervalStart": 1702305540000,
        "intervalEnd": 1702305600000,
        "marketId": 68
    },
    "type": "Ticker"
}

OrderBook Event

This event provides OrderBook data for a specified exchange and currency pair as soon as it is collected.

Example Payload for Pricing_OrderBook_68:

{
    "exchange": "binance",
    "symbol": "BTC/USDT",
    "payload": {
        "bids": [
            [41977, 0.13294],
            [41976.89, 0.02795],
            [41976.74, 0.11951],
            [41976.73, 0.1],
            [41976.49, 0.00329]
        ],
        "asks": [
            [41977.01, 6.61858],
            [41977.02, 0.00018],
            [41977.08, 0.23832],
            [41977.3, 0.5]
        ],
        "intervalStart": 1702305540000,
        "intervalEnd": 1702305600000,
        "marketId": 68
    },
    "type": "OrderBook"
}

CandleStick Event

This event provides CandleStick data for a specified exchange and currency pair as soon as it is collected.

Example Payload for Pricing_CandleStick_68:

{
    "exchange": "binance",
    "symbol": "BTC/USDT",
    "payload": {
        "charts": [
            [1702305540000, 42000.03, 42016.11, 41972.83, 41988.89, 107.70167]
        ],
        "intervalStart": 1702305540000,
        "intervalEnd": 1702305600000,
        "marketId": 68
    },
    "type": "CandleStick"
}

ExchangeRate Event

This event provides ExchangeRate data for a specified exchange and currency pair as soon as it is collected.

Example Payload for Pricing_ExchangeRate_201:

{
    "exchange": "sushiswap",
    "symbol": "WBTC/WETH",
    "payload": {
        "exchangeRate": "22.15808734504000761441",
        "poolASize": "268.89228006",
        "poolBSize": "5958.138627976439579359",
        "intervalStart": 1715880120000,
        "intervalEnd": 1715880240000,
        "marketId": 201
    },
    "type": "ExchangeRate",
    "collectorTraceId": "f5f09d67"
}

Last updated