用户API-WebSocket接口
API

WebSocketAPI

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

WebSocket Service Address

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

Instructions

All API below can be processed on one WebSocket connection. You can subscribe server data by subscribing the action parameter in message. The servers of K line, handicap and trading record will return the full data once at first, and push the data proactively whenever there is new data.
Basic format of subscribing message:

{"dataType":"1_ENTRUST_ADD_EOS_QTUM", "dataSize":1, "action":"ADD"}
dataType: data type requested, details are in chapters below.
dataSize: data size requested, determine the size of first full data, return a data when no param or 0.
action: action type requested,ADD: add data subscription,DEL: delete data subscription.  

Since the 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 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: Full amount data is a list of incremental data. Field description: [data type, market ID, currency information, time stamp, opening data, highest price, lowest price, closing price, volume, fluctuation, dollar exchange rate, K-line period, whether converted]

1.2Handicap (Depth of Market)

Maximum bid size or ask size is 50; full data may be sent multiple times in follow-up versions; handicap will be empty and replaced on receipt of full data.
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, asks: (price, quantity)], bids [[price, quantity]]]
Incremental data field description: [data type, market ID, time stamp, currency information, transaction type (asks or bids), price, quantity]
Each incremental data is a single file position data; 0 indicates that the stalls 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, time stamp, trading type (asks or bids), price, quantity]

Market 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 fluctuation, latest 6H closing price list, ...]]].
Data description of latest 6H closing price: [[ordinal, closing price], [serial number, closing price], [serial number, closing price]]

会话

{{selectedConversation.conversationName}}

Send Message
{{curr.unreadCount}}

{{curr.conversationName}}

Send Message

{{item.senderInfo.nickname}}