Skip to content

Watchdog ​

The watchdog is an independent safety service that guards your exchange accounts against naked (unprotected) positions. Run it on a separate machine from your trading bot: it reads your account straight from the exchange and alerts — or automatically closes — any position that's missing its stop-loss, its take-profit, or both.

It exists for one reason: a bot's protection can disappear the moment the bot has trouble. A virtual stop-loss lives in the bot's memory and only fires while the bot is alive. If the bot crashes, freezes, or loses its connection, that protection silently vanishes and the position is exposed. A real stop order on the exchange survives the bot dying — a virtual one does not. The watchdog is the backstop for exactly that gap.

Setup ​

The easy way is the install command, on a second Linux server (not the bot's). In the Lab, open Profile. Under add a server, press Watchdog server and copy the command (it has --watchdog in it). Paste it into the server's console. It installs the watchdog as a service that starts on boot and restarts after every crash. Step by step: A watchdog on a second machine.

By hand, with the CLI:

bash
# 1. Log in (so the watchdog shows up in the Lab automatically)
tradectl login

# 2. Run it as a service (Linux with systemd)
tradectl service install watchdog

The watchdog then appears in the Lab's left list, under your account's bots.

Configure it in the Lab ​

Click the watchdog in the Lab. Its view has two tabs, Monitoring and Settings.

  1. + guard a bot: pick the bot you want to protect, choose its market, and add the account's Binance API keys. Use a separate key for the watchdog, locked to the watchdog server's IP, with Futures on and withdrawals off.
  2. Press Connection string next to the guarded bot, and paste it into the bot's settings, Watchdog tab.
  3. Choose what it may do (Settings → Authority & policy):
    • Alert only (default, safe): it watches and warns you on Telegram, but never trades.
    • Auto-protect: it also closes unprotected positions for you, and cancels a dead bot's waiting entry orders. This needs a working Telegram channel, so it can tell you what it did.

You can guard more bots or accounts the same way, all with the one watchdog.

Start with Alert only

Leave it on Alert only at first and read what it reports. Switch to Auto-protect once you trust its verdicts.

What it does ​

Every few seconds the watchdog reads your open positions and resting orders from the exchange. For each position it checks whether both a stop-loss and a take-profit are resting on the exchange — a take-profit alone doesn't count as protection, since a position that reverses after going into profit would otherwise have no floor. If either is missing, it starts a timer, confirms the position stays unprotected, then alerts you — and, on Auto-protect, closes it with a reduce-only market order (it can only ever close a position, never open one).

The Lab's Watchdog view shows exactly what it sees: each position's protection verdict with the reasoning, the bot's declared stop-loss, and the raw orders it read from the exchange.

Panic ​

Need everything flat immediately? Run:

bash
tradectl watchdog panic

This market-closes every position on every guarded account right now (after a confirmation prompt). It's a manual emergency button — the watchdog never triggers it automatically.

Notes ​

  • Run it on a separate machine from your bot, so a crash of the bot's host doesn't take the watchdog with it. As a service it restarts after every crash, and you get a Telegram line when it does.
  • Manual trading on a guarded account: with Auto-protect on, the watchdog closes any position on the account that has no take-profit and stop-loss, also one you opened by hand. Do not trade by hand on a guarded account; use a Binance sub-account.

See also ​