A simple Dollar-Cost Averaging (DCA) bot for the Binance platform, developed using TypeScript. This bot automatically buys a specified cryptocurrency at regular intervals using the Binance API and deploys using Docker.
The Docker image for this project is available on Docker Hub: binance-dca-bot
- Automatic DCA: Automatically buys the specified cryptocurrency.
- Configurable: Easily configure target asset, order amount, and order currency through environment variables.
- Scheduled Execution: Schedule the bot to run at specific intervals using cron jobs.
- Telegram Notification:Send notifications via Telegram when the balance falls below a specified threshold.
- Local Docker deployment
- Node.js (v20 LTS)
- Docker
- Docker Compose (optional)
- Git
-
Clone the repository:
git clone https://github.com/sudowanderer/binance-dca-bot.git cd binance-dca-bot
-
Install dependencies:
npm install
-
Create a
.env
file in the project root and configure the following environment variables:BINANCE_API_KEY=your_binance_api_key BINANCE_API_SECRET=your_binance_api_secret TARGET_ASSET=BTC AMOUNT=100 ORDER_CURRENCY=USDC TELEGRAM_BOT_TOKEN=your_telegram_bot_token TELEGRAM_CHAT_ID=your_telegram_chat_id BALANCE_THRESHOLD=100 CRON_SCHEDULE=0 12 * * * TZ=Asia/Shanghai
-
Build and run locally。
npm start
To build the Docker image locally:
docker build -t binance-dca-bot .
To run the Docker container:
docker run -d --name binance-dca-bot --env-file .env binance-dca-bot
If you prefer using Docker Compose, create a docker-compose.yml file:
version: '3.8'
services:
binance-dca-bot:
build: .
env_file:
- .env
restart: always
Run the container using Docker Compose:
docker-compose up -d