Skip to content

sudowanderer/binance-dca-bot

Repository files navigation

Binance DCA Bot

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.

Docker Hub

The Docker image for this project is available on Docker Hub: binance-dca-bot

Features

  • 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

Prerequisites

  • Node.js (v20 LTS)
  • Docker
  • Docker Compose (optional)
  • Git

Setup

  1. Clone the repository:

    git clone https://github.com/sudowanderer/binance-dca-bot.git
    cd binance-dca-bot
  2. Install dependencies:

    npm install
  3. 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
  4. Build and run locally。

    npm start

Local Docker Deployment

Build Docker image

To build the Docker image locally:

docker build -t binance-dca-bot .

Run Docker container

To run the Docker container:

docker run -d --name binance-dca-bot --env-file .env binance-dca-bot

Docker Compose (optional)

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

About

This is a binance dca bot. Written in Typescript.

Resources

Stars

Watchers

Forks

Packages

No packages published