Ticker price rule
@张文
【注】所有接口需在登录获取access_token之后进行访问
1.新增市场价格通知规则¶
1)规则通知方式三种,至少选取一种方式,同一方式下多个通知目标,可用英文逗号分隔
2)ruleName建议10个字符以内,替换通知时的交易币对,进行脱敏处理
3)signal为关注的价格方向,支持以下5种类型:>=, <=, >, <, =
4)交易类型仅限定于 SPOT, USD_FUTURE, COIN_FUTURE 三者其一
请求方式/地址¶
POST /dct-business-api/tools/addTickerPriceRule
请求参数¶
| 参数名 | 数据类型 | 描述 |
|---|---|---|
| access_token | String | 登录接口返回 |
| symbol | String | 具体交易币对 |
| signal | String | 关注价格的标识,支持以下5种类型:>=, <=, >, <, = |
| price | BigDecimal | 关注的具体价格 |
| ruleName | String | 交易币对的别名,具体通知时替换交易对,脱敏需要 |
| transactionType | String | 交易类型,支持以下三种:SPOT, USD_FUTURE, COIN_FUTURE |
| voiceCall | String | 电话通知方式,填具体的电话号码,多个号码用英文逗号分隔 |
| sms | String | 短信通知方式,填具体接收通知短信的电话号码,多个号码用英文逗号分隔 |
| workWechat | String | 企业微信通知方式,填企业微信机器人地址,多个地址用英文逗号分隔 |
接口响应结构
{
"code": "success",
"data": null,
"message": "规则新增成功"
}
{
"code": "runtime_error",
"data": null,
"message": "Required String parameter 'transactionType' is not present"
}
{
"code": "param_error",
"data": null,
"extra": null,
"message": "交易类型错误"
}
{
"code": "runtime_error",
"data": null,
"message": "规则新增失败,规则已存在"
}
python请求示例
python版本
import requests
url = "https://dct-internal.novadax.com/dct-business-api/tools/addTickerPriceRule"
payload={'access_token': 'your_login_access_token',
'symbol': 'BTCUSDT',
'signal': '>=',
'price': '40000',
'sms': '13611110000',
'workWechat': 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=37b36771-ea6a-49a6-a3fa-277c585',
'voiceCall': '13611110000',
'transactionType': 'SPOT',
'ruleName': 'newRule'}
files=[
]
headers = {}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
2.获取当前登录用户现有通知规则¶
查看当前登录用户下配置的所有规则
请求方式/地址¶
GET /dct-business-api/tools/getUserAllRules
请求参数¶
| 参数名 | 数据类型 | 描述 |
|---|---|---|
| access_token | String | 登录接口返回 |
响应数据结构
{
"code": "success",
"data": [
{
"id": 1414470562857402369,
"symbol": "BTCUSDT",
"predicate": ">",
"price": 38000.0000000000,
"userId": 20,
"userName": "user",
"notifyTarget": "10000000000",
"notifyType": "voice_call",
"transactionType": "SPOT",
"remainNotifyTimes": 3,
"nickname": "new rule"
},
{
"id": 1414477631127851009,
"symbol": "BTCUSDT",
"predicate": ">",
"price": 34398.0000000000,
"userId": 20,
"userName": "user",
"notifyTarget": "10000000000",
"notifyType": "voice_call",
"transactionType": "SPOT",
"remainNotifyTimes": 3,
"nickname": "second rule"
}
],
"extra": null,
"message": "请求成功"
}
{
"code": "success",
"data": [],
"extra": null,
"message": "请求成功"
}
python请求示例
import requests
url = "https://dct-internal.novadax.com/dct-business-api/tools/getUserAllRules?access_token=your_login_access_token"
payload={}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
3.删除登录用户下id对应规则¶
从获取用户规则接口获取规则id之后,删除当前登录用户下id对应规则
请求方式/地址¶
GET /dct-business-api/tools/removeTickerPriceRuleById
请求参数¶
| 参数名 | 数据类型 | 描述 |
|---|---|---|
| access_token | String | 登录接口返回 |
| id | Long | 删除规则的id,从获取登录用户规则接口获取 |
响应数据数据结构
{
"code": "success",
"data": null,
"extra": null,
"message": "规则删除成功"
}
{
"code": "param_error",
"data": null,
"message": "规则删除异常,规则不存在"
}
python请求示例
import requests
url = "https://dct-internal.novadax.com/dct-business-api/tools/removeTickerPriceRuleById?access_token=your_login_access_token&id=delete_rule_id"
payload={}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)