All market data feeds work with the concept of streams:

  1. Send a Market Data Request with the name of the stream.
  2. The API responds with a Market Data Snapshot Full Refresh message containing the snapshot of the data for the requested stream (e.g., the current state of the order book).
  3. The API sends Market Data Incremental Refresh messages containing updates.
  4. Send a Market Data Request to unsubscribe from the stream.


Once connected, the market data API sends the initial login message:

Field

Tag

 

Type / possible values

Description

MsgType

35

M

A (Logon)


SendingTime

52

M

Long — Unix timestamp in nanoseconds


CstmApplVerID

1129

M

String

Current API version

Example

{
	"1129":"1.0",
	"35":"A",
	"52":1520433521222952779
}


Endpoint

wss://api.xena.exchange/ws/market-data



Library Repository


Python lib:    GitHub / PyPI


C# lib:     GitHub C#NuGet


Market Data Request

Field

Tag

 

Type / possible values

Description

MsgType

35

M

V (Market Data Request)


MDStreamID

1500

M

String


SubscriptionRequestType

263

M

1 SnapshotAndUpdates (to subscribe)

2 DisablePreviousSnapshot (to unsubscribe)


ThrottleType

1612

O

1 InboundRate

Use these 3 fields to enable throttling. The time interval is defined in milliseconds. If the fields are not present, throttling is disabled.


Throttling is now supported only for the depth of market channel.

ThrottleTimeInterval

1614

O

500

5000

ThrottleTimeUnit

1615

O

3 Milliseconds

Depth of market


Stream


MDStreamID: “DOM:<symbol>:<aggregation>”

<aggregation>: only “aggregated” is supported at the moment. In the future, “orderlog” and “bbo” will be added.


Subscribe message example


{
	"35":"V",
	"263": "1",
	"1500":"DOM:BTC/USDT:aggregated",
	“1612”: "1",
	“1614”: 500,
	“1615”: "3"
}



Snapshot


Field

Tag

 

Type / possible values

Description

MsgType

35

M

W (Market Data Snapshot Full Refresh)


MDStreamID

1500

M

String


LastUpdateTime

779

M

Long — Unix timestamp in nanoseconds


Symbol

55

M

String


MDBookType

1021

M

int

2 Price Depth


BestBid

1502

M

Decimal


BestAsk

1503

M

Decimal


LowRangePx

35601

M

Decimal


HighRangePx

35602

M

Decimal


LowLimitPx

35603

M

Decimal


HighLimitPx

35604

M

Decimal


LastClearingPx

35605

M

Decimal


MDFullGrps

268

O

Array of MDEntry

Is omitted in case of an empty book.

MDEntry

MDEntryType

269

M

0 Bid

1 Offer


MDEntryPx

270

M

Decimal

Price level.

MDEntrySize

271

M

Decimal

Total volume at the given price level.

NumberOfOrders

346

M

int



Example


{
	"1021":2,
	"1500":"DOM:BTC/USDT:aggregated",
	"55":"BTCUSD",
	"1502":"3603",
	"1503":"3640",
	"35601":"3633.2",
	"35602":"3651.5",
	"35603":"3582.3",
	"35604":"3702.5",
	"35605":"3700",
	"268":
		[
			{
				"269":"0",
				"270":"43.2",
				"271":"20.444",
				"346":"2"
			},
			{
				"269":"0",
				"270":"6000",
				"271":"1",
				"346":1
			}
		],
	"35":"W",
	"55":"BTC/USDT",
	"779":1520415867338061271
}



Increments


Note that depth of market increments are throttled and sent once every 100 ms.


Field

Tag

 

Type / possible values

Description

MsgType

35

M

X (Market Data Incremental Refresh)


MDStreamID

1500

M

String


LastUpdateTime

779

M

Long — Unix timestamp in nanoseconds


MDBookType

1021

M

2 Price Depth


LowRangePx

35601

M

Decimal


HighRangePx

35602

M

Decimal


LowLimitPx

35603

M

Decimal


HighLimitPx

35604

M

Decimal


LastClearingPx

35605

M

Decimal


MDIncGrps

268

M

Array of MDEntry


MDEntry

MDUpdateAction

279

M

0 New

1 Change

2 Delete


Symbol

55

M

String


MDEntryType

269

M

0 Bid

1 Offer


MDEntryPx

270

M

Decimal

Price level.

MDEntrySize

271

C

Decimal

New total volume at the given price level.

Conditionally required when MDUpdateAction <> Delete.

NumberOfOrders

346

C

int

New number of orders at the given price level.

Conditionally required when MDUpdateAction <> Delete.


Example


