用户API-WebSocket接口
API

WebSocketAPI

XT.com provides users with a simple and powerful API designed to help users quickly and efficiently integrate XT.com transaction function into their applications.

WebSocket Service Address

XT.com WebSocket service connection addresswss://ws.xt.com/websocket

Instructions

The following APIs can be processed in a WebSocket connection. Subscribe to the server data by subscribing to the action parameter in the message. The k-line, spread, and transaction data server will return the full data once first and then push it when there is new data.
Basic format of subscribing message:

{"dataType":"1_ENTRUST_ADD_EOS_QTUM", "dataSize":1, "action":"ADD"}
dataType: The requested data type is explained in detail in the following sections.
dataSize: The amount of data requested determines the amount of full data for the first time. If it is not passed or 0, a piece of data is returned.
action: action type requested ADD: add data subscription DEL: delete data subscription.  

The message format is simple and intuitive. You can make a test via online WebSocket tool or check the data by entering developer mode on the page with K line before developing.

1Quotation API

Get the lastest XT.com market data

1.1K Line

Maximum size is 500; support the period of 1M 5M 15M 30M 1H 1D
Example

request
{"dataType":"90_KLINE_1M_BTC_KRW","dataSize":1000,"action":"ADD"} 
First full data response
[["K","90","btc_krw","1530588720","9.182984","9.274772","9.139348","9.219058","66.68","0.39","1.00","1M","false"],
["K","90","btc_krw","1530588660","9.323081","9.464753","9.233462","9.245472","137.81","-0.83","1.00","1M","false"]]
Incremental data response
["K","90","btc_krw","1530588660","9.323081","9.464753","9.233462","9.245472","137.81","-0.83","1.00","1M","false"]

The format of request dataType is: 市场id_KLINE_时间周期_市场卖方货币_市场卖方货币 Full amount data is a list of incremental data. Field description: [Data type Market ID Currency information Timestamp Opening data Highest price Lowest price Closing price Volume Changes USD exchange rate K-line cycle Whether converted]

1.2Spread (Market Depth)

Maximum bid or ask orders are 50 each; full data in subsequent versions may be sent multiple times. After receiving the full data, it is cleared and replaced all the markets.
Example

request
{"dataType":"90_ENTRUST_ADD_BTC_KRW","dataSize":50,"action":"ADD"}
full data response
[["AE","90","BTC_KRW","1530588744",
{"asks":[["9.52474412","8.30549744"],["9.52439338","1.27516183"],["9.24510427","7.30032233"]]},
{"bids":[["9.22777334","0.7185328"],["9.22746464","1.00998182"],["9.22673134","10.67980016"]]}]]  
Incremental data response
["E","90","1530596231","BTC_KRW","ASK","9.31466872","25.17915754"]  

The format of request dataType is: market ID_ENTRUST_ADD_ Seller's currency_Seller's currency
Full data field description: [data type market ID currency information time stamp ask: (price quantity)] bid [[price quantity]]]
Incremental data field description: [data type market ID time stamp currency information transaction type (ask or bid) price quantity]
Each incremental data is a single gear position data; 0 indicates that the position have been fully traded and need to be removed.

3. Trading Record

Maximum full data size is 50
Example

request
{"dataType":"90_TRADE_BTC_KRW","dataSize":20,"action":"ADD"}  
full data response
[["T","90","1530588744","BTC_KRW","ask","9.21905755","9.51934036"],
["T","90","1530588741","BTC_KRW","ask","9.1909928","7.82056220"],
["T","90","1530588698","BTC_KRW","ask","9.26087653","3.05215100"]] 
Incremental data response
["T","90","1530596909","BTC_KRW","ask","9.22561602","15.26344425"]  

The format of request dataType is: market ID_TRADE_ seller's currency_seller’s currency
Full data is a list of incremental data field description: [data type market ID currency information timestamp trading type (ask or bid) price quantity]

arket Quotation including 6H Closing Price

Only one format with no distinction of full data or incremental data.
Example

request
{"dataType":"ALL_TRADE_STATISTIC_24H","dataSize":1,"action":"ADD"}  
response
{"trade_statistic":
[[99,"9.39","9.82","1","153734.8286","830.3","[[1, 9.39], [2, 9.37], [3, 9.24], [4, 9.39]]","9.27","9.39"],
[90,"9.5","6652698.301","1.02","169532.11","814.53","[[1, 9.486], [2, 9.658], [3, 9.212], [4, 9.25]]","9.4","9.227"]]}

Request dataType is fixed to ALL_TRADE_STATISTIC_24H
Field description:
{"trade_statistic": [[market ID latest transaction price highest price lowest price 24H volume 24H changes latest 6H closing price list buy 1 price sell 1 price…]]].
Data description of latest 6H closing price: [[serial number closing price] [serial number closing price] [serial number closing price]]