NAV Navbar
json python

Websocket

URL

Compression algorithm

please use zlib deflate

Catalogue

public

private

Public Channel

Ping

method:server.ping

request param

Parameters Required Type Description
method yes string server.ping
id yes number auto-increment request id

request example

{
  "method":"server.ping",
  "id":1
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"server.ping", "params":[]}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
result string pong if success
error string error msg, null if success

response example

{
  "id":1,
  "result": "pong",
  "error": null
}

Time

method:server.time

request param

Parameters Required Type Description
method yes string server.time
id yes number auto-increment request id

request example

{
  "method":"server.time",
  "id":1
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"server.time"}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
result string seconds since UNIX epoch
error string error msg, null if success

response example

{
  "id":1,
  "result": 1523348055,
  "error": null
}

Trades

Subscribe

method:trades.subscribe

request param

Parameters Required Type Description
method yes string trades.subscribe
id yes number auto-increment request id
params yes array array of symbols

request example

{
  "method":"trades.subscribe",
  "id":1,
  "params":["ETH_USDT", "BTC_USDT"]
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"trades.subscribe", "params":["ETH_USDT", "BTC_USDT"]}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
error string error msg, null if success
- result object result data
status string success

response example

{
  "error": null,
  "result":
  {
    "status": "success"
  },
  "id": 12312
}

UnSubscribe

method:trades.unsubscribe

request param

Parameters Required Type Description
method yes string trades.unsubscribe
id yes number auto-increment request id
params yes array array of symbols, empty means unsubscribe all symbols

request example

{
  "method":"trades.unsubscribe",
  "id":1,
  "params": ["ETH_USDT", "BTC_USDT"]
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"trades.unsubscribe", "params":["ETH_USDT", "BTC_USDT"]}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
error string error msg, null if success
- result object result data
status string success

response example

{
  "error": null,
  "result":
  {
    "status": "success"
  },
  "id": 12312
}

Push

push param

Parameters Type Description
method string trades.update
id number null
- params array response data
0 bool true: is complete result false: is last updated result
- 1 array list of trades
id number trade id
time number trade time
price string trade price
amount string trade amount
type string trade side: buy or sell
2 string trade symbol

push example

{
  "method": "trades.update",
  "params":
  [
    true,
    [
      {
        "id": 7172173,
        "time": 1523339279.761838,
        "price": "398.59",
        "amount": "0.027",
        "type": "buy"
      }
    ],
    "ETH_USDT"
  ],
  "id": null
}

Depth

Subscribe

method:depth.subscribe

request param

Parameters Required Type Description
method yes string depth.subscribe
id yes number auto-increment request id
params yes array array of symbols

request example

{
  "method":"depth.subscribe",
  "id":1,
  "params":["ETH_USDT", "BTC_USDT"]
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"depth.subscribe", "params":["ETH_USDT", "BTC_USDT"]}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
error string error msg, null if success
- result object result data
status string success

response example

{
  "error": null,
  "result":
  {
    "status": "success"
  },
  "id": 12312
}

UnSubscribe

method:depth.unsubscribe

request param

Parameters Required Type Description
method yes string depth.unsubscribe
id yes number auto-increment request id
params yes array array of symbols, empty means unsubscribe all symbols

request example

{
  "method":"depth.unsubscribe",
  "id":1,
  "params": ["ETH_USDT", "BTC_USDT"]
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"depth.unsubscribe", "params":["ETH_USDT", "BTC_USDT"]}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
error string error msg, null if success
- result object result data
status string success

response example

{
  "error": null,
  "result":
  {
    "status": "success"
  },
  "id": 12312
}

Push

push param

Parameters Type Description
method string depth.update
id number null
- params array response data
0 bool true: is complete result false: is last updated result
- 1 object depth data
- asks array ask raws
- 0 string price
- 1 string amount
- bids array bid raws
- 0 string price
- 1 string amount
2 string trade symbol

push example

{
  "method": "depth.update",
  "params": [
    true,
    {
      "asks": [
        [
          "8000.00",
          "9.6250"
        ]
      ],
      "bids": [
        [
          "8000.00",
          "9.6250"
        ]
      ]
    },
    "EOS_USDT"
  ],
  "id": null
}

All Ticker

Subscribe

method:all_ticker.subscribe

request param

Parameters Required Type Description
method yes string all_ticker.subscribe
id yes number auto-increment request id

request example

{
  "method":"all_ticker.subscribe",
  "id":1
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"all_ticker.subscribe"}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
error string error msg, null if success
- result object result data
status string success

response example

{
  "error": null,
  "result":
  {
    "status": "success"
  },
  "id": 12312
}

UnSubscribe

method:all_ticker.unsubscribe

request param

Parameters Required Type Description
method yes string all_ticker.unsubscribe
id yes number auto-increment request id

request example

{
  "method":"all_ticker.unsubscribe",
  "id":1
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"all_ticker.unsubscribe"}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
error string error msg, null if success
- result object result data
status string success

