用户API-WebSocket接口

Price API(WebSocket)

WebSocketAPI

BW provides users with a simple and powerful API designed to help them quickly and efficiently integrate BW trading functionality into their applications.

BW WebSocket server connection address:wss://kline.BW.com/websocket

BW BW WebSocket server connection address:wss://kline.BW.com/websocket:

Use Instruction

The following API can be processed over a WebSocket connection, subscribing to the server data by subscribing to the action parameter in the message. Three types of data servers, namely, k-line, exchange port, and transaction record data, will first return a full amount of data, and then actively push the data when new data is available.
Subscription message basic format:

{"dataType":"1_ENTRUST_ADD_EOS_QTUM", "dataSize":1, "action":"ADD"}
dataType: 请求的数据类型, 下面各个章节会详细说明。
dataSize: 请求的数据数量,决定首次全量数据的数量,不传或者为 0 则返回一条数据。
action: 请求的动作类型,ADD:增加数据订阅,DEL:移除数据订阅。 

The format is relatively simple and intuitive, you can firstly use online websocket tools to have the simple test or to visit official website with k-line page to open the developer mode to view the data before development.

1 Price API

Receive the latest BW market data

1.1 Kline WebSocket

Maximum for the size is 500, supported period includes 1M, 5M, 15M, 30M, 1H, 1D
For example

request
{"dataType":"90_KLINE_1M_BTC_KRW","dataSize":1000,"action":"ADD"} 
The 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 for request dataType is MarketId_KLINE_timeCycle_marketSellerCurrency_marketSellerCurrency Total data is a tabular form of incremental data. Field description: [data Type, market ID, currency Information, timestamp, open data, maximum price, lowest price, closing price, trading volume, range, dollar exchange rate, K line cycle, converted or not]

1.2 Handicap(The depth of market)

买盘卖盘各自最多50条,后续版本全量数据可能会发多次,接收到全量数据后清空替换掉所有盘口。
For example

request
{"dataType":"281_ENTRUST_ADD_BTC_USDT","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 for request dataType is MarketID_ENTRUST_ADD_MarketSellerCurrency_MarketSellerCurrency
Full data field description: [data type, market ID, currency information, timestamp, asks: (selling) [price, volume], bids (buy) [price, volume].
Incremental data field description: [data type, market ID, timestamp, currency information, buy and sell type (asks sell bids buy), price, volume].
Each increment data represents a single slot data, When the volume is 0 means that the stall has been traded completely and needed to be removed.

1.3 Transaction Records

Maximum for full data is 50
For 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"]] 
Subsequent incremental data response
["T","90","1530596909","BTC_KRW","ask","9.22561602","15.26344425"]  

The format for request dataType is id_trade_marketSellerCurrency_marketSellerCurrency.
Full data is the tabular form of incremental data, field description: [data type, market ID, currency information, timestamp, buy and sell type (asks sell bids buy), price, volume]

Market including six-hour closing price

No difference between full data and incremental dara, only one format exists.
For 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 price, highest price, lowest price, 24 hour volume, 24 hour change, recent 6H closing price list, buy one price, sell one price],....]}。
Recent 6H closing price data list description: [[serial number, closing price], [serial number, closing price], [serial number, closing price

会话

{{selectedConversation.conversationName}}

Send Message
{{curr.unreadCount}}

{{curr.conversationName}}

Send Message

{{item.senderInfo.nickname}}