Market data


Static data

Information about symbols can be obtained from the Market Data Rest API.

Symbols

Endpoint

GET /api/market-data/symbols

Response

FieldTag Type / possible valuesDescription
Symbols555MArray of SymbolInfo 
SymbolInfo
Currency15MStringBase currency
QuoteCurrencyName1524MstringQuote currency
SecurityID48MStringInternal ID of the instrument
Symbol55MStringSymbol name
MinPriceIncrement969MintPip scale: 1 means 1 decimal point in the price (7843.3), 2 means 2 points (342.44), -1 means the point value is 10 and so on.
LimitOrderMaxDistance970OdecimalMaximal distance from the mid price ((Bid + Ask) / 2) for limit orders. 0.3 means orders can be placed within the range of 70% and 130% of the current mid price. 0 or null value means there is no restrictions.
MinOrderQty1146MdecimalMinimal quantity of an order
OrderQtyStep1147MdecimalQuantity step

Example

{
    “555”: [
        {
            "15": "BTC",
            "48": "100",
            "55": "BTC/USDT",
            "969": 1,
            "970": "0.5",
            "1146": "0.001",
            "1147": "0.001",
            "1524": "USDT"
        },
        …
    ]
}

Live data

All market data feeds work with the concept of streams:

  1. Connect to the web socket and receive the initial login
  2. Send a market data request with the name of the stream.
  3. The API responds with a market data snapshot full refresh message containing a snapshot of the data for the requested stream (e.g., the current state of the order book).
  4. The API sends market data incremental refresh messages containing updates.
  5. Send a market data request to unsubscribe from the stream.

You can subscribe to multiple streams on one web-socket connection.

Please note, that if you are not subscribed to any stream during 5 seconds, the server will break the connection. In other words, you need to subscribe to any stream within 5 seconds after establishing the web socket connection of after you unsubscribe from all streams.

Endpoint

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

Logon

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

FieldTagM/O/CType / possible valuesDescription
MsgType35MA (Logon) 
SendingTime52MLong — Unix timestamp in nanoseconds 
CstmApplVerID1129MStringCurrent API version
HeartBtInt108MintHeartbeat interval in seconds

Sample

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

 

Market Data Request

FieldTagM/O/CType / possible valuesDescription
MsgType35MV (Market Data Request) 
MDStreamID1500MString 
SubscriptionRequestType263Mint
  • 1 SnapshotAndUpdates (to subscribe)
  • 2 DisablePreviousSnapshot (to unsubscribe)
 
ThrottleType1612Oint
  • 1 InboundRate
Use these 3 fields to enable throttling. 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.
ThrottleTimeInterval1614Oint
  • 500
  • 5000
ThrottleTimeUnit1615Oint
  • 3 (Milliseconds)

Depth of market

Stream

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

<aggregation>: only “aggregated” is supported now. Later “orderlog” and “bbo” will be added.

Subscribe message sample

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

Snapshot

FieldTagM/O/CType / possible valuesDescription
MsgType35MW (Market Data Snapshot Full Refresh) 
MDStreamID1500MString 
LastUpdateTime779MLong — Unix timestamp in nanoseconds 
Symbol55MString 
MDBookType1021Mint
  • 2 (Price Depth)
 
MDFullGrps268OArray of MDEntryWill be omitted in case of empty book.
MDEntry
MDEntryType269MString
  • 0 (Bid)
  • 1 (Offer)
 
MDEntryPx270MDecimalPrice level.
MDEntrySize271MDecimalTotal volume at the given price level.
NumberOfOrders346Mint 

Sample

{
    "1021":2,
    "1500":"DOM:BTC/USDT:aggregated",
    "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
}

Increment

FieldTagM/O/CType / possible valuesDescription
MsgType35MX (Market Data Incremental Refresh) 
MDStreamID1500MString 
LastUpdateTime779MLong — Unix timestamp in nanoseconds 
MDBookType1021M
  • 2 Price Depth
 
MDIncGrps268MArray of MDEntry 
MDEntry
MDUpdateAction279M
  • 0 New
  • 1 Change
  • 2 Delete
 
Symbol55MString 
MDEntryType269M
  • 0 Bid
  • 1 Offer
 
MDEntryPx270MDecimalPrice level.
MDEntrySize271CDecimalNew total volume at the given price level.Conditionally required when MDUpdateAction <> Delete.
NumberOfOrders346CintNew number of orders at the given price level.Conditionally required when MDUpdateAction <> Delete.

Sample

TODO

Last trades

Stream

MDStreamID: “trades:<symbol>”

Subscribe message sample

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

Snapshot

FieldTagM/O/CType / possible valuesDescription
MsgType35MW (Market Data Snapshot Full Refresh) 
MDStreamID1500MString 
LastUpdateTime779MLong — Unix timestamp in nanoseconds 
Symbol55MString 
MDFullGrps268OArray of MDEntryContains last 50 trades. Omitted if there are no trades.
MDEntry
MDEntryType269MString2 Trade 
MDEntryPx270MDecimalTrade price.
MDEntrySize271MDecimalTrade volume.
AggressorSide1501Mint
  • 1 Buy
  • 2 Sell
Non-standard FIX tag.The side of the trade.

Sample

{
    "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
}

Increment

FieldTagM/O/CType / possible valuesDescription
MsgType35MX (Market Data Incremental Refresh) 
MDStreamID1500MString 
LastUpdateTime779MLong — Unix timestamp in nanoseconds 
MDIncGrps268MArray of MDEntry 
MDEntry
MDEntryType269MString2 Trade 
MDEntryPx270MDecimalTrade price.
MDEntrySize271MDecimalTrade volume.
AggressorSide1501Mint
  • 1 Buy
  • 2 Sell
Non-standard FIX tag.The side of the trade.

Sample

TODO

Candles

Stream

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

Supported timeframes: 1m, 5m, 15m, 30m, 1h, 3h, 6h, 12h, 1d.

Subscribe message sample

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

Snapshot

FieldTag Type / possible valuesDescription
MsgType35MW (Market Data Snapshot Full Refresh) 
MDStreamID1500MString 
LastUpdateTime779MLong — Unix timestamp in nanoseconds 
Symbol55MString 
MDFullGrps268OArray of MDEntryContains last 100 candles. Omitted if no data.
MDEntry
FirstPx1025MDecimal 
HighPx332MDecimal 
LowPx333MDecimal 
LastPx31MDecimal 
BuyVolume330MDecimal 
SellVolume331MDecimal 
TransactTime60MLong — Unix timestamp in nanosecondsCandle open timestamp.

Sample

{
    "1500":"candles:BTC/USDT:1m",
    "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
}

Increment

FieldTagM/O/CType / possible valuesDescription
MsgType35MX (Market Data Incremental Refresh) 
MDStreamID1500MString 
LastUpdateTime779MLong — Unix timestamp in nanoseconds 
Symbol55MString 
MDIncGrps268MArray of MDEntryContains last 100 candles.
MDEntry
FirstPx1025MDecimal 
HighPx332MDecimal 
LowPx333MDecimal 
LastPx31MDecimal 
BuyVolume330MDecimal 
SellVolume331MDecimal 
TransactTime60MLong — Unix timestamp in nanosecondsCandle open timestamp.

Sample

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