response example

{
  "error": null,
  "result":
  {
    "status": "success"
  },
  "id": 12312
}

Push

push param

Parameters Type Description
method string all_ticker.update
id number null
- params array array of ticker
symbol string trade symbol
open_24h string 24 hours ago trade price
low_24h string lowest trade price since 24 hours ago
base_volume_24h string total trade volume since 24 hours ago
quote_volume_24h string total trade amount since 24 hours ago
last string last trade price
last_qty string last trade volume
best_bid string best bid price
best_bid_size string best bid volume
best_ask string best ask price
best_ask_size string best ask volume
timestamp number milliseconds since UNIX epoch

push example

{
  "method": "all_ticker.update",
  "params": [{
    "symbol": "BTC_USDT",
    "open_24h": "1760",
    "low_24h": "1.00",
    "base_volume_24h": "9.40088557",
    "quote_volume_24h": "21786.30588557",
    "last": "4000",
    "last_qty": "1",
    "best_bid": "3397",
    "best_bid_size": "0.85",
    "best_ask": "4000",
    "best_ask_size": "109.2542",
    "timestamp": 1586762372864
  }],
  "id": null
}

Ticker

Subscribe

method:ticker.subscribe

request param

Parameters Required Type Description
method yes string ticker.subscribe
id yes number auto-increment request id
params yes array array of symbols

request example

{
  "method":"ticker.subscribe",
  "id":1,
  "params":["ETH_USDT", "BTC_USDT"]
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"ticker.subscribe", "params":["ETH_USDT", "BTC_USDT"]}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
error string error msg, null if success
- result object result data
status string success

response example

{
  "error": null,
  "result":
  {
    "status": "success"
  },
  "id": 12312
}

UnSubscribe

method:ticker.unsubscribe

request param

Parameters Required Type Description
method yes string ticker.unsubscribe
id yes number auto-increment request id
params yes array array of symbols, empty means unsubscribe all symbols

request example

{
  "method":"ticker.unsubscribe",
  "id":1,
  "params": ["ETH_USDT", "BTC_USDT"]
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"ticker.unsubscribe", "params":["ETH_USDT", "BTC_USDT"]}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
error string error msg, null if success
- result object result data
status string success

response example

{
  "error": null,
  "result":
  {
    "status": "success"
  },
  "id": 12312
}

Push

push param

Parameters Type Description
method string ticker.update
id number null
- params array array of ticker
symbol string trade symbol
open_24h string 24 hours ago trade price
low_24h string lowest trade price since 24 hours ago
base_volume_24h string total trade volume since 24 hours ago
quote_volume_24h string total trade amount since 24 hours ago
last string last trade price
last_qty string last trade volume
best_bid string best bid price
best_bid_size string best bid volume
best_ask string best ask price
best_ask_size string best ask volume
timestamp number milliseconds since UNIX epoch

push example

{
  "method": "ticker.update",
  "params": [{
    "symbol": "BTC_USDT",
    "open_24h": "1760",
    "low_24h": "1.00",
    "base_volume_24h": "9.40088557",
    "quote_volume_24h": "21786.30588557",
    "last": "4000",
    "last_qty": "1",
    "best_bid": "3397",
    "best_bid_size": "0.85",
    "best_ask": "4000",
    "best_ask_size": "109.2542",
    "timestamp": 1586762372864
  }],
  "id": null
}

Private Channel

Auth

method:server.auth

request param

Parameters Required Type Description
method yes string server.auth
id yes number auto-increment request id
- params yes array auth data
0 yes string valid apikey
1 yes string milliseconds since UNIX epoch
2 yes string signature

request example

{
  "method":"server.auth",
  "id":1,
  "params": ["5a8e6b662ddb0","1583135616239","lXU0njGw4F+89g+EMxWtS9cLjKOqvUQ3+vsKK2yda40="]
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"server.auth", "params":["5a8e6b662ddb0","1583135616239","lXU0njGw4F+89g+EMxWtS9cLjKOqvUQ3+vsKK2yda40="]}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
error string error msg, null if success
- result object result data
status string success

response example

{
  "error": null,
  "result":
  {
    "status": "success"
  },
  "id": 12312
}

Order

Subscribe

method:order.subscribe

request param

Parameters Required Type Description
method yes string order.subscribe
id yes number auto-increment request id
params yes array array of symbols

request example

{
  "method":"order.subscribe",
  "id":1,
  "params":["ETH_USDT", "BTC_USDT"]
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"order.subscribe", "params":["ETH_USDT", "BTC_USDT"]}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
error string error msg, null if success
- result object result data
status string success

response example

{
  "error": null,
  "result":
  {
    "status": "success"
  },
  "id": 12312
}

UnSubscribe

method:order.unsubscribe

request param

Parameters Required Type Description
method yes string order.unsubscribe
id yes number auto-increment request id
params yes array array of symbols, empty means unsubscribe all symbols

request example

