Skip to content

Automated cryptocurrency trading bot with Binance integration and backtesting capabilities

Notifications You must be signed in to change notification settings

murbati91/morph-backtesting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Morph Backtesting Project

Automated Trading Bot with CoinMetrics Integration - Inspired by the Legendary "Abood Cheeks"

This project brings to life the principles of strategic, data-driven trading, influenced by the insights of "Abood Cheeks." It seamlessly integrates CoinMetrics data with a Binance-based trading bot to execute trades automatically, following carefully crafted strategies. The system is designed to analyze market data, generate trading signals, execute trades, and monitor performance, all while sending real-time alerts to keep you informed.

Project Overview

The Morph Backtesting Project is an all-in-one automated trading system that uses CoinMetrics for market analysis and Binance for trade execution. This setup is inspired by the disciplined and strategic approach of "Abood Cheeks," focusing on maximizing returns while minimizing risks through careful data analysis and trade management.

Features

  • Automated Trading: Leveraging CoinMetrics data, this bot automatically executes trades on Binance, adhering to a disciplined strategy.
  • Data-Driven Decisions: Analyze critical market metrics from CoinMetrics to inform trading decisions.
  • Comprehensive Logging: Every trade and bot action is logged for transparency and review.
  • Real-Time Alerts: Stay updated with instant email notifications whenever a trade is executed.
  • Flexible Configuration: Easily adjust trading parameters and strategies through configuration files.

Directory Structure

morph_backtesting/
│
├── .env                       # Environment variables (API keys, email settings)
├── README.md                  # Project documentation
├── requirements.txt           # Python dependencies
│
├── bot/                       # Bot-related scripts
│   ├── trading_bot.py         # Main trading bot script
│   ├── coinmetrics_data.py    # Script for fetching CoinMetrics data
│   └── alert.py               # Script for sending email alerts
│
├── config/                    # Configuration files
│   └── settings.py            # Settings and configuration variables
│
├── data/                      # Data storage (e.g., Excel files, raw data)
│   └── data_cacktesting.xlsx  # Example data file
│
├── logs/                      # Log files directory
│   └── trade_log.log          # Log file for tracking trades and bot activity

Prerequisites

1. Python Environment

Ensure Python 3.7+ is installed on your machine. You can check your version with:

python --version

2. Required Python Packages

Install the necessary Python packages with:

pip install -r requirements.txt

3. API Keys and Email Setup

  • Binance API: Obtain your API key and secret from Binance for executing trades.
  • CoinMetrics: Use CoinMetrics for comprehensive market data (optional but recommended).
  • Email Configuration: Set up an SMTP server (e.g., Gmail, Outlook) to receive real-time alerts.

Setup Instructions

1. Clone the Repository

Clone the project repository:

git clone https://github.com/your-repo/morph_backtesting.git
cd morph_backtesting

2. Configure Environment Variables

Create a .env file in the root directory with your API keys and email settings:

# .env

# Binance API Keys
BINANCE_API_KEY=your_binance_api_key
BINANCE_API_SECRET=your_binance_api_secret

# Email Configuration
EMAIL_USER=your_email@example.com
EMAIL_PASS=your_email_password
EMAIL_RECEIVER=receiver_email@example.com
SMTP_SERVER=smtp.example.com
SMTP_PORT=587

3. Adjust Configuration Settings

Modify config/settings.py to set up your trading parameters:

# config/settings.py

# Trading Parameters
SYMBOL = 'BTC/USDT'      # Trading pair
ORDER_SIZE = 0.001       # Order size for each trade

4. Running the Bot

To launch the trading bot, use the following command:

python bot/trading_bot.py

5. Monitoring and Alerts

  • Logs: Check logs/trade_log.log for detailed logs of the bot’s activities.
  • Email Notifications: Alerts will be sent to your configured email whenever trades are executed.

Usage Details

CoinMetrics Data Integration

The script coinmetrics_data.py is responsible for fetching relevant market data from CoinMetrics, which is then used to generate trading signals. This data-driven approach is key to making informed trading decisions, aligning with the disciplined trading philosophy of "Abood Cheeks."

Trading Strategy

The bot employs a moving average crossover strategy, which is a tried-and-tested method for identifying trends:

  • Buy Signal: When the 20-period moving average crosses above the 50-period moving average.
  • Sell Signal: When the 20-period moving average crosses below the 50-period moving average.

Logging and Alerts

  • Detailed Logs: Every trade and significant event is logged in trade_log.log for easy reference.
  • Instant Alerts: Receive instant email notifications to keep track of the bot's trading activities, ensuring you're always in the loop.

Customization and Enhancement

Strategy Modification

"Abood Cheeks" teaches us the importance of adapting to market conditions. You can customize the trading strategy by modifying the generate_signal function in trading_bot.py.

Integrating Additional Data Sources

Expand the bot's capabilities by integrating other data sources or metrics within coinmetrics_data.py.

Enhanced Alerting System

Consider expanding the alert system in alert.py to include additional notification methods such as SMS, Slack, or Telegram, ensuring you never miss an important update.

Troubleshooting

Common Issues

  1. API Key Problems: Double-check your Binance API keys to ensure they are correct and have the necessary permissions.
  2. Email Configuration: If alerts aren't being sent, verify your SMTP settings and credentials.

Debugging

  • Review the trade_log.log for errors or unexpected behavior.
  • Use Python’s pdb or other debugging tools to step through the code and identify issues.

Future Enhancements

  • Advanced Strategies: Implement more complex strategies, such as RSI or Bollinger Bands, to refine your trading approach.
  • Dashboard Visualization: Integrate Grafana and InfluxDB to visualize performance metrics in real-time.
  • Dynamic Risk Management: Incorporate dynamic position sizing, trailing stops, and other advanced risk management techniques.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Disclaimer

Trading cryptocurrencies involves significant risk and may not be suitable for every investor. Always consider your investment objectives, experience level, and risk tolerance before engaging in any trading activities. This project is for educational purposes and does not constitute financial advice.


Final Thoughts

Inspired by the strategic insights of "Abood Cheeks," this project combines the best of data-driven trading with automated execution. It’s designed for traders who seek to leverage advanced market data to make informed decisions, all while ensuring continuous monitoring and flexibility.

By following this guide, you should be able to set up, run, and customize the Morph Backtesting Project to suit your trading needs. If you have any further questions or need additional support, feel free to reach out!

About

Automated cryptocurrency trading bot with Binance integration and backtesting capabilities

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages