NAV Navbar
shell python
申请API Key

简介

欢迎使用 NovaDAX API

NovaDAX 提供了一套强大安全的 API,旨在为用户提供更加快捷的安全的使用体验。

API 提供了查询行情、交易,查询交易记录、查询账户详情等服务。

NovaDAX 为用户提供简单易用的接口调用形式,并且 SDK 还在持续完善中。

准备说明

创建一个账户

如果您还没有账户,请点击此处注册成为 NovaDAX 账户,享受 NovaDAX 提供的优质服务。

生成 API 密钥

对于与 API 通信,必需创建 AccessKey 与 SecretKey 并按照接入说明中的描述接入。 您可以在登录后,点击右上方用户图标下的“API管理”来生成API密钥。

接入说明

公共接口

公共接口不需要认证。

私有接口

私有接口需要认证。

接入 URL

https://api.novadax.com

限制频率

签名说明

API 请求在通过 Internet 传输的过程中极有可能被篡改,为了确保请求未被更改,除(基础信息,行情数据)外的私有接口均必须使用您的 API Key 做签名认证,以校验参数或参数值在传输途中是否发生了更改。

一个合法的请求由以下几部分组成:

签名规则

GET 加密举例

1. 查询字符串为

queryStr = "name=姓名&cpf=123456&birthday=2017-08-01"

2. 将查询字符串 URL Encode 之后 按照 ASCII 码的顺序对参数名进行排序

sort(urlencode(queryStr)) // birthday=2017-08-01&cpf=123456&name=%E5%A7%93%E5%90%8D

3. 按{Request Method}\n{Request URL}\n{Sorted Query Parameters}\n{TimeStamp}的格式组成最终需要签名的字符串

signStr = "GET\n/v1/orders/get\nbirthday=2017-08-01&cpf=123456&name=%E5%A7%93%E5%90%8D\n1564988445199"

4. 用上一步里生成的 "字符串" 和你的密钥 (Secret Key) 生成一个数字签名

sign = hmac_sha256(signStr, SecretKey)

5. 将AccesskeySignTimesStamp信息一同添加到指定的header中

request.header.add("X-Nova-Access-Key", AccessKey)

request.header.add("X-Nova-Signature", Sign)

request.header.add("X-Nova-Timestamp", TimeStamp)

6. JAVA 代码如下图

Tux, the Linux mascot

POST 加密举例

1.请求体中Request Body的内容为

body = {"name":"姓名", "cpf":"123456", "birthday":"2017-08-01"} // MD5 后的值为 896b0797c6bdf52abf5cb18e2d776efe

2.将Request Body 中的的内容 MD5 之后按 {Request Method}\n{Request URL}\n{MD5 Request Body}\n{TimeStamp} 的规则进行拼接

signStr = "POST\n/v1/order/create\n896b0797c6bdf52abf5cb18e2d776efe\n1564988445199"

3. 用上一步里生成的 “字符串” 和你的密钥 (Secret Key) 生成一个数字签名

sign = hmac_sha256(signStr, SecretKey)

4. 将AccesskeySignTimesStamp信息一同添加到指定的 Header 中

request.header.add("X-Nova-Access-Key", AccessKey)

request.header.add("X-Nova-Signature", Sign)

request.header.add("X-Nova-Timestamp", TimeStamp)

5. JAVA 代码如下图

Tux, the Linux mascot

响应格式

所有的接口返回都是 JSON 格式。在 JSON 最上层有几个表示请求状态和属性的字段:codedatamessage 实际的接口返回内容在 data 字段里。

成功请求的返回

{
    "code": "A10000""data": {...}"message": "Success"
}

异常请求的返回

{
    "code": "A99999""data": {...}"message": "fail."
}

返回内容将会是以下格式:

参数名称 数据类型 描述
code string 状态
message string 描述
data object 数据主体

响应字典

错误码 HTTP 状态码 消息 解释
A99999 500 Failed 系统服务异常
A10000 200 Success 请求成功
A10001 400 Params error 参数错误
A10002 404 Api not found 无相关API
A10003 403 Authentication failed 鉴权失败
A10004 429 Too many requests 请求频率过快
A10005 403 Kyc required 请先完成KYC
A10006 403 Customer canceled 用户已注销
A10007 400 Account not exist 子账户不存在
A10011 400 Symbol not exist 交易对不存在
A10012 400 Symbol not trading 交易对当前不交易
A10013 503 Symbol maintain 交易对维护
A30001 400 Order not found 订单未找到
A30002 400 Order amount is too small 订单数量太小
A30003 400 Order amount is invalid 订单数量无效
A30004 400 Order value is too small 订单金额大小
A30005 400 Order value is invalid 订单金额无效
A30006 400 Order price is invalid 订单价格无效
A30007 400 Insufficient balance 余额不足
A30008 400 Order was closed 订单已结束
A30009 400 Order canceled 订单已取消
A30010 400 Order cancelling 订单正在取消中
A30011 400 Order price too high 订单价格过高
A30012 400 Order price too low 订单价格过低

常见问题

签名失败

SDK 与讲解

我们的 SDK 放在 GitHub 中,如果需要使用,请访问

除了我们自己 SDK,这 CCXT 库还集成了 NovaDAX。这是我们授权的 SDK 提供者,您可以通过 CCXT 调用NovaDAX 的 API。欲了解更多信息,请访问 https://ccxt.trade

更新记录

时间 接口 变动项目 解释
2019-09-18 withdrawcoin 新加 提币接口
2019-12-05 POST /v1/orders/create 增加字段 增加子账户(accountId)字段
2019-12-05 GET /v1/orders/list 增加字段 增加子账户(accountId)字段
2019-12-05 GET /v1/account/subs 新加 子账户列表
2019-12-05 GET /v1/account/subs/balance 新加 子账户余额
2019-12-05 GET /v1/account/subs/transfer/record 新加 子账户转账记录
2019-12-05 POST /v1/account/subs/transfer 新加 子账户转账
2020-03-05 GET /v1/common/symbol 新加 获取单个交易币对配置
2020-05-20 GET /v1/orders/list 修改 symbol参数改为非必传
2020-10-12 GET /v1/wallet/query/deposit-withdraw 新增 用户存取币记录
2020-10-12 GET /v1/orders/fills 修改 新增查询历史成交明细
2020-11-11 WebSocket 新增 新增 WebSocket
2020-12-17 GET /v1/orders/get
GET /v1/orders/list
修改 API 创建的单子,撤销 2 小时后无法查询
2021-01-30 GET /crypto/chain/{code} 增加,提币接口查询chainAlias API 提币查询chainAlias信息
2021-01-30 POST /v1/wallet/withdraw/coin 修改,提币接口增加chainAlias API 提币补充信息

