Testnet API URL: wss://ws.tapi.digitexfutures.com.
Mainnet API URL: wss://ws.mapi.digitexfutures.com.
Server send message ping
every 30 seconds. Client should respond with message pong
or it would be disconnected.
The id
used in JSON as an identifier of the request. The response for the particular request has the same id
value.
Request
{
"id": 1,
"method": "subscribe",
"params": [
"BTCUSD-PERP@orderbook_25"
]
}
Response
{
"id": 1,
"status": "ok"
}
Request
{
"id": 1,
"method": "unsubscribe",
"params": [
"BTCUSD-PERP@orderbook_25"
]
}
Response
{
"id": 1,
"status": "ok"
}
Response in case of error
{
"id": 1,
"status": "error",
"code": 501,
"msg": "unknown contract"
}
Request
{
"id": 1,
"method": "subscriptions",
"params": []
}
Response
{
"id":2,
"status":"ok",
"result":[
"BTCUSD-PERP@kline_1min"
]
}
- orderbook_depth, where depth can be:
1
,5
,10
,25
,50
orfull
. - kline_interval, where interval can be:
1min
,3min
,5min
,15min
,30min
,1h
,3h
,6h
,12h
,1D
,3D
,1W
,3W
,1M
,3M
,6M
,1Y
- trades
- liquidations
- ticker
- fundingInfo
- index
Channel name: <symbol>@orderbook_5
Message
{
"ch":"orderbook_5",
"data":{
"symbol":"BTCUSD-PERP",
"ts":1591295037813,
"bids":[
[9840,53914],[9835,26103],[9830,37644],[9825,21331],[9820,43942]
],
"asks":[
[9845,15899],[9850,85810],[9855,41480],[9860,39565],[9865,40374]
]
}
}
Channel name: <symbol>@trades
Message
{
"ch":"trades",
"data":{
"symbol":"BTCUSD-PERP",
"trades":[
{"px":9845,"qty":2356,"ts":1591295123213},
{"px":9845,"qty":75,"ts":1591295123213}
]
}
}
Channel name: <symbol>@kline_1min
Only 1min
interval is supported now.
Kline history is in development, only single kline is published every minute
Message
{
"ch":"kline_1min",
"data":{
"symbol":"BTCUSD-PERP",
"interval":"1min",
"id":1591295280,
"o":9835,
"h":9840,
"l":9825,
"c":9830,
"v":654088
}
}
Channel name: <symbol>@liquidations
Message
{
"ch":"liquidations",
"data":{
"symbol":"BTCUSD-PERP",
"positions":[
{"ts":1594039337113,"qty":75,"px":9255,"type":"SHORT"}
]
}
}
Channel name: <symbol>@ticker
Message
{
"ch":"ticker",
"data":{
"symbol":"BTCUSD-PERP",
"openTime":1590906900000,
"closeTime":1590993300000,
"openPx": 9250,
"highPx24h":9450,
"lowPx24h":9100,
"pxChange24h": -3.35,
"volume24h":78053288,
"volume24hUsd":2852425063.05,
"bidPx":9420,
"bidQty":100,
"askPx":9450,
"askQty":250,
"lastPx":9400,
"lastQty":200,
"fundingRate":0.0003,
"nextFundingTime":123456789000,
"contractValue":194.9,
"openInterest":431229,
"openInterestUsd":4586283.33,
"dgtxUsdRate":0.03728994,
"insuranceFund": 1711659412.9
}
}
openInterestUsd
is calculated as: openInterest
* contractValue
* dgtxUsdRate
.
contractValue
is calculated as: lastTradePx
/ TICK_SIZE
* TICK_VALUE
, where:
TICK_SIZE
=5 andTICK_VALUE
=0.1 forBTCUSD-PERP
contract;TICK_SIZE
=0.25 andTICK_VALUE
=0.25 forETHUSD-PERP
contract.
Channel name: <symbol>@fundingInfo
Message
{
"ch":"fundingInfo",
"data":{
"symbol":"BTCUSD-PERP",
"ts":157743360000,
"rate":0.0003
}
}
Channel name: <symbol>@index
Symbol can be either a contract symbol (BTCUSD-PERP
) or index symbol (.DGTXBTCUSD
).
Message
{
"ch":"index",
"data":{
"indexSymbol":".DGTXBTCUSD",
"ts":1590999736783,
"markPx":9549,
"fairPx":9549,
"spotPx":9565,
"components":{
"binance":{"weight":25,"ts":0,"px":0,"vol":0},
"bitfinex":{"weight":25,"ts":0,"px":0,"vol":0},
"coinbasepro":{"weight":25,"ts":0,"px":0,"vol":0},
"kraken":{"weight":25,"ts":0,"px":0,"vol":0}
}
}
}
Code | Description |
---|---|
3001 | Bad Request (unknown method, ill-formed parameters, etc.) |
3002 | Channel not found |
3003 | Contract not found |
3004 | Index not found |
3005 | Kline interval not specified |
3006 | Kline interval not found |
3007 | Orderbook depth not specified |
3008 | Orderbook depth not found |
3009 | Already subscribed for the topic |
3010 | Not subscribed for the topic |
3011 | Feature is not implemented yet |
3012 | Other error |