Skip to content

Run from the command line ​

Most people never need this page: the Lab creates, starts and stops bots on your computer, and the install command sets up a server bot. This page is for people who run bots with the tradectl command-line tool, on a server or as developers.

Bots and their folders ​

Each bot has a name (a-z, 0-9, - and _, up to 32 characters) and its own folder, ~/.tradectl/bot/<name>/. The bot owns its config there, config.json. The Lab edits that config through the bot.

Start a bot ​

bash
tradectl run my-bot                        # start my-bot in the foreground
tradectl run my-bot --daemon               # start it in the background
tradectl run my-bot -c config.json         # copy config.json into the bot's folder, then start
tradectl run my-bot -c config.json --dry-run   # check the config and load the strategy, no trading

A bot started with no config waits for setup: open the Lab, and it asks you to pick a strategy. Set isEmulator: true on a strategy for paper trading, false for live. Paper uses real market data and simulates fills, with no exchange keys.

Run a bot as a service (Linux) ​

On a Linux server with systemd, a service starts the bot on boot and restarts it after a crash:

bash
tradectl service install my-bot    # make my-bot a service and start it
tradectl service status my-bot     # one line: is it running?
tradectl service start my-bot      # start it again after a stop or a crash loop
tradectl service remove my-bot     # stop it (it closes its positions) and remove the service

The service restarts the bot 10 seconds after a crash. After 3 crashes in 10 minutes it gives up, and the bot stays down until you run tradectl service start. A bot you stopped stays stopped after a reboot. The install command from your account page sets all of this up for you.

Stop a bot ​

bash
tradectl stop my-bot     # stop one bot
tradectl stop all        # stop every bot this CLI started

A stop cancels the bot's orders and closes all its open positions at market price, then the bot exits. This can take up to 3 minutes; wait for it. Positions of other bots and positions you opened by hand are not touched. A service bot is stopped through systemd, so it does not come back by itself.

Status and logs ​

bash
tradectl status          # every running bot
tradectl logs my-bot     # the bot's log

What stops trading ​

What happensResult
tradectl stop, or Stop in the LabOrders cancelled, all the bot's positions closed, then the bot exits.
A crash, a power cut, a sleeping PCNothing is closed. Orders and positions stay on the exchange. Real TP and SL orders keep working; a virtual SL does not. See If the computer or server goes down.
Hourly loss limit (maxLossLimit) reachedThe bot halts: it opens no new positions. Open positions keep their exits.
One symbol hits an errorOnly that symbol stops. The others go on.

See also ​