基础信息

获取单个交易币对配置

返回所有单个的交易币对及相关信息

curl "https://api.novadax.com/v1/common/symbol?symbol=BTC_BRL"
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key(optional)', 'your secret key(optional)')

result = nova_client.get_symbol("BTC_BRL")

print(result)

返回值

{
    "code": "A10000",
    "data": {
        "symbol": "BTC_BRL",
        "baseCurrency": "BTC",
        "quoteCurrency": "BRL",
        "amountPrecision": 4,
        "pricePrecision": 2,
        "valuePrecision": 4,
        "minOrderAmount": "0.001",
        "minOrderValue": "5",
    },
    "message": "Success"
}

请求地址

GET /v1/common/symbol

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对

响应

字段名称 类型 描述
symbol string 交易对
baseCurrency string 基础货币
quoteCurrency string 报价货币
pricePrecision number 交易价格精度
amountPrecision number 交易数量精度
valuePrecision number 交易金额精度
minOrderAmount string 最小交易数量
minOrderValue string 最小交易金额

获取所有交易币对配置

返回所有支持的交易币对及相关信息

curl "https://api.novadax.com/v1/common/symbols"
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key(optional)', 'your secret key(optional)')

result = nova_client.list_symbols()

print(result)

返回值

{
    "code": "A10000",
    "data": [
        {
            "symbol": "BTC_BRL",
            "baseCurrency": "BTC",
            "quoteCurrency": "BRL",
            "amountPrecision": 4,
            "pricePrecision": 2,
            "valuePrecision": 4,
            "minOrderAmount": "0.001",
            "minOrderValue": "5",
        },
        {
            "symbol": "ETH_BRL",
            "baseCurrency": "ETH",
            "quoteCurrency": "BRL",
            "amountPrecision": 4,
            "pricePrecision": 2,
            "valuePrecision": 4,
            "minOrderAmount": "0.01",
            "minOrderValue": "5"
        }
    ],
    "message": "Success"
}

请求地址

GET /v1/common/symbols

请求参数

此请求不需要入参

响应

字段名称 类型 描述
symbol string 交易对
baseCurrency string 基础货币
quoteCurrency string 报价货币
pricePrecision number 交易价格精度
amountPrecision number 交易数量精度
valuePrecision number 交易金额精度
minOrderAmount string 最小交易数量
minOrderValue string 最小交易金额

获取系统时间

返回服务器时间戳

curl "https://api.novadax.com/v1/common/timestamp"
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key(optional)', 'your secret key(optional)')

result = nova_client.get_timestamp()

print(result)

返回值

{
    "code": "A10000",
    "data": 1565080348983,
    "message": "Success"
}

请求地址

GET /v1/common/timestamp

请求参数

此请求不需要入参

响应

时间戳

行情

获取全部聚合行情

返回所有币种的行情和24小时的聚合数据

curl 'https://api.novadax.com/v1/market/tickers'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key(optional)', 'your secret key(optional)')

result = nova_client.list_tickers()

print(result)

返回值

{
    "code": "A10000",
    "data": [
        {
            "ask": "34708.15",
            "baseVolume24h": "34.08241488",
            "bid": "34621.74",
            "high24h": "35079.77",
            "lastPrice": "34669.81",
            "low24h": "34330.64",
            "open24h": "34492.08",
            "quoteVolume24h": "1182480.09502814",
            "symbol": "BTC_BRL",
            "timestamp": 1571112216346
        }
    ],
    "message": "Success"
}

请求地址

GET /v1/market/tickers

请求参数

此请求不需要参数

响应

参数名 类型 描述
symbol string 币对名称
lastPrice string 最新成交价
bid string 买一价
ask string 卖一价
open24h string 24小时开盘价
high24h string 24小时最高价
low24h string 24小时最低价
baseVolume24h string 24小时成交量,按交易货币统计
quoteVolume24h string 24小时成交量,按计价货币统计
timestamp number 系统时间戳

获取单个币对聚合行情

返回单个币种行情和24小时的聚合数据

curl 'https://api.novadax.com/v1/market/ticker?symbol=BTC_BRL'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key(optional)', 'your secret key(optional)')

result = nova_client.get_ticker('BTC_BRL')

print(result)

返回值

{
    "code": "A10000",
    "data": {
        "ask": "34708.15",
        "baseVolume24h": "34.08241488",
        "bid": "34621.74",
        "high24h": "35079.77",
        "lastPrice": "34669.81",
        "low24h": "34330.64",
        "open24h": "34492.08",
        "quoteVolume24h": "1182480.09502814",
        "symbol": "BTC_BRL",
        "timestamp": 1571112216346
    },
    "message": "Success"
}

请求地址

GET /v1/market/ticker

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对

响应

参数名 类型 描述
symbol string 币对名称
lastPrice string 最新成交价
bid string 买一价
ask string 卖一价
open24h string 24小时开盘价
high24h string 24小时最高价
low24h string 24小时最低价
baseVolume24h string 24小时成交量,按交易货币统计
quoteVolume24h string 24小时成交量,按计价货币统计
timestamp number 系统时间戳

获取深度数据

返回未聚合的原始深度数据

curl 'https://api.novadax.com/v1/market/depth?symbol=BTC_BRL&limit=10'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key(optional)', 'your secret key(optional)')

result = nova_client.get_depth('BTC_BRL', limit = 10)

print(result)

返回值

{
    "code": "A10000",
    "data": {
        "asks": [
            ["43687.16", "0.5194"],
            ["43687.2", "1.3129"]
        ],
        "bids": [
            ["43657.57", "0.6135"],
            ["43657.46", "0.0559"]
        ],
        "timestamp": 1565057338020
    },
    "message": "Success"
}

请求地址

GET /v1/market/depth

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对
limit number 返回条数,最多50条

响应

字段名称 类型 描述
asks array 卖集合
asks[][0] string 卖的价格
asks[][1] string 卖的数量
bids array 买集合
bids[][0] string 买的价格
bids[][1] string 买的数量
timestamp number 时间戳

获取成交数据

返回此币对的历史成交数据

curl 'https://api.novadax.com/v1/market/trades?symbol=BTC_BRL&limit=10'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key(optional)', 'your secret key(optional)')

result = nova_client.list_trades('BTC_BRL', limit = 10)

print(result)

返回值

{
    "code": "A10000",
    "data": [
        {
            "price": "43657.57",
            "amount": "1",
            "side": "SELL",
            "timestamp": 1565007823401
        },
        {
            "price": "43687.16",
            "amount": "0.071",
            "side": "BUY",
            "timestamp": 1565007198261
        }
    ],
    "message": "Success"
}

请求地址

GET /v1/market/trades

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对
limit number 返回条数,默认100条

