How to Run a Trader Bot

Step-by-step guide to launch your trading bot

Option A: Run with Docker (Recommended)

Simplest and most isolated method

1. Create a working directory

mkdir trader-run && cd trader-run

2. Place your trader-ppss.yaml file

Copy the downloaded trader-ppss.yaml file into this folder.

3. Export your private key

export PRIVATE_KEY=0xYOUR_PRIVATE_KEY_HERE

4a. Run with docker run

docker run --rm -it \
  -e PRIVATE_KEY=${PRIVATE_KEY} \
  -v $(pwd):/work \
  ghcr.io/oceanprotocol/pdr-backend:latest \
  pdr trader /work/trader-ppss.yaml testnet

4b. OR run with docker-compose

If you downloaded the docker-compose.yml:

docker compose up -d

View logs: docker compose logs -f

Stop: docker compose down

Option B: Run with Python CLI

For developers familiar with Python

1. Create a virtual environment

python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

2. Install pdr-backend

pip install pdr-backend

3. Export your private key

export PRIVATE_KEY=0xYOUR_PRIVATE_KEY_HERE

4. Run the bot

pdr trader trader-ppss.yaml testnet

Logs & Troubleshooting

View logs (Docker)

docker compose logs -f trader

Check outputs

Results are saved in the specified directory (out_dir in trader-ppss.yaml).

Common errors

  • PRIVATE_KEY not defined: Check the variable export
  • Insufficient funds: Fund your wallet on the network
  • Strategy error: Check that the strategy is supported
  • Cron error: Check the cron schedule format
  • Permission denied (Docker): Add your user to docker group

Monitor Performance

Monitor regularly:

  • Logs to detect errors
  • Output files (executed trades, performance)
  • Wallet balance (gas consumed, profits/losses)
  • Strategy metrics (win rate, drawdown, etc.)

Update the bot

Docker

docker pull ghcr.io/oceanprotocol/pdr-backend:latest
docker compose restart

Python CLI

pip install --upgrade pdr-backend

Switch to Mainnet

To switch to mainnet, recreate your trader-ppss.yaml with network: mainnet, and run withmainnet instead oftestnet in the commands.