Introduction to Xena API


Xena API allows you to automate your trading strategies.

There are three different API endpoints:

  • Web-socket Market Data API
  • Web-socket Trading API
  • REST Transfers API

The separation of trading and market data APIs allows for the optimization of the overall architecture and increased speed of delivery of the crucial trading information to API clients.

Web-socket APIs use messages and flows based on the protocol that is the de facto standard for trading in many traditional financial markets (FIX 5.0 SP2+), with slight changes to make it easier and more suited to cryptocurrency trading.

Web-socket messages

  • All FIX messages are serialized into JSON, with FIX field tags as the keys of the objects’ properties.
  • FIX repeating groups are serialized as arrays, with the NoXXX field tag as the name of the property containing the array.
  • The FIX standard header and footer are omitted.
  • Decimals are serialized into strings, with dots as decimal separators.
  • All timestamps are nanosecond timestamps. To get the Unix timestamp, divide the value by 10^6.
  • FIX enumerations are serialized as either integers or strings, depending on the field. The message description contains required comments.

For example, the message MarketDataSnapshotFullRefresh

Field nameField tag
MsgType35
Repeating group MdFullGrp
NoMDEntries268
FirstPx1025

is serialized as follows:

{ “35”: “W”, “268”: [ { “1025”: “3.20” }, { “1025”: “3.22” } ] }

Heartbeats

Both the client and the server must send messages at least once within a heartbeat interval. If there are no business messages to be sent, a heartbeat must be sent.

Both parties expect to receive a message (business or heartbeat) from the counterparty at least once within a heartbeat interval. If no messages are received during that interval (plus 20–50% for unexpected network lags), the connection will be deemed broken and be closed.

The heartbeat interval is   by the API in the login message.

Message

FieldTagM/O/CType / possible valuesDescription
MsgType35M0 (Heartbeat) 

Sample

{ "35": "0" }