API Reference
DBot OfficialDBot DashboardPricing

Multi-wallet Fast Buy / Sell Task (WS)

Used to batch query the order status of Fast Buy / Sell, the params of ids comes from the response of Fast Buy / Sell

FreePlusProEnterprise积分消耗
0

URL

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

Notes

To ensure the availability and stability of the WebSocket connection, a heartbeat subscription must be sent at least once every minute (recommended every 30–55 seconds), otherwise the system will automatically disconnect the timeout link

Request Example

{
  "id": 1761291309, // Call ID; the response returns the same ID as the request
  "method": "getSwapOrders", // Method to query multiple Fast Buy / Sell tasks
  "params": {
    "ids": ["mh4arjjr00109a","mh4aucim00118e"] // task ids
  }
}

Response Data

{
    "method": "rpcResponse", // RPC response
    "id": 1761291309, // Call ID
    "result": {
        "err": false, // Request result status; false means succeeded, true means failed
        "res": [
            {
                "id": "mh4aucim00118e", // Fast buy/sell task id
                "chain": "solana", // Chain (solana/ethereum/base/bsc/tron)
                "tradeType": "sell", // Trade type, values buy or sell
                "state": "done", // Order status: init (initial), processing, done (completed), fail, expired
                "txPriceUsd": 0.000020964896027843757, // Actual transaction price (USD)
                "swapHash": "4qXJC5tVimziwY7zxED8kbTpUNS9tepXF633up19RoUnjwvJskhEnFhhHsDX2LhMa7Jdyy6cnhxyYfhkzSAPBMgG", // Transaction hash
                "swapLink": "https://solscan.io/tx/4qXJC5tVimziwY7zxED8kbTpUNS9tepXF633up19RoUnjwvJskhEnFhhHsDX2LhMa7Jdyy6cnhxyYfhkzSAPBMgG", // Transaction link
                "errorCode": "", // Error type
                "errorMessage": "", // Error message
            },
            {
                "id": "mh4arjjr00109a", // Fast buy/sell task id
                "chain": "solana", // Chain (solana/ethereum/base/bsc/tron)
                "tradeType": "buy", // Trade type, values buy or sell
                "state": "done", // Order status: init (initial), processing, done (completed), fail, expired
                "txPriceUsd": 0.000020976535179060357, // Actual transaction price (USD)
                "swapHash": "5cL65PoEA5bn1fqkwjGqEPMJsZKcTyze36pUNVU3HvXkMtm1gBzzoW4RQnMMpc9iuAEBohcjNVKufQR2U9nVFDpf", // Transaction hash
                "swapLink": "https://solscan.io/tx/5cL65PoEA5bn1fqkwjGqEPMJsZKcTyze36pUNVU3HvXkMtm1gBzzoW4RQnMMpc9iuAEBohcjNVKufQR2U9nVFDpf", // Transaction link
                "errorCode": "", // Error type
                "errorMessage": "", // Error message
            }
        ]
    }
}

Example in 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": "getSwapOrders",
         "params": {
           "ids": ["mh4arjjr00109a","mh4aucim00118e"]
         }
      })
    )

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

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

main()

Example in 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": "getSwapOrders",
        "params": {
          "ids": ["mh4arjjr00109a","mh4aucim00118e"]
      }
  }

    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())

Response data visualization reference