响应

字段名称 类型 描述
price string 成交价格
amount string 成交数量
side string 成交方向,可能值:BUY、SELL
timestamp number 成交时间戳

蜡烛图数据

curl 'https://api.novadax.com/v1/market/kline/history?symbol=BTC_BRL&from=1567619280&to=1567620000&unit=ONE_MIN'
from novadax import RequestClient as NovaClient

result = nova_client.get_kline('BTC_BRL', unit = 'ONE_WEE',from='1567619280 ', to='1567620000 ')

print(result)

返回值

{
    "code": "A10000",
    "data": [
        {
            "amount": 8.25709100,
            "closePrice": 62553.20,
            "count": 29,
            "highPrice": 62592.87,
            "lowPrice": 62553.20,
            "openPrice": 62554.23,
            "score": 1602501480,
            "symbol": "BTC_BRL",
            "vol": 516784.2504067500
        }
    ],
    "message": "Success"
}

请求地址

GET /v1/market/kline/history

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对
unit string ONE_MIN,FIVE_MIN, FIFTEEN_MIN,HALF_HOU,ONE_HOU,ONE_DAY,ONE_WEE,ONE_MON;
from number 开始时间 所有时间单元只保存最近3000条数据
to number 结束时间 所有时间单元只保存最近3000条数据

响应

字段名称 类型 描述
unit string 成交时间单位
amount string 成交数量
count string 成交笔数
openPrice string 开始价格
closePrice string 结束价格
highPrice string 最高价格
lowPrice string 最低价格
symbol string 交易对
score string 时间戳
vol string 交易量

订单

订单简介

订单类型(order.type)

订单止盈止损交易运算符 (order.operator)

订单方向(order.side)

订单状态(order.status)

成交角色(order.role)

下限价买单

创建一笔新的限价买订单

curl -X POST \
  'https://api.novadax.com/v1/orders/create' \
  -H 'Content-Type: application/json' \
  -H 'X-Nova-Access-Key: your access key' \
  -H 'X-Nova-Signature: signature' \
  -H 'X-Nova-Timestamp: timestamp now' \
  -d '{
    "symbol": "BTC_BRL",
    "type": "LIMIT",
    "side": "BUY",
    "price": "35000.00",
    "amount": "0.001"
  }'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')

result = nova_client.create_order('BTC_BRL', 'LIMIT', 'BUY', price = '35000.00', amount = '0.001')

print(result)

返回值

{
    "code": "A10000",
    "data": {
        "amount": "0.001",
        "averagePrice": null,
        "filledAmount": "0",
        "filledFee": "0",
        "filledValue": "0",
        "id": "633679992971251712",
        "price": "35000",
        "side": "BUY",
        "status": "PROCESSING",
        "symbol": "BTC_BRL",
        "timestamp": 1571122683535,
        "type": "LIMIT",
        "value": "35"
    },
    "message": "Success"
}

请求地址

POST /v1/orders/create

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对,例如 BTC_BRL
type string 订单类型,固定值 LIMIT
side string 订单方向,固定值 BUY
amount string 订单数量,即基础货币的数量,如限价购买 BTC_BRL 交易对中 BTC 的数量
price string 购买价格
accountId string 子账户的 ID,为空则使用主账户创建订单

响应

字段名称 类型 描述
id string 订单ID
symbol string 交易对
type string 订单类型
side string 订单方向
price string 订单价格
averagePrice string 平均订单价格
amount string 订单数量,即基础货币的数量
filledAmount string 成交数量,即订单中已成交的基础货币数量
value string 订单金额,即报价货币的数量
filledValue string 成交金额,即订单中已成交的报价货币的数量
filledFee string 已成交的手续费
status string 订单状态(详见订单简介)
timestamp number 订单创建时间戳

下限价卖单

创建一笔新的限价卖订单

curl -X POST \
  'https://api.novadax.com/v1/orders/create' \
  -H 'Content-Type: application/json' \
  -H 'X-Nova-Access-Key: your access key' \
  -H 'X-Nova-Signature: signature' \
  -H 'X-Nova-Timestamp: timestamp now' \
  -d '{
    "symbol": "BTC_BRL",
    "type": "LIMIT",
    "side": "SELL",
    "price": "35000.00",
    "amount": "0.001"
  }'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')

result = nova_client.create_order('BTC_BRL', 'LIMIT', 'SELL', price = '35000.00', amount = '0.001')

print(result)

返回值

{
    "code": "A10000",
    "data": {
        "amount": "0.001",
        "averagePrice": null,
        "filledAmount": "0",
        "filledFee": "0",
        "filledValue": "0",
        "id": "633680805433102336",
        "price": "35000",
        "side": "SELL",
        "status": "PROCESSING",
        "symbol": "BTC_BRL",
        "timestamp": 1571122877244,
        "type": "LIMIT",
        "value": "35"
    },
    "message": "Success"
}

请求地址

POST /v1/orders/create

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对,例如 BTC_BRL
type string 订单类型,固定值 LIMIT
side string 订单方向,固定值 SELL
amount string 订单数量,即基础货币的数量,如限价出售 BTC_BRL 交易对中 BTC 的数量
price string 出售价格
accountId string 子账户的 ID,为空则使用主账户创建订单

响应

字段名称 类型 描述
id string 订单ID
symbol string 交易对
type string 订单类型
side string 订单方向
price string 订单价格
averagePrice string 平均订单价格
amount string 订单数量,即基础货币的数量
filledAmount string 成交数量,即订单中已成交的基础货币数量
value string 订单金额,即报价货币的数量
filledValue string 成交金额,即订单中已成交的报价货币的数量
filledFee string 已成交的手续费
status string 订单状态(详见订单简介)
timestamp number 订单创建时间戳

下市价买单

创建一笔新的市价买订单

curl -X POST \
  'https://api.novadax.com/v1/orders/create' \
  -H 'Content-Type: application/json' \
  -H 'X-Nova-Access-Key: your access key' \
  -H 'X-Nova-Signature: signature' \
  -H 'X-Nova-Timestamp: timestamp now' \
  -d '{
    "symbol": "BTC_BRL",
    "type": "MARKET",
    "side": "BUY",
    "value": "10.00"
  }'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')

result = nova_client.create_order('BTC_BRL', 'MARKET', 'BUY', value = '10.00')

print(result)

返回值

{
    "code": "A10000",
    "data": {
        "amount": null,
        "averagePrice": null,
        "filledAmount": "0",
        "filledFee": "0",
        "filledValue": "0",
        "id": "633681498843828224",
        "price": null,
        "side": "BUY",
        "status": "PROCESSING",
        "symbol": "BTC_BRL",
        "timestamp": 1571123042566,
        "type": "MARKET",
        "value": "10"
    },
    "message": "Success"
}

