DBot Guide
DBot OfficialDBot DashboardDBot API
  • DBot | Automated DEX Trading
    • 🤖About DBot
    • 📖Getting Started
    • 🌈Forever Free
    • 🔥Referral Program
  • FAQ
    • ❓Help
      • 💡About DBot
      • 💡About Copy Trading/Sniping
      • 💡About Slippage
      • 💡About Pump
      • 💡Wallet Login
      • 💡Account Rebinding
      • 💡EVM transaction failed
      • 💡SOL transaction failed
      • 💡Case Explanation
    • 🚨Safety Tips
      • Security Alert
      • Device Management
      • API KEY
      • API Whitelist IPs
      • Google Authenticator (2FA)
    • 🔖Changelog
  • DEX Trading Bot
    • 🔥Auto Copy Trading
      • Copy Filter
      • Copy Records
      • Copy Group
      • Copy Templates
      • Token Blacklist
    • 🔥Auto Limit Order
    • 🔥Auto Sniper
    • 🔥Fast Buy/Sell
    • 🔥Auto TP/SL
    • 🔫Pump Trading
    • ⏰Trigger Order
      • Opening Sell
      • Dev Sell
    • 💰Sol Bribery
    • 📊Holding/Assets
    • 📈Marketing
    • 📑Billing
    • 📖User Audit
    • ⚙️DBot Settings
      • Multi Language
      • Default Chain
      • Default Wallet/Trading Fee Wallet
      • Cancel default restrictions
      • Template settings
      • Google Authenticator (2FA)
      • Security Alert
      • Device Management
  • Telegram Bot
    • 🤖Telegram Bot (Trading)
      • 💡How to Bind/Rebind
      • 🌈Referral Rewards
      • 👛Wallet Management
      • 📊Holding/Assets
      • 🔥Fast Buy/Sell
      • 🔥Copy Trading
      • 🔥Limit Order
      • 🔥Auto Sniper
      • 🔥Auto TP/SL
      • 💰Opening Sell
      • 💰Dev Sell
      • 💰Auto Buy
      • 💹Multi-wallet buy/sell
      • 🚨Security Alert
      • 📌Token Multisender
      • 💵Token Collection
      • 💥Token Burner
      • 💡Template Settings
      • 🌎Multi Language
    • 🤖Telegram Bot (Alert)
      • Single-Wallet Monitoring
      • Multi-Wallet Monitoring
    • 🤖Telegram Bot (Group)
  • Discord Bot
    • 🤖Discord Bot (Group)
  • DBot Free Tools
    • 📈DEX Simulator
    • 📌Token Multisender (free/no limit)
    • 💵Token Collection (free/no limit)
    • 💥Token Burner (Solana)
    • 👛Wallet Transfer(only gas fee)
    • 💰Smart Money Monitoring
  • DBot Developer
    • Automated DEX API
    • DBot APIs
      • Wallet Management API
        • Wallet Import (POST)
        • Wallet Delete (DELETE)
        • Wallet Info (GET)
      • Task Management API
        • Create Task
          • Fast Buy/Sell (POST)
          • (Muti)Fast Buy/Sell (POST)
          • Create Copy Trading (POST)
          • Create Limit Order (POST)
          • Create Opening Sell (POST)
          • Create Dev Sell (POST)
          • Create Auto Sniper (POST)
        • Edit Task
          • Edit Copy Trading (POST)
          • Edit Limit Order (PATCH)
          • Edit Trailing Stop (PATCH)
          • Edit Opening Sell (PATCH)
          • Edit Dev Sell (PATCH)
        • Enable/Disable Task
          • Disable Copy Trading (PATCH)
          • Disable Limit Order (PATCH)
          • Disable Trailing Stop (PATCH)
          • Disable Opening Sell (PATCH)
          • Disable Dev Sell (PATCH)
          • Disable Auto Sniper (PATCH)
          • (Multi)Disable Copy Trading (PATCH)
          • Disable Trailing Stop Tasks (PATCH)
          • Disable Dev Sell Tasks (PATCH)
          • Disable Auto Snipers (PATCH)
          • Disable Opening Sell Tasks (PATCH)
        • Delete Task
          • Delete Copy Trading (DELETE)
          • Delete Limit Order (DELETE)
          • Delete Limit Orders (POST)
          • Delete All Limit Orders (DELETE)
          • Delete Trailing Stop (DELETE)
          • Delete Trailing Stop Tasks (POST)
          • Delete All Trailing Stop (DELETE)
          • Delete Opening Sell (DELETE)
          • Delete Dev Sell (DELETE)
          • Delete Auto Sniper (PATCH)
        • Group
          • Create Group (POST)
          • Edit Group (PATCH)
          • Delete Group (DELETE)
          • Group Info (GET)
      • Transaction Info API
        • Query Task
          • Swap Order Info (GET)
          • Copy Trading Tasks (GET)
          • Limit Orders (GET)
          • Auto Sniper Tasks (GET)
          • Opening Sell Tasks (GET)
          • Dev Sell Tasks (GET)
          • TP/SL Tasks-Fast Buy/Sell (GET)
          • TP/SL Tasks (copy trading) (GET)
          • Trailing Stop Tasks (GET)
        • Query Trading Record
          • Trading Records (GET)
          • Copy Records (GET)
          • Fast Buy & Sell Records (GET)
      • Simulator API
        • Simulator Auto Sniper (POST)
        • Simulator Copy Trading (POST)
        • Simulator Limit Order (POST)
        • Simulator Fast Buy / Sell (POST)
        • Simulator Account Info (GET)
      • Batch Tool API
        • Token Multisender (POST)
        • Token Collection (POST)
      • Enterprise API
        • Wallet Assets (GET)
        • Pool Info (SOL) (GET)
        • Pool Info (EVM) (GET)
    • DBot WebSocket
      • Trade WebSocket
        • Subscribe to trade results (WS)
        • Fast buy/sell success alert (WS)
        • Fast buy/sell failure alert (WS)
    • API KEY
    • API Whitelist IPs
  • DBot Cobuild
    • 🤝Contact Us
    • 😎Join Alpha
