You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
githubdev2020 edited this page Mar 16, 2020
·
2 revisions
Websocket Market Data API
Websocket URL
wss://www.bitforex.com/mkapi/coinGroup1/ws
Heartbeat and Connection
This service supports standard websocket heartbeat modes, namely ping and pong
Due to the differences in the implementation of each version of the browser, in order to ensure that the server and client are active, the system requires the client to send heartbeats to the server regularly. It supports two modes:
Standard websocket heartbeat mode
String ping mode websocket.send ("ping_p"); server returns "pong_p"
websocket.send(“[{"type":"subHq","event":"depth10","param":{"businessType":"coin-usdt-btc", "dType":0}}]”); Subscribe to real-time market depth
Parameter
Parameter
Type
Is it required?
Defaults
description
businessType
String
yes
-
Symbol code e.g. coin-usdt-btc
dType
int
yes
-
Depth type e.g. 0,1
Response (json)
Explanation:
1、 Example of returning 150 orders each time
Example:
{
"success": true,
"code": 200,
"version": "0.0.1",
"event": "depth10",
"param": {"businessType":"coin-usdt-btc", "dType":0},
"data": {
"asks":[
{"price":<price>,"amount",<Number of digital currencies>},
{"price":<price>,"amount",<Number of digital currencies>},
{"price":<price>,"amount",<Number of digital currencies>},
...
],
"bids":[
{"price":<price>,"amount",<Number of digital currencies>},
{"price":<price>,"amount",<Number of digital currencies>},
{"price":<price>,"amount",<Number of digital currencies>},
...
]
}
}
asks for selling, bids for buying
Subscribe to the latest transaction data for the product
websocket.send(“[{"type":"subHq","event":"trade","param":{"businessType":"coin-usdt-btc", "size":20}}]”); Push the latest transaction data of the product
Parameter
Parameter
Type
Is it required?
Defaults
description
businessType
String
yes
-
Symbol code e.g. coin-usdt-btc
size
int
yes
-
Number of first returns e.g. 20 Max. 1000
Response (json)
Note: The first return, the number of sizes required by the parameter, and subsequent incremental returns, the data format is consistent
Example:
{
"success": true,
"code": 200,
"version": "0.0.1",
"event": "trade",
"param": {"businessType":"coin-usdt-btc"},
"data":[
{
"price":<transaction price>,
"amount",<volume (digital currency)>,
"direction",<transaction direction>,
"time",<transaction time>
},
{
"price":<transaction price>,
"amount",<volume (digital currency)>,
"direction",<transaction direction>,
"time",<transaction time>
},
...
]
}
Direction: 1 buy 2 sell , time is long
Description: The latest size push data is returned for the first time and the latest 50 data is returned.
Retrieve the candlestick data
websocket.send(“[{"type":"subHq","event":"kline","param":{"businessType":"coin-usdt-btc", "kType":"1min", "size":20}}]”); Retrieve the candlestick data
{
"success": false,
"code": 20002,
"version": "0.0.1",
"msg": "Request params not valid"
}
public static final String[] PARAM_ERROR = {"MK100", "param is invalid"};
public static final String[] PARAM_BUSS_TYPE = {"MK101", "business type is invalid"};
public static final String[] PARAM_DTYPE_PARAM = {"MK102", "dType type is invalid"};
public static final String[] PARAM_KTYPE_PARAM = {"MK103", "kType type is invalid"};
public static final String[] PARAM_SIZE_PARAM = {"MK103", "SIZE type is invalid"};