请求地址

POST /v1/orders/create

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对,例如 BTC_BRL
type string 订单类型,固定值 MARKET
side string 订单方向,固定值 BUY
value string 交易金额,即报价币的数量,如市价购买 BTC_BRL 交易对中 BRL 的数量
accountId string 子账户的 ID,为空则使用主账户创建订单

响应

字段名称 类型 描述
id string 订单ID
symbol string 交易对
type string 订单类型
side string 订单方向
price string 订单价格
averagePrice string 平均订单价格
amount string 订单数量,即基础货币的数量
filledAmount string 成交数量,即订单中已成交的基础货币数量
value string 订单金额,即报价货币的数量
filledValue string 成交金额,即订单中已成交的报价货币的数量
filledFee string 已成交的手续费
status string 订单状态(详见订单简介)
timestamp number 订单创建时间戳

下市价卖单

创建一笔新市价卖订单

curl -X POST \
  'https://api.novadax.com/v1/orders/create' \
  -H 'Content-Type: application/json' \
  -H 'X-Nova-Access-Key: your access key' \
  -H 'X-Nova-Signature: signature' \
  -H 'X-Nova-Timestamp: timestamp now' \
  -d '{
    "symbol": "BTC_BRL",
    "type": "MARKET",
    "side": "SELL",
    "amount": "0.001"
  }'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')

result = nova_client.create_order('BTC_BRL', 'MARKET', 'SELL', amount = '0.001')

print(result)

返回值

{
    "code": "A10000",
    "data": {
        "amount": "0.001",
        "averagePrice": null,
        "filledAmount": "0",
        "filledFee": "0",
        "filledValue": "0",
        "id": "633682053058187264",
        "price": null,
        "side": "SELL",
        "status": "PROCESSING",
        "symbol": "BTC_BRL",
        "timestamp": 1571123174702,
        "type": "MARKET",
        "value": null
    },
    "message": "Success"
}

请求地址

POST /v1/orders/create

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对,例如 BTC_BRL
type string 订单类型,固定值 MARKET
side string 订单方向,固定值 SELL
amount string 订单数量,即基础币的数量,如市价出售 BTC_BRL 交易对中 BTC 的数量
accountId string 子账户的 ID,为空则使用主账户创建订单

响应

字段名称 类型 描述
id string 订单ID
symbol string 交易对
type string 订单类型
side string 订单方向
price string 订单价格
averagePrice string 平均订单价格
amount string 订单数量,即基础货币的数量
filledAmount string 成交数量,即订单中已成交的基础货币数量
value string 订单金额,即报价货币的数量
filledValue string 成交金额,即订单中已成交的报价货币的数量
filledFee string 已成交的手续费
status string 订单状态(详见订单简介)
timestamp number 订单创建时间戳

下限价止盈止损买单

创建一笔新的限价买订单

curl -X POST \
  'https://api.novadax.com/v1/orders/create' \
  -H 'Content-Type: application/json' \
  -H 'X-Nova-Access-Key: your access key' \
  -H 'X-Nova-Signature: signature' \
  -H 'X-Nova-Timestamp: timestamp now' \
  -d '{
    "symbol": "BTC_BRL",
    "type": "STOP_LIMIT",
    "side": "BUY",
    "price": "210000",
    "amount": "0.001",
    "operator: "GTE",
    "stopPrice: "211000"
  }'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')

result = nova_client.create_order('BTC_BRL', 'STOP_LIMIT', 'BUY', price='210000', amount='0.001', operator='GTE', stop_price="211000")

print(result)

返回值

{
    "code": "A10000",
    "data": {
        "amount": "0.001",
        "averagePrice": null,
        "filledAmount": "0",
        "filledFee": "0",
        "filledValue": "0",
        "id": "870613508008464384",
        "operator": "GTE",
        "price": "210000",
        "side": "BUY",
        "status": "SUBMITTED",
        "stopPrice": "211000",
        "symbol": "BTC_BRL",
        "timestamp": 1627612035528,
        "type": "STOP_LIMIT",
        "value": "210"
    },
    "message": "Success"
}

请求地址

POST /v1/orders/create

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对,例如 BTC_BRL
type string 订单类型,固定值 STOP_LIMIT
side string 订单方向,固定值 BUY
amount string 订单数量,即基础货币的数量,如限价购买 BTC_BRL 交易对中 BTC 的数量
price string 购买价格
operator string 止盈止损交易运算符(详见订单简介)
stopPrice string 止盈止损触发价格
accountId string 子账户的 ID,为空则使用主账户创建订单

响应

字段名称 类型 描述
id string 订单ID
symbol string 交易对
type string 订单类型
side string 订单方向
price string 订单价格
averagePrice string 平均订单价格
amount string 订单数量,即基础货币的数量
filledAmount string 成交数量,即订单中已成交的基础货币数量
value string 订单金额,即报价货币的数量
filledValue string 成交金额,即订单中已成交的报价货币的数量
filledFee string 已成交的手续费
operator string 止盈止损交易运算符(详见订单简介)
stopPrice string 止盈止损触发价格
status string 订单状态(详见订单简介)
timestamp number 订单创建时间戳

下限价止盈止损卖单

创建一笔新的限价卖订单

curl -X POST \
  'https://api.novadax.com/v1/orders/create' \
  -H 'Content-Type: application/json' \
  -H 'X-Nova-Access-Key: your access key' \
  -H 'X-Nova-Signature: signature' \
  -H 'X-Nova-Timestamp: timestamp now' \
  -d '{
    "symbol": "BTC_BRL",
    "type": "STOP_LIMIT",
    "side": "SELL",
    "price": "180000",
    "stopPrice":"190000",
    "operator":"LTE",
    "amount": "0.001"
  }'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')

result = nova_client.create_order('BTC_BRL', 'STOP_LIMIT', 'SELL', price='180000', amount='0.001', operator='LTE', stop_price="190000")

print(result)

返回值

{
    "code": "A10000",
    "data": {
        "amount": "0.001",
        "averagePrice": null,
        "filledAmount": "0",
        "filledFee": "0",
        "filledValue": "0",
        "id": "870616419635580928",
        "operator": "LTE",
        "price": "180000",
        "side": "SELL",
        "status": "SUBMITTED",
        "stopPrice": "190000",
        "symbol": "BTC_BRL",
        "timestamp": 1627612729713,
        "type": "STOP_LIMIT",
        "value": "180"
    },
    "message": "Success"
}

请求地址

