Skip to main content

WEBSOCKET API Market Data - Get trading data

WEBSOCKET API Market Data - Get trading data

Written by Albert
Updated over a week ago

Get trading data

Connection

URL:

/marketdata/v5/info?access_token={YOUR_ACCESS_TOKEN}

arguments array

The connection parameters.

In the first element, provide the accountId as a string.

In the second element, provide a list of marketIds as an array of strings.

invocationId string

The invocation identifier.

Must be unique and increase by 1 for each sent message.

target string

The stream name.

Specify "TradingData".

type int

The operation type.

Set to 4 to indicate a subscription to the stream.

Example:

{
"arguments": [
"67d0456f8c7b1108e4cf5d46",
[
"spot.bnb_btc"
]
],
"invocationId": "0",
"target": "TradingData",
"type": 4
}

Message

type string

The operation type.

2 indicates the streaming is in progress.

invocationId string

The invocation identifier. Same as in the request.

item object

The dataset object.

item.markets array of objects

The array of market objects.

item.markets.marketId string

The market identifier, in the following format: {marketType}.{baseAssetId}_{quoteAssetId}, for example: cfd.eth_eur.

item.markets.type string

The market type.

Possible values:

  • Spot

  • Cfd

  • Perp

item.markets.displayName string

The market ticker.

item.markets.fullName string

The market full name or description (optional).

item.markets.price decimal string

The current top-of-the-book price, in the quote asset.

item.markets.priceInRAT decimal string

The current top-of-the-book price, in conversion to the root asset of the platform.

item.markets.priceChange24hr decimal string

The price change over the last 24 hours, in percents.

This value is calculated as ((Current price – Price 24h ago) / Current price) Γ— 100.

item.markets.priceChangeAbs24hr decimal string

The price change over the last 24 hours.

This value is calculated as Current price – Price 24h ago.

item.markets.highPrice24hr decimal string

The highest trade price over the last 24 hours.

item.markets.lowPrice24hr decimal string

The lowest trade price over the last 24 hours.

item.markets.markPrice decimal string

Applicable to Perpetual markets only.

The mid-spread price, in conversion to RAT.

item.markets.fundingRate decimal string

Applicable to Perpetual markets only.

The current funding rate.

item.snapshot boolean

The data snapshot.

If snapshot: true, it indicates the message contains the full dataset. Subsequent messages with snapshot: false only include updates or changes since the initial snapshot.

Example:

{
"type": 2,
"invocationId": "0",
"item": {
"markets": [
{
"marketId": "cfd.eur_chf",
"type": "Cfd",
"displayName": "cfd.eur_chf",
"fullName": "",
"price": "0.93586",
"priceInRAT": "1",
"priceChange24hr": "-0.0006",
"priceChangeAbs24hr": "-0.00049",
"highPrice24hr": "0.93695",
"lowPrice24hr": "0.93134",
"markPrice": null,
"fundingRate": null
}
],
"snapshot": false
}
}

Did this answer your question?