gitmyhub

binance-trade-bot

Python ★ 8.7k updated 1y ago

Automated cryptocurrency trading bot

An automated trading bot for Binance that watches cryptocurrency price ratios and makes trades on your behalf to gradually accumulate more of each coin over time.

PythonDockerSQLitesetup: moderatecomplexity 3/5

Binance Trade Bot is an automated trading program for the Binance cryptocurrency exchange. It runs continuously in the background, watching price ratios between coins, and makes trades on your behalf when conditions meet a threshold you configure. You connect it to your Binance account through an API key, tell it which coins to watch, and let it run.

The strategy behind the bot is based on the observation that cryptocurrencies tend to move up and down relative to each other over time. The idea is to always shift from a coin that is currently outperforming into one that is lagging behind, on the assumption that the lagging coin will eventually catch up. Because Binance does not have direct trading pairs between every coin, the bot routes trades through a bridge currency (USDT by default): Coin A is sold for USDT, and then that USDT is used to buy Coin B. The bot only makes a trade if doing so results in holding more of the target coin than it held the last time it visited that coin, accounting for trading fees. The goal is to gradually accumulate more of each coin rather than hold a fixed amount.

Setup requires creating a configuration file with your Binance API credentials, your starting coin, the list of coins you want to participate in, and a few trading parameters like how long to wait between scans and how large a margin is required before triggering a trade. All of these settings can also be passed as environment variables, which is convenient for running in containers.

The bot can send you notifications through a wide range of services (Telegram, Discord, Slack, and others) using a library called Apprise. A Docker image is provided for those who want to run it without installing Python dependencies manually. There is also a backtesting mode that lets you test the bot's behavior against historical price data before running it with real funds.

Financial risk is real with any automated trading tool. The README acknowledges that a coin can freefall relative to others, which would work against this strategy.

Where it fits