POST /v1/orders/create

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对,例如 BTC_BRL
type string 订单类型,固定值 STOP_LIMIT
side string 订单方向,固定值 SELL
amount string 订单数量,即基础货币的数量,如限价出售 BTC_BRL 交易对中 BTC 的数量
price string 出售价格
operator string 止盈止损交易运算符(详见订单简介)
stopPrice string 止盈止损触发价格
accountId string 子账户的 ID,为空则使用主账户创建订单

响应

字段名称 类型 描述
id string 订单ID
symbol string 交易对
type string 订单类型
side string 订单方向
price string 订单价格
averagePrice string 平均订单价格
amount string 订单数量,即基础货币的数量
filledAmount string 成交数量,即订单中已成交的基础货币数量
value string 订单金额,即报价货币的数量
filledValue string 成交金额,即订单中已成交的报价货币的数量
filledFee string 已成交的手续费
operator string 止盈止损交易运算符(详见订单简介)
stopPrice string 止盈止损触发价格
status string 订单状态(详见订单简介)
timestamp number 订单创建时间戳

下市价止盈止损买单

创建一笔新的市价买订单

curl -X POST \
  'https://api.novadax.com/v1/orders/create' \
  -H 'Content-Type: application/json' \
  -H 'X-Nova-Access-Key: your access key' \
  -H 'X-Nova-Signature: signature' \
  -H 'X-Nova-Timestamp: timestamp now' \
  -d '{
    "symbol": "BTC_BRL",
    "type": "STOP_MARKET",
    "side": "BUY",
    "value": "10.00",
    "stopPrice": "211000",
    "operator": "GTE"
  }'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')

result = nova_client.create_order('BTC_BRL', 'STOP_MARKET', 'BUY', value='25', operator="GTE", stop_price="211000")

print(result)

返回值

{
    "code": "A10000",
    "data": {
        "amount": null,
        "averagePrice": null,
        "filledAmount": "0",
        "filledFee": "0",
        "filledValue": "0",
        "id": "870617243765985280",
        "operator": "GTE",
        "price": "205118.95",
        "side": "BUY",
        "status": "SUBMITTED",
        "stopPrice": "211000",
        "symbol": "BTC_BRL",
        "timestamp": 1627612926202,
        "type": "STOP_MARKET",
        "value": "25"
    },
    "message": "Success"
}

请求地址

POST /v1/orders/create

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对,例如 BTC_BRL
type string 订单类型,固定值 STOP_MARKET
side string 订单方向,固定值 BUY
value string 交易金额,即报价币的数量,如市价购买 BTC_BRL 交易对中 BRL 的数量
operator string 止盈止损交易运算符(详见订单简介)
stopPrice string 止盈止损触发价格
accountId string 子账户的 ID,为空则使用主账户创建订单

响应

字段名称 类型 描述
id string 订单ID
symbol string 交易对
type string 订单类型
side string 订单方向
price string 订单价格
averagePrice string 平均订单价格
amount string 订单数量,即基础货币的数量
filledAmount string 成交数量,即订单中已成交的基础货币数量
value string 订单金额,即报价货币的数量
filledValue string 成交金额,即订单中已成交的报价货币的数量
filledFee string 已成交的手续费
operator string 止盈止损交易运算符(详见订单简介)
stopPrice string 止盈止损触发价格
status string 订单状态(详见订单简介)
timestamp number 订单创建时间戳

下市价止盈止损卖单

创建一笔新市价卖订单

curl -X POST \
  'https://api.novadax.com/v1/orders/create' \
  -H 'Content-Type: application/json' \
  -H 'X-Nova-Access-Key: your access key' \
  -H 'X-Nova-Signature: signature' \
  -H 'X-Nova-Timestamp: timestamp now' \
  -d '{
    "symbol": "BTC_BRL",
    "type": "STOP_MARKET",
    "side": "SELL",
    "amount": "0.001",
    "stopPrice": "180000",
    "operator": "LTE"
  }'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')

result = nova_client.create_order('BTC_BRL', 'STOP_MARKET', 'SELL', amount='0.001', operator="LTE", stop_price="180000")

print(result)

返回值

{
    "code": "A10000",
    "data": {
        "amount": "0.001",
        "averagePrice": null,
        "filledAmount": "0",
        "filledFee": "0",
        "filledValue": "0",
        "id": "870617706309636096",
        "operator": "LTE",
        "price": "204712.39",
        "side": "SELL",
        "status": "SUBMITTED",
        "stopPrice": "180000",
        "symbol": "BTC_BRL",
        "timestamp": 1627613036480,
        "type": "STOP_MARKET",
        "value": null
    },
    "message": "Success"
}

请求地址

POST /v1/orders/create

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对,例如 BTC_BRL
type string 订单类型,固定值 STOP_MARKET
side string 订单方向,固定值 SELL
amount string 订单数量,即基础币的数量,如市价出售 BTC_BRL 交易对中 BTC 的数量
operator string 止盈止损交易运算符(详见订单简介)
stopPrice string 止盈止损触发价格
accountId string 子账户的 ID,为空则使用主账户创建订单

响应

字段名称 类型 描述
id string 订单ID
symbol string 交易对
type string 订单类型
side string 订单方向
price string 订单价格
averagePrice string 平均订单价格
amount string 订单数量,即基础货币的数量
filledAmount string 成交数量,即订单中已成交的基础货币数量
value string 订单金额,即报价货币的数量
filledValue string 成交金额,即订单中已成交的报价货币的数量
filledFee string 已成交的手续费
operator string 止盈止损交易运算符(详见订单简介)
stopPrice string 止盈止损触发价格
status string 订单状态(详见订单简介)
timestamp number 订单创建时间戳

撤销订单

提交订单撤销请求

curl -X POST \
  'https://api.novadax.com/v1/orders/cancel' \
  -H 'Content-Type: application/json' \
  -H 'X-Nova-Access-Key: your access key' \
  -H 'X-Nova-Signature: signature' \
  -H 'X-Nova-Timestamp: timestamp now' \
  -d '{
    "id": "608705793440616448"
  }'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')

result = nova_client.cancle_order("608705793440616448")

print(result)

返回值

{
    "code": "A10000",
    "data": {
        "result": true
    },
    "message": "Success"
}

请求地址

POST /v1/orders/cancel

请求参数

字段名称 是否必填 类型 描述
id string 订单ID

响应

字段名称 类型 描述
result string 撤销请求提交结果

查询订单详情

查询订单最新状态和详情。通过API创建的订单,撤销超过2小时后无法查询。

curl -X GET \
  'https://api.novadax.com/v1/orders/get?id=608695623247466496' \
  -H 'X-Nova-Access-Key: your access key' \
  -H 'X-Nova-Signature: signature' \
  -H 'X-Nova-Timestamp: timestamp now'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')

result = nova_client.get_order('608695623247466496')

print(result)

返回值

