Xena API allows you to automate your trading strategies.

There are four different API endpoints:


  • Web-socket Market Data API
  • Web-socket Trading API
  • REST 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.


Library Repository


Python lib:    GitHub / PyPI


C# lib:     GitHub C#NuGet


Base URL


The API is available at api.xena.exchange


Test Environment


To access the environment, you have to add the following records to the hosts file:


104.199.4.174    xena.traders

104.199.4.174    trading.xena.traders

104.199.4.174    api.xena.traders


and then go to http://trading.xena.traders/registration

Login and password for Basic Auth are test / Ldfj39LsJ



How to change hosts:

Windows — https://support.rackspace.com/how-to/modify-your-hosts-file/

MacOS / Linux — edit /etc/hosts with any text editor (e.g. sudo vi /etc/hosts)


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 strings (e.g. "40": "1", "35": "AF")


For example, the message MarketDataSnapshotFullRefresh


Field name

Field tag

MsgType

35

Repeating group MdFullGrp

NoMDEntries

268

FirstPx

1025


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

Field

Tag

M/O/C

Type / possible values

Description

MsgType

35

M

0 (Heartbeat)



Sample

{ "35": "0" }