{
	"35":"X",
	"1500":"DOM:XBTUSD:aggregated",
	"779":1549985303132129899,
	"1021":2,
	"55":"XBTUSD",
	"268":[
		{
			"279":"1",
			"269":"0",
			"270":"3569.4",
			"271":"1.95",
			"346":1
    		},
		{
			"279":"2",
			"269":"b",
			"270":"0"
		}
  	]
}



Last trades


Stream


MDStreamID: “trades:<symbol>”


Subscribe message example


{
  "35":"V",
  "263":1,
  "1500":"trades:BTC/USDT"
}



Snapshot

Field

Tag

 

Type / possible values

Description

MsgType

35

M

W (Market Data Snapshot Full Refresh)


MDStreamID

1500

M

String


LastUpdateTime

779

M

Long — Unix timestamp in nanoseconds


Symbol

55

M

String


MDFullGrps

268

O

Array of MDEntry

Contains the last 50 trades. Omitted if there are no trades.

MDEntry

MDEntryType

269

M

2 Trade


MDEntryPx

270

M

Decimal

Trade price.

MDEntrySize

271

M

Decimal

Trade volume.

AggressorSide

1501

M

1 Buy

2 Sell

Non-standard FIX tag.

The side of the trade.

MDUpdateAction

279

M

0 New

1 Change

2 Delete


TransactTime

60

M

Long — Unix timestamp in nanoseconds

Timestamp of the event.

TradeId

1003

C

String

Conditionally required when ExecType = Trade


Example


{
  "1500":"trades:BTC/USDT",
  "268":
  [
    {
      "1003":"8ed851f8-996a-45f6-a235-a5432953154e",
      "1501":"2",
      "269":"2",
      "270":"10494",
      "271":"0.151",
      "279":"0",
      "60":1520425569334963219
    },
    {
      "1003":"9ab4c9c8-f585-440c-a0d7-42460d679999",
      "1501":"2",
      "269":"2",
      "270":"10494",
      "271":"1.779",
      "279":"0",
      "60":1520425629340376980
    }
  ],
  "35":"W",
  "779":1520430075750254187
}



Increments


Field

Tag

 

Type / possible values

Description

MsgType

35

M

X (Market Data Incremental Refresh)


MDStreamID

1500

M

String


LastUpdateTime

779

M

Long — Unix timestamp in nanoseconds


MDIncGrps

268

M

Array of MDEntry


MDEntry

MDEntryType

269

M

2 Trade


MDEntryPx

270

M

Decimal

Trade price.

MDEntrySize

271

M

Decimal

Trade volume.

AggressorSide

1501

M

1 Buy

2 Sell

Non-standard FIX tag.

The side of the trade.


Example


{
  "35":"X",
  "1500":"trades:XBTUSD",
  "779":1549985302722078833,
  "1021":3,
  "55":"XBTUSD",
  "268":[
    {
      "279":"0",
      "269":"2",
      "270":"3569.4",
      "271":"0.1",
      "60":1549985302722078833,
      "1003":"05a92a06-1a3a-4b7f-97b1-71ee3b0e3e16",
      "1501":"2"
    }
    ]
}





Candles


Stream


MDStreamID: “candles:<symbol>:<timeframe>”

Supported timeframes: 1m, 5m, 15m, 30m, 1H, 4H, 12H, 1D, 1W.


Subscribe message example


{
  "35":"V",
  "263":"1",
  "1500":"candles:BTC/USDT:1m"
}



Snapshot


Field

Tag

 

Type / possible values

Description

MsgType

35

M

W (Market Data Snapshot Full Refresh)


MDStreamID

1500

M

String


LastUpdateTime

779

M

Long — Unix timestamp in nanoseconds


Symbol

55

M

String


MDFullGrps

268

O

Array of MDEntry

Contains the last 100 candles. Omitted if no data.

MDEntry

FirstPx

1025

M

Decimal


HighPx

332

M

Decimal


LowPx

333

M

Decimal


LastPx

31

M

Decimal


BuyVolume

330

M

Decimal


SellVolume

331

M

Decimal


TransactTime

60

M

Long — Unix timestamp in nanoseconds

Candle open timestamp.


Example


{
  "1500":"candles:BTC/USDT:1m",
  "55":"BTCUSD",
  "268":
  [
    {
      "1025":"10502",
      "31":"10502",
      "330":"0",
      "331":"0",
      "332":"10502",
      "333":"10502",
      "60":1520403420000000000
    },
    {
      "1025":"10502",
      "31":"10502",
      "330":"0",
      "331":"0.225",
      "332":"10502",
      "333":"10502",
      "60":1520403480000000000
    }
  ],
  "35":"W",
  "779":1520430420000000000
}