{
    "code": "A10000",
    "data": {
        "id": "608695623247466496",
        "symbol": "BTC_BRL",
        "type": "MARKET",
        "side": "SELL",
        "price": null,
        "averagePrice": "0",
        "amount": "0.123",
        "filledAmount": "0",
        "value": null,
        "filledValue": "0",
        "filledFee": "0",
        "stopPrice": null,
        "operator": null,
        "status": "REJECTED",
        "timestamp": 1565165945588
    },
    "message": "Success"
}

请求地址

GET /v1/orders/get

请求参数

字段名称 是否必填 类型 描述
id string 订单ID

响应

字段名称 类型 描述
id string 订单ID
symbol string 交易对
type string 订单类型
side string 订单方向
price string 订单价格
averagePrice string 平均订单价格
amount string 订单数量,即基础货币的数量
filledAmount string 成交数量,即订单中已成交的基础货币数量
value string 订单金额,即报价货币的数量
filledValue string 成交金额,即订单中已成交的报价货币的数量
filledFee string 已成交的手续费
status string 订单状态(详见订单简介)
timestamp number 订单创建时间戳

查询历史订单

基于指定条件查询历史订单。通过API创建的订单,撤销超过2小时后无法查询。

curl -X GET \
  'https://api.novadax.com/v1/orders/list?symbol=BTC_BRL&status=FINISHED&fromId=608705793440616448&toId=608694995137859584&limit=100' \
  -H 'X-Nova-Access-Key: your access key' \
  -H 'X-Nova-Signature: signature' \
  -H 'X-Nova-Timestamp: timestamp now'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')

result = nova_client.list_orders('BTC_BRL', status = 'FINISHED', from_id = '608705793440616448', to_id = '608694995137859584', limit = '100')

print(result)

返回值

{
    "code": "A10000",
    "data": [
        {
            "id": "608695678650028032",
            "symbol": "BTC_BRL",
            "type": "MARKET",
            "side": "SELL",
            "price": null,
            "averagePrice": "0",
            "amount": "0.123",
            "filledAmount": "0",
            "value": null,
            "filledValue": "0",
            "filledFee": "0",
            "stopPrice": null,
            "operator": null,
            "status": "REJECTED",
            "timestamp": 1565165958796
        },
        {
            "id": "608695623247466496",
            "symbol": "BTC_BRL",
            "type": "MARKET",
            "side": "SELL",
            "price": null,
            "averagePrice": "0",
            "amount": "0.123",
            "filledAmount": "0",
            "value": null,
            "filledValue": "0",
            "filledFee": "0",
            "stopPrice": null,
            "operator": null,
            "status": "REJECTED",
            "timestamp": 1565165945588
        }
    ],
    "message": "Success"
}

请求地址

GET /v1/orders/list

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对,例如BTC_BRL
status string 订单状态(详见订单简介),多个状态可用逗号分割。也可以用 FINISHED 查询未完结订单,或用 UNFINISHED 查询已完结订单
fromId string 从指定订单开始
toId string 从指定订单结束
fromTimestamp number 从指定时间开始,以订单创建时间查询,使用毫秒时间戳
toTimestamp number 从指定时间结束,以订单创建时间查询,使用毫秒时间戳
accountId string 子账户的 ID,为空则返回主账户创建的订单
limit string 返回条数,默认100条,最多100条

响应

字段名称 类型 描述
id string 订单ID
symbol string 交易对
type string 订单类型
side string 订单方向
price string 订单价格
averagePrice string 平均订单价格
amount string 订单数量,即基础货币的数量
filledAmount string 成交数量,即订单中已成交的基础货币数量
value string 订单金额,即报价货币的数量
filledValue string 成交金额,即订单中已成交的报价货币的数量
filledFee string 已成交的手续费
status string 订单状态(详见订单简介)
timestamp number 订单创建时间戳

查询成交明细

查询指定订单或历史成交明细

curl -X GET \
  'https://api.novadax.com/v1/orders/fills?orderId=608716957545402368' \
  -H 'X-Nova-Access-Key: your access key' \
  -H 'X-Nova-Signature: signature' \
  -H 'X-Nova-Timestamp: timestamp now'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')

result = nova_client.list_order_fills('608716957545402368')

print(result)

返回值

{
    "code": "A10000",
    "data": [
        {
            "id": "608717046691139584",
            "orderId": "608716957545402368",
            "symbol": "BTC_BRL",
            "side": "BUY",
            "amount": "0.0988",
            "price": "45514.76",
            "fee": "0.0000988 BTC",
            "feeAmount": "0.0000988",
            "feeCurrency": "BTC",
            "role": "MAKER",
            "timestamp": 1565171053345
        },
        {
            "id": "608717065729085441",
            "orderId": "608716957545402368",
            "symbol": "BTC_BRL",
            "side": "BUY",
            "amount": "0.0242",
            "price": "45514.76",
            "fee": "0.0000242 BTC",
            "feeAmount": "0.0000242",
            "feeCurrency": "BTC",
            "role": "MAKER",
            "timestamp": 1565171057882
        }
    ],
    "message": "Success"
}

请求地址

GET /v1/orders/fills

请求参数

字段名称 是否必填 类型 描述
orderId string 订单ID
symbol string 交易对,例如BTC_BRL
fromId string 从指定成交 ID 开始
toId string 从指定成交 ID 结束
fromTimestamp number 从指定时间开始,以成交时间查询,使用毫秒时间戳
toTimestamp number 从指定时间结束,以成交时间查询,使用毫秒时间戳
limit string 返回条数,默认100条,最多100条
accountId string 子账户的 ID,为空则返回主账户的成交明细

响应

字段名称 类型 描述
id string 成交ID
orderId string 订单ID
symbol string 交易对
side string 交易方向(详见订单简介)
price string 成交价格
amount string 成交数量
fee string 手续费
feeCurrency string 手续费币种
feeAmount string 手续费数量
role string 成交角色(详见订单简介)
timestamp number 成交时间,毫秒时间戳

账户

账户余额

curl 'https://api.novadax.com/v1/account/getBalance'
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')

result = nova_client.get_account_balance()

print(result)

Response Content

{
    "code": "A10000",
    "data": [
        {
            "available": "1.23",
            "balance": "0.23",
            "currency": "BTC",
            "hold": "1"
        }
    ],
    "message": "Success"
}

请求地址

GET /v1/account/getBalance

请求返回

数据 数据类型 描述
currency string 币种
balance string 总余额
hold string 冻结金额
available string 可用余额

提币

curl -X POST \
  'https://api.novadax.com/v1/account/withdraw/coin' \
  -H 'Content-Type: application/json' \
  -H 'X-Nova-Access-Key: your access key' \
  -H 'X-Nova-Signature: signature' \
  -H 'X-Nova-Timestamp: timestamp now' \
  -d '{
    "code": "BTC",
    "amount": "1",
    "wallet": "your to_address"
  }'
