Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Binance Testnet API Keys

Getting API Key and Secret Key from Binance Testnet.


Step 1 — Access the correct Testnet platform

Binance splits Testnet into two separate platforms for Spot and Futures:


Step 2 — Log in

  • On the Spot Testnet page (testnet.binance.vision), click Log in.
  • Unlike the real exchange, authentication is done via GitHub. Click “Log in with GitHub” and authorize the application.

Step 3 — Generate an API Key

  • Once logged in, you will be redirected to the API management page.
  • Click Generate HMAC_SHA256 Key (RSA and Ed25519 are also available, but HMAC_SHA256 is the most common standard and easiest to configure for general scripts).
  • Enter a description for your key (e.g. trading-bot-dev) and click Generate.

Step 4 — Store safely

  • The system will immediately display your API Key and Secret Key.
  • Important: You must copy and save the Secret Key right now (recommended: paste it into your .env file). The platform will never show the Secret Key again after you refresh the page. If you lose it, you will need to delete it and generate a new one.
  • Your Testnet account is automatically funded with virtual assets (e.g. BNB, BTC, USDT, BUSD) for testing.

Step 5 — Add keys to .env

Open the .env file at the project root (create it from .env.example if it doesn’t exist yet):

cp .env.example .env

Fill in the API Key and Secret Key you just generated:

BINANCE_API_KEY=your_api_key_here
BINANCE_API_SECRET=your_secret_key_here

Then restart the container so the bot picks up the new config:

docker compose restart opentrader-bot

Verify the bot received the keys:

docker exec opentrader-bot env | grep BINANCE

⚠️ Never commit .env to git. It is already listed in .gitignore — double-check if you forked the repo.