Trading bots need to run 24/7, react quickly, and keep secret API keys safe. A home PC or laptop fails at all three: sleep mode, power cuts, Wi-Fi drops and malware risk. A VPS gives a bot an always-on, stable environment, close to the exchange’s servers.
This article covers crypto and algorithmic trading bots that use exchange APIs. For MetaTrader-based forex trading, see forex VPS. Trading involves risk. Nothing here is financial advice.
Why a VPS helps
- Uptime: the bot keeps running when your computer is off.
- Lower and more stable latency to exchange APIs, if you choose a nearby location.
- Isolation: API keys live on a dedicated, hardened machine, not your everyday PC.
- Predictable resources: most bots need little CPU and RAM.
Choosing a location
Latency to the exchange’s API servers matters for frequent strategies. Many major exchanges run infrastructure in Tokyo, Hong Kong, Singapore, or on AWS in specific regions. Some are in Europe or the US.
- Find out where your exchange’s API endpoints are hosted (check its documentation, or test from candidate locations).
- Measure from a server:
curl -o /dev/null -s -w '%{time_connect} %{time_starttransfer}\n' https://api.exchange.example/api/v3/time, and ping and mtr. See ping, traceroute and mtr. - VPS.DO has locations in the USA (Los Angeles, New York, Chicago, Miami), Hong Kong and Tokyo. Network test IPs are listed on each region’s VPS page. See USA VPS, Hong Kong VPS and Japan VPS.
Also check the legal and regional restrictions of your exchange. Some block access from certain countries, and using a server to get around that may violate their terms.
Sizing
| Bot type | Typical needs |
|---|---|
| A few pairs, 1-minute or slower candles (e.g. Freqtrade) | 1–2 vCPU, 2 GB RAM |
| Many pairs, multiple bots, backtesting on the server | 2–4 vCPU, 4–8 GB RAM |
| Market making, order book streaming (e.g. Hummingbot) | 2–4 vCPU, 4 GB+, stable low latency |
| Heavy backtesting and hyperparameter optimization | More vCPU (CPU-bound), or run it on a separate machine |
Popular open-source bots
- Freqtrade (Python): strategy-based crypto trading, backtesting, a web UI (FreqUI), and Telegram control. Runs well in Docker.
- Hummingbot (Python): market making and arbitrage, connectors for many exchanges.
- Jesse, OctoBot, and custom bots built with CCXT.
Example: Freqtrade with Docker:
mkdir -p ~/ft && cd ~/ft
curl -fsSL 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
docker compose up -d
Start in dry-run (paper trading) mode, and only switch to live trading when you trust the strategy. See install Docker.
Keep it running
- Docker
restart: unless-stopped, or a systemd service withRestart=always. See systemd unit files. - Correct time sync (exchange APIs reject requests with skewed timestamps). See NTP time sync with chrony.
- Alerts on crashes or errors: Telegram notifications (built into Freqtrade), plus an uptime monitor. See Uptime Kuma.
API key security (most important)
- Create exchange API keys with trading permission only, and never withdrawal permission.
- Use the exchange’s IP allowlist, set to your VPS’s IP.
- Store keys in config files readable only by the bot user (
chmod 600), never in Git. See secrets management. - Harden the server: SSH keys only, firewall, Fail2ban, automatic security updates. See Linux server hardening checklist.
- Don’t expose bot web UIs (FreqUI, Hummingbot dashboards) publicly. Use an SSH tunnel or VPN. See SSH tunnelling.
- Only run bot code and strategies from sources you trust. Malicious “strategies” that steal keys exist.
Backups
Back up the bot configuration, strategies and trade database (for example Freqtrade’s SQLite file) regularly. See backup strategy.
Quick reference
| Item | Recommendation |
|---|---|
| Location | Closest to the exchange’s API servers |
| Starting size | 1–2 vCPU, 2 GB RAM |
| Keys | Trade-only, IP-allowlisted, no withdrawals |
| Uptime | Docker restart policy or systemd |
| Time | NTP/chrony enabled |
Related: Windows VPS for trading latency and choosing a VPS location.