from novadax import RequestClient as NovaClient
nova_client = NovaClient('your access key', 'your secret key')
result = nova_client.withdraw_coin("BTC","1",'...')
print(result)

Response Content

{
  "code":"A10000",
  "data": "DR123",
  "message":"Success"
}

请求地址

POST /v1/account/withdraw/coin

请求参数

参数 是否需要 数据类型 描述
code ture string 币种code, 如BTC
amount true string 提币金额
wallet true string 提币地址
chainAlias true string 提币chain,默认第一个上线币
tag false string 地址tag/memo,标识用户,需要的币种:BNB,XRP,XLM.

子账户列表

curl "https://api.novadax.com/v1/account/subs"
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')
subs = self.api.subs()

Response Content

{
    "code": "A10000",
    "data": [{
        "subId": "CA648856083527372800",
        "state": "Normal",
        "subAccount": "003",
        "subIdentify": "003"
    }],
    "message": "Success"
}

请求地址

GET /v1/account/subs

请求参数

No parameters are needed for this endpoint.

请求返回

Field Data Type Description
subId string Sub account ID
state string Sub account state, Normal/Frozen
subAccount string Sub account name
subIdentify string Sub account note

查询子账户余额

This endpoint returns the balance of sub account.

curl "https://api.novadax.com/v1/account/subs/balance?subId=xxx"
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')
ava = self.api.subs_balance(subId)

Response Content

{
    "code":"A10000",
    "data":[
        {
            "balance":"7.22",
            "currency":"BTC"
        }
    ],
    "message":"Success"
}

请求地址

GET /v1/account/subs/balance?subId=xxx

请求参数

参数 是否需要 数据类型 描述
subId ture string 子账户ID

请求返回

参数 数据类型 描述
balance string 账户余额
currency string 账户币种

子账户转账记录

curl "https://api.novadax.com/v1/account/subs/transfer/record?subId=xxx"
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')
ava = self.api.subs_transfer_record(subId)

Response Content

{
    "code": "A10000",
    "data": [{
        "subId": "CA648855702269333504",
        "amount": "103.22",
        "currency": "BRL",
        "state": "success",
        "type": "master-transfer-out"
    }, {
        "subId": "CA648855702269333504",
        "amount": "3.5",
        "currency": "BRL",
        "state": "success",
        "type": "master-transfer-in"
    }],
    "message": "Success"
}

请求地址

GET /v1/account/subs/transfer/record?subId=xxx

请求参数

参数 是否需要 类型 描述
subId ture string 子账户 ID

请求返回

Field Data Type Description
subId string Sub account ID
amount string Transfer amount
currency string Transfer currency
state string Transfer state: success/fail
type string Type: master-transfer-in (transfer into master account) or master-transfer-out (transfer from master account)

子账户转账


from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')
subId = 'CA648856083527372800'
assetCode = 'BTC'
transferAmount = '0.51'
transferType = 'master-transfer-out'
tid = self.api.subs_transfer(subId, assetCode, transferAmount, transferType);
print(tid)

Response Content

{
  "code":"A10000",
  "message":"Success",
  "data":40
}

请求地址

POST /v1/account/subs/transfer

请求参数

参数 需要 类型 描述
subId true string 子账户ID
currency true string 转账币
transferAmount true string 转账金额
transferType true string Type,master-transfer-in or master-transfer-out

请求返回

Data field returns the transfer record ID.

钱包

获取钱包存取记录

curl -X GET \
   'https://api.novadax.com/v1/wallet/query/deposit-withdraw?currency=BTC&type=coin_in&start=DR562339304588709888&size=10&direct=desc'\
     -H 'X-Nova-Access-Key: your access key' \
     -H 'X-Nova-Signature: signature' \
     -H 'X-Nova-Timestamp: timestamp now' \
from novadax import RequestClient as NovaClient
nova_client = NovaClient('your access key', 'your secret key')
result = nova_client.wallet_deposit_withdraw_record()
print(result)

返回内容

{
    "code": "A10000",
    "data": [{
        "id": "DR562339304588709888",
        "type": "COIN_IN",
        "currency": "XLM",
        "chain": "XLM",
        "address": "GCUTK7KHPJC3ZQJ3OMWWFHAK2OXIBRD4LNZQRCCOVE7A2XOPP2K5PU5Q",
        "addressTag": "1000009",
        "amount": 1.0,
        "state": "SUCCESS",
        "txHash": "39210645748822f8d4ce673c7559aa6622e6e9cdd7073bc0fcae14b1edfda5f4",
        "createdAt": 1554113737000,
        "updatedAt": 1601371273000
    }...],
    "message": "Success"
}

请求地址

GET /v1/wallet/query/deposit-withdraw

请求参数

参数 类型 需要 描述 默认值
currency string false 币种. BTC NA
type string false 记录类型 coin_in and coin_out
direct string false 排序规则,asc or desc asc
size int false 返回记录 100
start string false 记录ID NA

返回内容

参数 类型 描述
id string 记录ID
type string 记录类型
currency string 币种
txHash string hash
address string 地址
addressTag string 地址tag
chain string 区块链名字,internal走内部转账
amount decimal 金额
state string 状态
createdAt long 下单时间
updatedAt long 更新时间

记录状态

State 描述
Pending 待打款
x/M confirming 确认中, M 是需要的确认数
SUCCESS 成功
FAIL 失败

提币

curl -X POST \
  'https://api.novadax.com/v1/wallet/withdraw/coin' \
  -H 'Content-Type: application/json' \
  -H 'X-Nova-Access-Key: your access key' \
  -H 'X-Nova-Signature: signature' \
  -H 'X-Nova-Timestamp: timestamp now' \
  -d '{
    "code": "BTC",
    "amount": "1",
    "wallet": "your to_address"
  }'
from novadax import RequestClient as NovaClient
nova_client = NovaClient('your access key', 'your secret key')
result = nova_client.withdraw_coin("BTC","1",'...')
print(result)

Response Content

{
  "code":"A10000",
  "data": "DR123",
  "message":"Success"
}

请求地址

POST /v1/wallet/withdraw/coin

请求参数

参数 Mandatory 类型 描述
code ture string 币种 BTC
amount true string 提币金额
wallet true string 提币地址
chainAlias true string 提币地址所在的区块链简写,默认选择第一个上线币
tag false string 地址Tag,需要的币种 XLM, XRP, EOS等

返回内容

The data 参数 will return the withdrawal id.

支持的区块链查询