{
  "method":"order.unsubscribe",
  "id":1,
  "params": ["ETH_USDT", "BTC_USDT"]
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"order.unsubscribe", "params":["ETH_USDT", "BTC_USDT"]}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
error string error msg, null if success
- result object result data
status string success

response example

{
  "error": null,
  "result":
  {
    "status": "success"
  },
  "id": 12312
}

Push

push param

Parameters Type Description
method string order.update
id number null
- params array array of order
amount string order amount
filled string filled amount
id string order id
mode number order mode, 1: spot, 2: margin
notional string notional amount
price string order price
price_avg string avg filled price
side string order side, buy or sell
status number order status, 0: unfilled, 1: partially filled, 2: fully filled, 3: canceled unfilled, 4: canceled partially filled
symbol string symbol
type string order type, limit or market
timestamp number milliseconds since UNIX epoch

push example

{
  "method": "order.update",
  "params": [{
    "amount": "0",
    "filled": "0.9969",
    "id": "31b7f41c81787b4200c75eb074e6edc9",
    "mode": 1,
    "notional": "9713.82",
    "price": "0",
    "price_avg": "9700",
    "side": "buy",
    "status": 2,
    "symbol": "BTC_USDT",
    "timestamp": 1589272547000,
    "type": "market"
  }],
  "id": null
}

Order Algo

Subscribe

method:order_algo.subscribe

request param

Parameters Required Type Description
method yes string order_algo.subscribe
id yes number auto-increment request id
params yes array array of symbols

request example

{
  "method":"order_algo.subscribe",
  "id":1,
  "params":["ETH_USDT", "BTC_USDT"]
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"order_algo.subscribe", "params":["ETH_USDT", "BTC_USDT"]}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
error string error msg, null if success
- result object result data
status string success

response example

{
  "error": null,
  "result":
  {
    "status": "success"
  },
  "id": 12312
}

UnSubscribe

method:order_algo.unsubscribe

request param

Parameters Required Type Description
method yes string order_algo.unsubscribe
id yes number auto-increment request id
params yes array array of symbols, empty means unsubscribe all symbols

request example

{
  "method":"order_algo.unsubscribe",
  "id":1,
  "params": ["ETH_USDT", "BTC_USDT"]
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"order_algo.unsubscribe", "params":["ETH_USDT", "BTC_USDT"]}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
error string error msg, null if success
- result object result data
status string success

response example

{
  "error": null,
  "result":
  {
    "status": "success"
  },
  "id": 12312
}

Push

push param

Parameters Type Description
method string order_algo.update
id number null
- params array array of order
algo_price string order price
amount string order amount
id string order id
mode number order mode, 1: spot, 2: margin
side string order side, buy or sell
status number order algo status, -2: fail, -1: canceled, 0: ready to effect, 1: effecting, 2: success
symbol string symbol
trigger_price string trigger price
timestamp number milliseconds since UNIX epoch

push example

{
  "method": "order_algo.update",
  "params": [{
    "algo_price": "4000",
    "amount": "1",
    "id": "ff0738804cc3361fa91cb7c84feb113c",
    "mode": 1,
    "side": "buy",
    "status": 0,
    "symbol": "BTC_USDT",
    "timestamp": 1586767202000,
    "trigger_price": "4000"
  }],
  "id": null
}

Balance

Subscribe

method:balance.subscribe

request param

Parameters Required Type Description
method yes string balance.subscribe
id yes number auto-increment request id
params yes array array of currency

request example

{
  "method":"balance.subscribe",
  "id":1,
  "params":["USDT", "BTC"]
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"balance.subscribe", "params":["USDT", "BTC"]}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
error string error msg, null if success
- result object result data
status string success

response example

{
  "error": null,
  "result":
  {
    "status": "success"
  },
  "id": 12312
}

UnSubscribe

method:balance.unsubscribe

request param

Parameters Required Type Description
method yes string balance.unsubscribe
id yes number auto-increment request id
params yes array array of currency, empty means unsubscribe all currency

request example

{
  "method":"balance.unsubscribe",
  "id":1,
  "params": ["USDT", "BTC"]
}
from websocket import create_connection
ws = create_connection("wss://openapi.digifinex.com/ws/v1/")
ws.send('{"id":12312, "method":"balance.unsubscribe", "params":["USDT", "BTC"]}')
print(ws.recv())

response param

Parameters Type Description
id number auto-increment request id
error string error msg, null if success
- result object result data
status string success

response example

{
  "error": null,
  "result":
  {
    "status": "success"
  },
  "id": 12312
}

Push

push param

Parameters Type Description
method string order_algo.update
id number null
- params array array of order
currency string currency
free string usable asset
total string total asset
used string frozen asset

push example

{
  "method": "balance.update",
  "params": [{
    "currency": "USDT",
    "free": "99944652.8478545303601106",
    "total": "99944652.8478545303601106",
    "used": "0.0000000000"
  }],
  "id": null
}