API Reference
DBot OfficialDBot DashboardPricing

创建限价订单(WS)

用于创建多链的限价买入和限价卖出任务

FreePlusProEnterprise积分消耗
0

URL

wss://api-bot-v1.dbotx.com/trade/ws/

说明

为保证WebSocket连接的可用性和稳定性,需要至少每1分钟(建议每30-55秒)进行一次心跳订阅,否则系统会自动断开超时链接

请求示例

{
    "id": 1761291309, // 调用id,响应结果返回相同ID
    "method": "createLimitOrder", // 调用创建限价订单方法
    "params": {
        "chain": "solana", // 链 (solana/ethereum/base/bsc/tron)
        "pair": "BAS6Cv5qG2FnEQ8W1wXKGfU2r6MFAiSdgGgkUM7NsStE", // 需要买入/卖出的代币地址或交易对地址
        "walletId": "mglnkaeh0009pd", // 使用的钱包的id,可通过“钱包信息 API”获取
        "groupId": "m53gevri055ird", // 分组id
        "settings": [
            {
                "enabled": true, // "true"表示启用买入任务
                "tradeType": "buy", // "buy"表示创建买入限价单,"sell"表示创建卖出限价单
                "triggerPriceUsd": "0.022348210260", // 触发买入/卖出的价格(美元)
                "triggerDirection": "down", // "down"表示低于触发价格时执行买入/卖出,"up"表示高于触发价格时执行买入/卖出
                "currencyAmountUI": "0.1", // 交易类型为buy时,填写买入金额(ETH/SOL/BNB/TRX),交易类型为sell时,填写卖出比例(0.00-1.00)
                "customFeeAndTip": false, // "true"表示优先费 (priorityFee) 和贿赂费 (jitoTip) 两个字段均有效,系统将按填写的值执行交易 (null表示自动优先费/自动贿赂费),"false"表示高速模式下只有优先费 (priorityFee) 有效,防夹模式下只有贿赂费 (jitoTip) 有效,系统将自动进行分配
                "priorityFee": "", // 优先费 (SOL),对Solana有效,空字符串表示使用自动优先费
                "gasFeeDelta": 5, // 额外增加的gas (Gwei),对EVM链有效
                "maxFeePerGas": 100, // 基础gas超过此值时将不进行交易 (Gwei),对EVM链有效
                "jitoEnabled": true, // "true"表示启用防夹模式 (Solana & Ethereum & Bsc)
                "jitoTip": 0.001, // 防夹模式使用的贿赂费 (Solana),"jitoEnabled"或"customFeeAndTip"为true时必填 (null表示自动优先费/自动贿赂费)
                "expireDelta": 360000000, // 止盈止损任务的过期时间,最大值为432000000 (毫秒)
                "expireExecute": false, // "true"表示止盈止损任务创建后若有效期内未触发,则在任务结束时自动执行
                "useMidPrice": false, // "true"表示启用防插针模式,将使用1秒内的中间价格作为触发价,会尽可能但无法100%保证避免插针
                "maxSlippage": 0.1, // 最大滑点(0.00-1.00),买入时表示实际成交价格和期望价格之间的差距,卖出时表示期望价格和实际成交价格之间的差距,相差倍数=1/(1-滑点),0.5即最多接受2倍价差,1 即不限制价差
                "concurrentNodes": 2, // 并发节点数(1-3)
                "retries": 1 // 失败后的重试次数(0-10)
            },
            {
                "enabled": true, // "true"表示启用限价卖出
                "tradeType": "sell", // "buy"表示创建买入限价单,"sell"表示创建卖出限价单
                "triggerPriceUsd": "1.5", // 触发买入/卖出的价格(美元)
                "triggerDirection": "up", // "down"表示低于触发价格时执行买入/卖出,"up"表示高于触发价格时执行买入/卖出
                "customFeeAndTip": false, // "true"表示优先费 (priorityFee) 和贿赂费 (jitoTip) 两个字段均有效,系统将按填写的值执行交易 (null表示自动优先费/自动贿赂费),"false"表示高速模式下只有优先费 (priorityFee) 有效,防夹模式下只有贿赂费 (jitoTip) 有效,系统将自动进行分配
                "priorityFee": "0.00005", // 优先费 (SOL),对Solana有效,空字符串表示使用自动优先费
                "currencyAmountUI": 1, // 交易类型为buy时,填写买入金额(ETH/SOL/BNB/TRX),交易类型为sell时,填写卖出比例(0.00-1.00)
                "gasFeeDelta": 5, // 额外增加的gas (Gwei),对EVM链有效
                "maxFeePerGas": 100, // 基础gas超过此值时将不进行交易 (Gwei),对EVM链有效
                "jitoEnabled": true, // "true"表示启用防夹模式 (Solana & Ethereum & Bsc)
                "jitoTip": 0.001, // 防夹模式使用的贿赂费 (Solana),"jitoEnabled"或"customFeeAndTip"为true时必填 (null表示自动优先费/自动贿赂费)
                "expireDelta": 360000000, // 止盈止损任务的过期时间,最大值为432000000 (毫秒)
                "expireExecute": false, // "true"表示止盈止损任务创建后若有效期内未触发,则在任务结束时自动执行
                "useMidPrice": false, // "true"表示启用防插针模式,将使用1秒内的中间价格作为触发价,会尽可能但无法100%保证避免插针
                "maxSlippage": 0.1, // 最大滑点(0.00-1.00),买入时表示实际成交价格和期望价格之间的差距,卖出时表示期望价格和实际成交价格之间的差距,相差倍数=1/(1-滑点),0.5即最多接受2倍价差,1 即不限制价差
                "concurrentNodes": 2, // 并发节点数(1-3)
                "retries": 1 // 失败后的重试次数(0-10)
            }
        ]
    }
}

