Skip to main content

WEBSOCKET API Market Data - Get market summary

WEBSOCKET API Market Data - Get market summary

Written by Albert
Updated over a week ago

Get market summary

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 "Summary".

type int

The operation type.

Set to 4 to indicate a subscription to the stream.

Example:

{
"arguments": [
"67d0456f8c7b1108e4cf5d46",
[
"cfd.eur_chf"
]
],
"invocationId": "0",
"target": "Summary",
"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.items array of objects

The array of data objects.

item.items.marketId string

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

item.items.last decimal string

The price of the last trade.

item.items.high24hr decimal string

The highest trade price over the last 24 hours.

item.items.low24hr decimal string

The lowest trade price over the last 24 hours.

item.items.percentChange 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.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": {
"items": [
{
"marketId": "cfd.eur_chf",
"last": "0.93597",
"high24hr": "0.93695",
"low24hr": "0.93134",
"percentChange": "-0.02"
}
],
"snapshot": false
}
}

Did this answer your question?