This project is a Bitcoin trading bot that generates buy/sell signals using the Simple Moving Average (SMA) strategy on the Binance platform. The bot is designed to operate automatically and can be used for both live trading and backtesting.
- Live Trading: The bot connects to the Binance API and executes trades based on the SMA strategy.
- Backtesting: The bot uses historical data to simulate trading and evaluate the performance of the strategy.
- Simple Moving Average (SMA): The strategy is based on the comparison of the current price with the SMA to determine buy/sell signals.
main.py
: Contains the code for live trading using the Binance API.backtest.py
: Contains the code for backtesting the SMA strategy using historical data..gitignore
: Specifies files and directories to be ignored by Git.README.md
: This file, providing an overview of the project.
- Python 3.x
- pandas
- backtrader
- binance
-
Clone the repository:
git clone https://github.com/douglasmendes/trading_bot_btc_binance_moving_average.git cd trading_bot_btc_binance_moving_average
-
Install the required packages:
pip install pandas backtrader python-binance
-
Set your Binance API key and secret in main.py:
API_KEY = "<YOUR_BINANCE_API_KEY>" API_SECRET = "<YOUR_BINANCE_SECRET_KEY>"
-
Run the trading bot:
python main.py
-
Prepare your historical data in a CSV file (e.g.,
binance_data.csv
). -
Run the backtest:
python backtest.py
This project is for educational purposes only. Trading cryptocurrencies involves significant risk and can result in substantial losses. Use this bot at your own risk.
This project is licensed under the MIT License. See the LICENSE file for details.