响应数据

{
    "method": "rpcResponse", // rpc响应
    "id": 1761291309, // 调用id
    "result": {
        "err": false, // 是否发生错误
        "res": [
            {
                "id": "mh378onq0009bf",
                "accountId": "lz99kwxp0006q0", // 用户id
                "enabled": true, // 任务启用状态,true/false
                "chain": "solana", // 链 (solana/ethereum/base/bsc/tron)
                "pairType": "raydium_amm", // 来源于哪个DEX
                "pairFee": null, // 代币交易手续费
                "pair": "BAS6Cv5qG2FnEQ8W1wXKGfU2r6MFAiSdgGgkUM7NsStE", // 交易对合约地址
                "token": "6iFUKWGDksVvmnSYJUGYnsu168xstni8xJkTF7QrpPAu", // 代币地址
                "tokenInfo": { // 代币信息
                    "contract": "6iFUKWGDksVvmnSYJUGYnsu168xstni8xJkTF7QrpPAu",
                    "name": "Candle Cat",
                    "symbol": "CANDLE",
                    "decimals": 6,
                    "icon": "https://cf-ipfs.com/ipfs/QmbZRtksXcwZsRyt6hat5oiSQJLgme3YqeA6Q2o8xnQn1t",
                    "totalSupply": "216477902092625",
                    "tokenProgram": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
                    "mintAuthority": null,
                    "freezeAuthority": null,
                    "createAt": null // 创建时间 (毫秒时间戳)
                },
                "currency": "So11111111111111111111111111111111111111112", // 主币地址
                "currencyInfo": { // 主币信息
                    "contract": "So11111111111111111111111111111111111111112",
                    "symbol": "SOL",
                    "decimals": 9,
                    "icon": "https://assets-cdn.trustwallet.com/blockchains/solana/assets/So11111111111111111111111111111111111111112/logo.png",
                    "totalSupply": null
                },
                "pairCurrency": null,
                "pairCurrencyInfo": null,
                "walletId": "mglnkaeh0006pd", // 使用的钱包的id,可通过“钱包信息 API”获取
                "groupId": null, // 分组id
                "groupName": null,
                "tradeType": "buy", // 交易类型,值为buy和sell
                "triggerDirection": "down", // “down”表示低于触发价格时执行买入/卖出,“up”表示高于触发价格时执行买入/卖出
                "triggerPriceUsd": 0.02234821026, // 触发买入/卖出的价格(美元)
                "currencyAmountUI": 0.1, // 交易类型为buy时,填写买入金额(ETH/SOL/BNB/TRX),交易类型为sell时,填写卖出比例(0.00-1.00)
                "expireDelta": 360000000, // 任务有效时长,最大值为432000000 (毫秒)
                "expireAt": 1761570470870, // 任务过期时间 (毫秒时间戳)
                "expireExecute": false, // 过期执行标志,true/false
                "useMidPrice": false, // "true"表示启用防插针模式,将使用1秒内的中间价格作为触发价
                "gasFeeDelta": 5, // 额外增加的gas (Gwei),对EVM链有效
                "maxFeePerGas": 100, // 基础gas超过此值时将不进行交易 (Gwei),对EVM链有效
                "priorityFee": "", // 优先费 (SOL),对Solana有效,空字符串表示使用自动优先费
                "maxSlippage": 0.1, // 最大滑点(0.00-1.00),卖出时表示期望价格和实际成交价格之间的差距
                "retries": 1, // 失败后的重试次数(0-10)
                "concurrentNodes": 2, // 并发节点数(1-3)
                "jitoEnabled": true, // "true"表示启用防夹模式 (Solana & Ethereum & Bsc)
                "jitoTip": 0.001, // 防夹模式使用的贿赂费 (Solana)
                "customFeeAndTip": false, // "true"表示优先费 (priorityFee) 和贿赂费 (jitoTip) 两个字段均有效,"false"表示高速模式下只有优先费 (priorityFee) 有效,防夹模式下只有贿赂费 (jitoTip) 有效
                "state": "init", // 订单状态,init:初始化,processing:进行中,done:已完成,fail:已失败,expired:已过期
                "lastStateUpdateAt": 1761210470870,
                "createAt": 1761210470870, // 创建时间 (毫秒时间戳)
                "updateAt": 1761210470870
            } 
        ]
    }
}

