1. Install Docker and Freqtrade
On Ubuntu 24.04, after securing the server and installing Docker:
mkdir ft_userdata && cd ft_userdata curl https://raw.githubusercontent.com/freqtrade/freqtrade/stable/docker-compose.yml -o docker-compose.yml docker compose pull docker compose run --rm freqtrade create-userdir --userdir user_data docker compose run --rm freqtrade new-config --config user_data/config.json
new-config asks a series of questions: the exchange, the stake currency and amount, whether to start in dry-run (answer yes), and whether to turn on FreqUI and Telegram. The answers end up in user_data/config.json, which you can edit later.
2. Backtest First
Download history and test the strategy against it before it touches an exchange. With the sample strategy Freqtrade ships as an example:
docker compose run --rm freqtrade download-data --pairs ETH/BTC --exchange binance --days 5 -t 1h docker compose run --rm freqtrade backtesting --config user_data/config.json --strategy SampleStrategy -i 5m
SampleStrategy is a demonstration, not a strategy to trade. Put your own in user_data/strategies/ and test it over several market conditions, not one good month.
3. Run in Dry-Run
docker compose up -d docker compose logs -f
In dry-run the bot trades with simulated money against live prices. Freqtrade's docs say to always start this way and to run it for some time before risking real money. Its database and logs are in user_data/. After changing the config, apply it with docker compose up -d --force-recreate.
4. Keep FreqUI Private
FreqUI controls the bot, so whoever reaches it can trade your account. In config.json, the API server listens on all addresses inside the container, while Docker publishes it only to the server itself:
"api_server": {
"enabled": true,
"listen_ip_address": "0.0.0.0",
"listen_port": 8080,
"jwt_secret_key": "a-long-random-value",
"username": "you",
"password": "a-long-unique-password"
}Check that docker-compose.yml maps the port as "127.0.0.1:8080:8080", never "8080:8080", which the docs warn makes the bot controllable by anyone who finds the port. Generate the secret with python3 -c "import secrets; print(secrets.token_hex())". Then, from your own computer:
ssh -L 8080:127.0.0.1:8080 [email protected] # then open http://localhost:8080
FreqUI has no HTTPS of its own; the tunnel encrypts it. For a phone, WireGuard or the Telegram bot are the easier ways in.
5. Lock Down the Exchange Key
- Trading only: create the API key with permission to read and trade, and never to withdraw. A leaked trading-only key cannot move your funds off the exchange.
- Restrict it to the server's IP: most exchanges let you allow a key only from given addresses. Your VPS keeps the same IP address, so a key locked to it is useless anywhere else.
- Keep the config private:
config.jsonholds the key and secret; do not commit it to a public repository or paste it into a support chat.
When you do switch to live trading, change dry_run to false, start with a small stake, and watch the first trades closely.
Updates and Backups
cd ~/ft_userdata docker compose pull docker compose up -d
Back up user_data/ (config, strategies and the trade database) with Borg to a storage box. For market making rather than strategies, see Hummingbot. Running MetaTrader rather than crypto? See keeping MetaTrader running on a Windows VPS.