Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cryptojoma/adaptivetradebot

Dynamic cryptocurrency trading bot for Binance that supports both spot and futures trading. It automatically adjusts trade amounts between $10 and $100, optimizes investment quantities between operations, and utilizes a Moving Average Crossover strategy to execute trades on pairs like BTCUSDT, ETHUSDT, POLUSDT, and more.
https://github.com/cryptojoma/adaptivetradebot

Last synced: about 2 months ago
JSON representation

Dynamic cryptocurrency trading bot for Binance that supports both spot and futures trading. It automatically adjusts trade amounts between $10 and $100, optimizes investment quantities between operations, and utilizes a Moving Average Crossover strategy to execute trades on pairs like BTCUSDT, ETHUSDT, POLUSDT, and more.

Awesome Lists containing this project

README

        

# AdaptiveTradeBot

Dynamic cryptocurrency trading bot for Binance that supports both spot and futures trading. It automatically adjusts trade amounts between a specific range, adapts investment quantities to optimize trading operations, and implements a Moving Average Crossover strategy. Compatible with popular trading pairs like BTCUSDT, ETHUSDT, and more.

## Table of Contents

- [Features](#features)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Customization](#customization)
- [Security Considerations](#security-considerations)
- [Disclaimer](#disclaimer)
- [License](#license)
- [Contact](#contact)
- [Contribution](#contribution)

## Features

- **Dynamic Trade Amounts**: Automatically adjusts trade amounts between \$10 and \$100.
- **Spot and Futures Trading**: Supports both spot and futures markets on Binance.
- **Moving Average Crossover Strategy**: Implements a simple yet effective trading strategy.
- **Supports Multiple Trading Pairs**: Works with BTCUSDT, ETHUSDT, and other popular pairs.
- **Logging**: Records detailed logs of trading activities and errors.
- **Error Handling**: Includes robust error handling for network issues and API errors.

## Prerequisites

- **Python 3.x** installed on your system.
- **Binance Account** with API access:
- Ensure API keys have the necessary permissions (Spot and/or Futures Trading).
- **Do not** enable withdrawal permissions.
- Basic knowledge of Python and cryptocurrency trading concepts.

## Installation

1. **Clone the Repository**

```bash
git clone https://github.com/yourusername/AdaptiveTradeBot.git
cd AdaptiveTradeBot
2. **Install Required Libraries**
```bash
pip install -r requirements.txt
Note: If requirements.txt is not present, install the libraries manually:
```bash
pip install python-binance pandas
```

## Configuration

1. **API Keys**
- Obtain your Binance API Key and Secret Key from your Binance account.
- Store them securely.

2. **Set Up Environment Variables**
For enhanced security, use environment variables to store your API keys.
- On Linux/Mac
```bash
export BINANCE_API_KEY='your_api_key'
export BINANCE_API_SECRET='your_api_secret'
```
- On Windows:
```bash
set BINANCE_API_KEY='your_api_key'
set BINANCE_API_SECRET='your_api_secret'

3. **Adjust Trading Parameters**
Open trading_bot.py and modify the following variables as needed:
```bash
symbol = 'BTCUSDT' # Trading pair (e.g., 'BTCUSDT', 'ETHUSDT', 'POLUSDT')
min_trade_amount = 10 # Minimum trade amount in USD
max_trade_amount = 100 # Maximum trade amount in USD
short_window = 10 # Short-term moving average window
long_window = 30 # Long-term moving average window
trading_type = 'spot' # Choose 'spot' or 'futures'
demo_mode = True # Set to False to enable live trading

## Usage
1. **Run the Bot**
```bash
python trading_bot.py
2. **Monitor Logs**
- The bot writes logs to trading_bot.log. Monitor this file to track activities.
- Adjust the logging level in trading_bot.py if needed.
3. **Demo Mode**
- By default, the bot runs in demo mode and simulates trades without executing them.
- To enable live trading, set demo_mode to False in trading_bot.py.
```bash
demo_mode = False

## Customization
- **Trading Strategy**: Modify the apply_strategy function to implement different trading strategies or indicators.
- **Trade Amount Logic**: Enhance the get_trade_amount function to adjust trade amounts based on your risk management strategy.
- **Risk Management**: Implement stop-loss and take-profit mechanisms.

## Security Considerations
- **API Keys**: Keep your API keys confidential. Do not share them or commit them to version control.
- **API Permissions**: Only enable the permissions necessary for the bot to function.
- **Environment Variables**: Use environment variables or secure key storage solutions.

## Disclaimer
- **Financial Risk**: Trading cryptocurrencies involves significant risk and may result in financial loss. Only trade with funds you can afford to lose.
- **Educational Purpose**: This bot is provided for educational purposes and does not constitute financial advice.
- **No Warranty**: The software is provided "as is", without warranty of any kind.

## License
This code is provided under the Apache 2.0 License

## Contact
For any questions or support, please contact [email protected]

## Contribution
Feel free to fork this repository and submit pull requests. For major changes, please open an issue first to discuss what you would like to change.