Increments


Field

Tag

 

Type / possible values

Description

MsgType

35

M

X (Market Data Incremental Refresh)


MDStreamID

1500

M

String


LastUpdateTime

779

M

Long — Unix timestamp in nanoseconds


Symbol

55

M

String


MDIncGrps

268

M

Array of MDEntry

Contains the last 100 candles.

MDEntry

FirstPx

1025

M

Decimal


HighPx

332

M

Decimal


LowPx

333

M

Decimal


LastPx

31

M

Decimal


BuyVolume

330

M

Decimal


SellVolume

331

M

Decimal


TransactTime

60

M

Long — Unix timestamp in nanoseconds

Candle open timestamp.


Example


{
  "1500":"candles:BTC/USDT:1m",
  "55":"BTCUSD",
  "268":
  [
    {
      "1025":"10494",
      "31":"10494",
      "330":"0",
      "331":"0",
      "332":"10494",
      "333":"10494",
      "60":1520433480000000000
    }
  ],
  "35":"X",
  "779":1520433480000000000
}



Static data


Currencies


Endpoint

GET /public/currencies



Response


Field

 

Type

Description

currency

O

array

Base currency

ticker

M

string

Ticker

title

M

string

Title

precision

M

string

Precision


Example


{
  "BTC": {
    "ticker": "BTC",
    "title": "Bitcoin",
    "precision": 8
  },
  "ETC": {
    "ticker": "ETC",
    "title": "Ethereum Classic",
    "precision": 4
  },
  "ETH": {
    "ticker": "ETH",
    "title": "Ethereum",
    "precision": 5
  },
  "LTC": {
    "ticker": "LTC",
    "title": "Litecoin",
    "precision": 4
  },
  "USDT": {
    "ticker": "USDT",
    "title": "Tether",
    "precision": 2
  }
}



Instruments


Endpoint


GET /public/instruments



Response


Field

 

Type

Description

type

M

string

Instrument type

"XenaListedPerpetual" and “Spot” are available

symbol

M

string

Instrument symbol

baseCurrency

M

string

Base currency

quoteCurrency

M

string

Quote currency

settlCurrency

M

string

Settlement currency

tickSize

M

decimal

Tick size

minOrderQuantity

M

decimal

Minimum order quantity

orderQtyStep

M

decimal

Order quantity step

movingBoundary

M

decimal

Moving boundary

limitOrderMaxDistance

M

decimal

Limit order max distance

priceInputMask

M

decimal

Price input mask

inverseLastPx

M

boolean

Whether the last price is inverted

basis

M

decimal

Basis

indexes

O

Array of strings

List of indexes

contractValue

O

decimal

Contract value

contractCurrency

O

string

Contract currency

lotSize

O

decimal

Lot size

tickValue

O

decimal

Tick value

mark

O

string


floatingPL

O

string

Defines prices, used for floating PL calculation

margin

O

Array of arrays

Margin parameters

netting

O

string

Netting type

Only “PositionsAndOrders” is available

rates

O

Array of arrays

Margin rates

maxVolume

O

decimal

Applicable position size

initialRate

O

decimal

Initial rate

maintenanceRate

O

decimal

Maintenance rate

rateMultipliers

O

Array of arrays

Margin rate multipliers

LimitBuy

O

decimal

Rate multiplier for limit buy orders

LimitSell

O

decimal

Rate multiplier for limit sell orders

Long

O

decimal

Rate multiplier for long positions

MarketBuy

O

decimal

Rate multiplier for market buy orders

MarketSell

O

decimal

Rate multiplier for market sell orders

Short

O

decimal

Rate multiplier for short positions

StopBuy

O

decimal

Rate multiplier for stop buy orders

StopSell

O

decimal

Rate multiplier for stop sell orders

clearing

O

Array of arrays

Clearing parameters

enabled

O

boolean

Whether clearing is enabled

index

O

string

Clearing index

schedule

O

long — Unix timestamp in nanoseconds

Clearing frequence

premium

O

Array of arrays

Premium parameters

enabled

O

boolean

Whether premium is enabled

index

O

string

Premium index

schedule

O

long — Unix timestamp in nanoseconds

Premium frequence

riskAdjustment

O

Array of arrays

Risk adjustment parameters

enabled

O

boolean

Whether risk adjustment is enabled

index

O

string

Risk adjustment index

schedule

O

long — Unix timestamp in nanoseconds

Risk adjustment frequence

pricePrecision

O

number

Price precision

priceRange

O

Array of arrays

Price range

enabled

O

boolean

Whether risk price range is enabled