curl -X GET \
  'https://api.novadax.com/v1/wallet/crypto/chain/{code}' \
  -H 'Content-Type: application/json' \
  -H 'X-Nova-Access-Key: your access key' \
  -H 'X-Nova-Signature: signature' \
  -H 'X-Nova-Timestamp: timestamp now' \
from novadax import RequestClient as NovaClient

nova_client = NovaClient('your access key', 'your secret key')

result = nova_client.crypto_chain("ALL")

print(result)

请求地址

GET /crypto/chain/{code}

请求参数

parm r name param type param note
code String crypto accout code,默认值 is "ALL"

Response parameters

param name param type param note
accountCode String 账户使用code
accountType String 账户类型:DIGITAL,LEGAL
accountPrecision Integer 账户控制的精度
accountOrder Integer 账户显示顺序
accountState Integer 账户状态,1:in-use,0: off-use
tokens List 账户支持的token

Token列表

参数 类型 描述
codeAccount String 账户使用的code
chainAlias String 区块链简写
chainName String 区块链全名
mainAddr String 主地址
useMemo Integer 是否使用tag/memo
useDynamicSendFee String 是否动态手续费,1:using,0:not using
minConf Integer 最小确认数
useFirst Integer 是否是第一个支持的链
state Integer 是否在用,1:in-use,0:off-use
chainURL String 区块链地址
chainAddressURL String 区块链地址查询
chainHashURL String 区块链交易查询
officialURL String 官方网址

WebSocket

接入

NovaDAX WebSocket API 底层使用 Socket.io 实现,有关 Socket.IO 的更多详细信息,可参考 Socket.IO 官方网站。

地址

wss://api.novadax.com

// Socket.io 建立连接示例
const io = require("socket.io-client");

const socket = io("wss://api.novadax.com", {
transports: ['websocket']
});

// Socket.io 订阅示例
socket.emit("SUBSCRIBE", ["MARKET.BTC_USDT.TICKER", "MARKET.BTC_USDT.TRADE"])
socket.on("MARKET.BTC_USDT.TICKER", (ticker) => {
    console.log(ticker)
})
socket.on("MARKET.BTC_USDT.TRADE", (trade) => {
    console.log(trade)
})

// Socket.io 取消订阅示例
socket.emit("UNSUBSCRIBE", ["MARKET.BTC_USDT.DEPTH.LEVEL0"])

限制

订阅主题

当订阅相关主题,你将能收到相关主题下的所有推送,订阅格式

socket.emit("SUBSCRIBE", ["XXX"])

取消订阅

订阅主题后,如不想再收到对应主题的推送,可以取消订阅。取消订阅格式如下

socket.emit("UNSUBSCRIBE", ["XXX"])

订阅全部币对聚合行情

订阅后,将会每秒推送一次所有币对的 Ticker 数据

from novadax import WebSocketClient

nova_client = WebSocketClient('your access key(optional)', 'your secret key(optional)')

def tickers_handler(tickers):
    print('received tickers: ', tickers)

nova_client.sub_market_tickers(tickers_handler)

数据

[
  {
      "ask": "34708.15",
      "baseVolume24h": "34.08241488",
      "bid": "34621.74",
      "high24h": "35079.77",
      "lastPrice": "34669.81",
      "low24h": "34330.64",
      "open24h": "34492.08",
      "quoteVolume24h": "1182480.09502814",
      "symbol": "BTC_BRL",
      "timestamp": 1571112216346
  }
]

订阅主题

MARKET.TICKERS

响应

参数名 类型 描述
symbol string 币对名称
lastPrice string 最新成交价
bid string 买一价
ask string 卖一价
open24h string 24小时开盘价
high24h string 24小时最高价
low24h string 24小时最低价
baseVolume24h string 24小时成交量,按交易货币统计
quoteVolume24h string 24小时成交量,按计价货币统计
timestamp number 系统时间戳

订阅单个币对聚合行情

订阅后,将会每秒推送一次指定币对的 Ticker 数据

from novadax import WebSocketClient

nova_client = WebSocketClient('your access key(optional)', 'your secret key(optional)')

def ticker_handler(ticker):
    print('received ticker: ', ticker)

nova_client.sub_market_ticker("BTC_BRL", ticker_handler)

数据

{
    "ask": "34708.15",
    "baseVolume24h": "34.08241488",
    "bid": "34621.74",
    "high24h": "35079.77",
    "lastPrice": "34669.81",
    "low24h": "34330.64",
    "open24h": "34492.08",
    "quoteVolume24h": "1182480.09502814",
    "symbol": "BTC_BRL",
    "timestamp": 1571112216346
}

订阅主题

MARKET.{{symbol}}.TICKER

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对

响应

参数名 类型 描述
symbol string 币对名称
lastPrice string 最新成交价
bid string 买一价
ask string 卖一价
open24h string 24小时开盘价
high24h string 24小时最高价
low24h string 24小时最低价
baseVolume24h string 24小时成交量,按交易货币统计
quoteVolume24h string 24小时成交量,按计价货币统计
timestamp number 系统时间戳

订阅深度数据

订阅后,将会每秒推送一次指定币对的 Depth 数据

from novadax import WebSocketClient

nova_client = WebSocketClient('your access key(optional)', 'your secret key(optional)')

def depth_handler(depth):
    print('received depth: ', depth)

nova_client.sub_market_depth("BTC_BRL", depth_handler)

数据

{
    "asks": [
        ["43687.16", "0.5194"],
        ["43687.2", "1.3129"]
    ],
    "bids": [
        ["43657.57", "0.6135"],
        ["43657.46", "0.0559"]
    ],
    "timestamp": 1565057338020
}

订阅主题

MARKET.{{symbol}}.DEPTH.LEVEL0

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对

响应

字段名称 类型 描述
asks array 卖集合
asks[][0] string 卖的价格
asks[][1] string 卖的数量
bids array 买集合
bids[][0] string 买的价格
bids[][1] string 买的数量
timestamp number 时间戳

订阅成交数据

订阅后,当有成交后,将会推送成交信息

from novadax import WebSocketClient

nova_client = WebSocketClient('your access key(optional)', 'your secret key(optional)')

def trade_handler(trades):
    print('received trade: ', trades)

nova_client.sub_market_trade("BTC_BRL", trade_handler)

数据

[
    {
        "price": "43657.57",
        "amount": "1",
        "side": "SELL",
        "timestamp": 1565007823401
    },
    {
        "price": "43687.16",
        "amount": "0.071",
        "side": "BUY",
        "timestamp": 1565007198261
    }
]

订阅主题

MARKET.{{symbol}}.TRADE

请求参数

字段名称 是否必填 类型 描述
symbol string 交易对

响应

字段名称 类型 描述
price string 成交价格
amount string 成交数量
side string 成交方向,可能值:BUY、SELL
timestamp number 成交时间戳