以NodeJS为例

const WebSocket = require('ws')

function main() {
  const ws = new WebSocket('wss://api-data-v1.dbotx.com/trade/ws/', {
    headers: {
      'x-api-key': 'YOUR_API_KEY',
    },
  })

  ws.on('open', () => {
    ws.send(
      JSON.stringify({
        "id": 1761291309,
        "method": "createLimitOrder",
        "params": {
          "chain": "solana",
          "pair": "BAS6Cv5qG2FnEQ8W1wXKGfU2r6MFAiSdgGgkUM7NsStE",
          "walletId": "mglnkaeh0009pd",
          "groupId": "m53gevri055ird",
          "settings": [
            {
              "enabled": true,
              "tradeType": "buy",
              "triggerPriceUsd": "0.022348210260",
              "triggerDirection": "down",
              "currencyAmountUI": "0.1",
              "customFeeAndTip": false,
              "priorityFee": "",
              "gasFeeDelta": 5,
              "maxFeePerGas": 100,
              "jitoEnabled": true,
              "jitoTip": 0.001,
              "expireDelta": 360000000,
              "expireExecute": false,
              "useMidPrice": false,
              "maxSlippage": 0.1,
              "concurrentNodes": 2,
              "retries": 1
            },
            {
              "enabled": true,
              "tradeType": "sell",
              "triggerPriceUsd": "1.5",
              "triggerDirection": "up",
              "customFeeAndTip": false,
              "priorityFee": "0.00005",
              "currencyAmountUI": 1,
              "gasFeeDelta": 5,
              "maxFeePerGas": 100,
              "jitoEnabled": true,
              "jitoTip": 0.001,
              "expireDelta": 360000000,
              "expireExecute": false,
              "useMidPrice": false,
              "maxSlippage": 0.1,
              "concurrentNodes": 2,
              "retries": 1
            }
          ]
        }
      })
    )

    setInterval(() => {
      ws.ping()
    }, 30000)
  })

  ws.on('message', res => {
    console.log('res:', res.toString('utf-8'))
  })
}

main()

以Python为例

import asyncio
import websockets
import json

async def main():
    uri = "wss://api-data-v1.dbotx.com/trade/ws/"
    headers = {"x-api-key": "YOUR_API_KEY"}
    msg = {
        "id": 1761291309,
        "method": "createLimitOrder",
        "params": {
            "chain": "solana",
            "pair": "BAS6Cv5qG2FnEQ8W1wXKGfU2r6MFAiSdgGgkUM7NsStE",
            "walletId": "mglnkaeh0009pd",
            "groupId": "m53gevri055ird",
            "settings": [
                {
                    "enabled": True,
                    "tradeType": "buy",
                    "triggerPriceUsd": "0.022348210260",
                    "triggerDirection": "down",
                    "currencyAmountUI": "0.1",
                    "customFeeAndTip": False,
                    "priorityFee": "",
                    "gasFeeDelta": 5,
                    "maxFeePerGas": 100,
                    "jitoEnabled": True,
                    "jitoTip": 0.001,
                    "expireDelta": 360000000,
                    "expireExecute": False,
                    "useMidPrice": False,
                    "maxSlippage": 0.1,
                    "concurrentNodes": 2,
                    "retries": 1
                },
                {
                    "enabled": True,
                    "tradeType": "sell",
                    "triggerPriceUsd": "1.5",
                    "triggerDirection": "up",
                    "customFeeAndTip": False,
                    "priorityFee": "0.00005",
                    "currencyAmountUI": 1,
                    "gasFeeDelta": 5,
                    "maxFeePerGas": 100,
                    "jitoEnabled": True,
                    "jitoTip": 0.001,
                    "expireDelta": 360000000,
                    "expireExecute": False,
                    "useMidPrice": False,
                    "maxSlippage": 0.1,
                    "concurrentNodes": 2,
                    "retries": 1
                }
            ]
        }
    }

    async with websockets.connect(uri, additional_headers=headers) as ws:
        await ws.send(json.dumps(msg))

        async def keep_alive():
            while True:
                await ws.ping()
                await asyncio.sleep(30)

        async def listen_for_messages():
            async for message in ws:
                print(message)

        await asyncio.gather(keep_alive(), listen_for_messages())

if __name__ == "__main__":
    asyncio.run(main())

请求参数可视化参考