Powered by GitBook
On this page
  • Subscribe to trade results
  • URL
  • Header: X-API-KEY
  • Notes
  • Request Example
  • Request Response
  • Request Parameters
  1. DBot Developer
  2. DBot WebSocket
  3. Trade WebSocket

Subscribe to trade results (WS)

PreviousTrade WebSocketNextFast buy/sell success alert (WS)

Last updated 4 days ago

Subscribe to trade results

Used to subscribe to all or specific types (e.g., fast buy / sell, limit orders, etc.) of trade results (available for Plus / Pro / Enterprise

URL

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

Header: X-API-KEY

(Please do not disclose your API Key to anyone. If you are at risk of losing it, please refresh it.)

Notes

1. X-API-KEY can be obtained in your "Dashboard", go to check:

2. 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

3. Example in NodeJS:

      const WebSocket = require("ws")
      function main() {
          const ws = new WebSocket("wss://api-bot-v1.dbotx.com/trade/ws/", {
              headers: {
                  "x-api-key": "YOUR_API_KEY",
              },
          })
          ws.on("open", () => {
              ws.send(
                  JSON.stringify({
                      method: 'subscribeTradeResults',
                      tradeTypeFilter: [
                        'swap_buy_success',
                        'swap_buy_fail',
                        'swap_sell_success',
                        'swap_sell_fail',
                      ],
                  })
              )
              setInterval(() => {
                  ws.ping()
              }, 50000)
          })
          ws.on('message', res =>{
              console.log('res:', res)
          })
      }
      main()
  1. Example in Python:

     import asyncio
      import websockets
      import json
      async def main():
          uri = "wss://api-bot-v1.dbotx.com/trade/ws/"
          headers = {"x-api-key": "YOUR_API_KEY"}
          msg = {
              "method": "subscribeTradeResults",
              "tradeTypeFilter": ["swap_buy_success", "swap_buy_fail", "swap_sell_success", "swap_sell_fail"]
          }
          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(50)
              async def listen():
                  async for message in ws:
                      print(">>", message)
              await asyncio.gather(keep_alive(), listen())
      if name == "main":
          asyncio.run(main())

Request Example

{
	"method": "subscribeTradeResults",
	"tradeTypeFilter": [
		"swap_buy_success",
		"swap_buy_fail",
		"swap_sell_success",
		"swap_sell_fail"
	]
}

Request Response

{
	"method": "subscribeResponse",
	"result": {
		"message": "Connected and subscribed"
	}
}

Request Parameters

  • method: Currently fixed as "subscribeTradeResults"

  • tradeTypeFilter: Trade types to subscribe: An empty array [] subscribes to all trade types, including any added in the future, "swap_buy_success" indicates a successful fast buy, "swap_buy_fail" indicates a failed fast buy, "swap_sell_success" indicates a successful fast sell, "swap_sell_fail" indicates a failed fast sell

Dashboard