distance

O

decimal

Price range distance rate

movingBoundary

O

decimal

Moving boundary

movingTime

O

long — Unix timestamp in nanoseconds

Moving time

lowIndex

O

string

Low index

highIndex

O

string

High index

priceLimits

O

Array of arrays

Price limits

enabled

O

boolean

Whether risk price limits are enabled

distance

O

decimal

Price limits distance rate

lowIndex

O

string

Low index

highIndex

O

string

High index


Example


[
  {
  "id":"100",
  "type":"Spot",
  "symbol":"BTC/USDT",
  "baseCurrency":"BTC",
  "quoteCurrency":"USDT",
  "settlCurrency":"USDT",
  "tickSize":1,
  "minOrderQuantity":"0.001",
  "orderQtyStep":"0.001",
  "movingBoundary":"0",
  "limitOrderMaxDistance":"0",
  "priceInputMask":"0000.0",
  "enabled":true,
  "inverseLastPx":false,
  "basis":0
  },
  {
    "type":"XenaListedPerpetual",
    "symbol":"XBTUSD",
    "baseCurrency":"BTC",
    "quoteCurrency":"USDT",
    "settlCurrency":"BTC",
    "tickSize":1,
    "minOrderQuantity":"0.01",
    "orderQtyStep":"0.01",
    "movingBoundary":"0",
    "limitOrderMaxDistance":"0",
    "priceInputMask":"00000.0",
    "indexes":[
      ".BTC3_TWAP"
      ],
    "contractValue":"1",
    "contractCurrency":"USDT",
    "lotSize":"100000",
    "tickValue":"0",
    "mark":".BTC3_TWAP",
    "floatingPL":"BidAsk",
    "margin":{
      "netting":"PositionsAndOrders",
      "Rates":[
        {
        "maxVolume":"9.99",
        "initialRate":"0.01",
        "maintenanceRate":"0.01"
        }
      ],
      "rateMultipliers":{
        "LimitBuy":"1",
        "LimitSell":"1",
        "Long":"1",
        "MarketBuy":"1",
        "MarketSell":"1",
        "Short":"1",
        "StopBuy":"0",
        "StopSell":"0"
      }

    },

    "clearing":{
      "enabled":true,
      "index":".BTC3_TWAP",
      "schedule":3600000000000
    },
      "premium":{
      "enabled":true,
      "index":".XBTUSD_Premium_IR_Corrected",
      "schedule":3600000000000
    },
    "riskAdjustment":{
      "enabled":true,
      "index":".RiskAdjustment_IR",
      "schedule":3600000000000
    },
    "pricePrecision":4,
    "priceRange":{
      "enabled":true,
      "distance":"0.005",
      "movingBoundary":"0.2",
      "movingTime":60000000000,
      "lowIndex":".XBTUSD_LOWRANGE",
      "highIndex":".XBTUSD_HIGHRANGE"
    },
    "priceLimits":{
      "enabled":true,
      "distance":"0.033",
      "lowIndex":".XBTUSD_LOWLIMIT",
      "highIndex":".XBTUSD_HIGHLIMIT"
    },
    "inverseLastPx":true,
    "basis":0
  }
]

REST Trades


Get list of trades for specified period of time.


Endpoint


GET https://api.xena.exchange/market-data/trades/BTC/USDT?from=1573740661391900000&to=1573742367504414000&page=1&limit=0

Example:


{
  "35":"W",
  "779":1574873343289923861,
  "55":"BTC/USDT",
  "268":[
    {
      "279":"0",
      "269":"2",
      "270":"6850",
      "271":"0.006",
      "60":1574431822163088115,
      "1003":"7ad96c82-085e-4856-9490-06d4afada7ba",
      "1501":"2"
    },
    {
      "279":"0",
      "269":"2",
      "270":"6900",
      "271":"0.001",
      "60":1574639519841799016,
      "1003":"2ed268c0-0336-4336-aabf-de19b7abc954",
      "1501":"2"
    },
    }
  ]
}




Candles


Endpoint


GET /market-data/candles/XBTUSD/1m?from=1549858491000000000&to=1549901751000000000



Example


{
  "268": [
    {
      "31": "3454.2",
      "60": 1549858440000000000,
      "330": "0",
      "331": "0",
      "332": "3454.2",
      "333": "3454.2",
      "1025": "3454.2"
    }
  ]
}


Get current time

Endpoint

GET /market-data/server-time


Example


{
    "35":"0",
    "60":1574945771981121066
}


FieldTag
Type/Possible valuesDescription
MsgType35M0
TransactTime60MLong — Unix timestamp in nanosecondsTimestamp of the event.