A small Node.js trading bot that uses the official Binance connector. This README explains how to install, configure environment variables (including Testnet keys), and run the project.
- Node.js (v16+ recommended)
- npm
- A Binance API Key & Secret for production (MAIN)
- A Binance Testnet API Key & Secret for development/testing (TEST)
Clone the repo and install dependencies:
git clone <repo-url>
cd binance-trading-bot
npm installCopy the example env file: Edit .env and add your keys and settings. Example .env.example (already included in repo):
MAIN_API_KEY =
MAIN_API_SECRET =
TEST_API_KEY =
TEST_API_SECRET =
SYMBOL=BTCUSDT
BUY_PRICE_THRESHOLD=100000
SELL_PRICE_THRESHOLD=108000
TRADE_QUANTITY=0.001
-
When NODEENV is set to development (see npm run dev below), the app will use the Binance Spot Testnet base URL and the TEST_ keys.
-
When NODEENV is production (see npm run main below), the app will use the MAIN_ keys for live trading.
Start in development mode (uses Testnet keys / base URL):
npm run dev
Start in production mode (uses live Binance):
npm run main
Lint:
npm run lint