Skip to content

yy-trading-bots/rem-bot

Repository files navigation

RemBot Project Cover

Python 3.13 Coverage 96.29% CI license

RemBot

An automated cryptocurrency trading bot for Binance that combines RSI, EMA, and MACD — the REM trio — to detect confluence-based LONG/SHORT signals.


📖 Description

RemBot is a Python trading bot that connects to the Binance API and opens LONG or SHORT positions when REM (RSI, EMA, MACD) conditions are met. It uses clear abstractions with object‑oriented design and pragmatic design patterns to keep the codebase clean and maintainable without sacrificing functionality. The project also serves as a concise reference implementation for developers building their own trading bots.


🎯 Strategy

REM = RSI + EMA + MACD

This bot relies on the following indicator set:

  • Trend filter (EMA) – Evaluates the price relative to the 100-period Exponential Moving Average (EMA_100) to determine whether the market bias is bullish or bearish.
  • Momentum (MACD) – Uses the relationship between the MACD line and the signal line to assess both the direction and strength of the trend.
  • Momentum (RSI) – Applies a short-period RSI threshold around the 50 level to confirm the momentum direction and filter out false signals.

Position entry conditions (pseudocode):

while True:
    if price < EMA_100 and MACD_12 > MACD_26 and MACD_12 < 0 and RSI_6 > 50:
        enter_long()
    elif price > EMA_100 and MACD_12 < MACD_26 and MACD_12 > 0  and RSI_6 < 50:
        enter_short()

For a video explanation of the strategy, you may see the video below. (The video does not belong to this repository or organisation)


⚙️ Configuration

First, rename settings.example.toml to settings.toml and edit the fields to match your preferences.

Key Section Type Default Description Example
PUBLIC_KEY [API] string "" Your Binance API key. Grant only the permissions you actually need. Do not commit to VCS. "AKIA..."
SECRET_KEY [API] string "" Your Binance API secret. Keep it secret and out of the repo. "wJalrXUtnFEMI..."
SYMBOL [POSITION] string "ETHUSDT" Trading symbol (e.g., USDT-M futures or spot pair). "BTCUSDT"
COIN_PRECISION [POSITION] integer 2 Quantity precision for orders. Must align with the exchange lot size rules. 3
TP_RATIO [POSITION] float 0.0050 Take-profit distance relative to entry. 0.0050 = 0.5%. 0.0100
SL_RATIO [POSITION] float 0.0050 Stop-loss distance relative to entry. 0.0050 = 0.5%. 0.0075
LEVERAGE [POSITION] integer 1 Leverage to apply (for futures). Use responsibly. 5
TEST_MODE [RUNTIME] bool true Paper/Test mode. When true, no live orders are sent (or a testnet is used). false
DEBUG_MODE [RUNTIME] bool false Verbose logging and extra assertions. true
INTERVAL [RUNTIME] string "15m" Indicator/candle interval (e.g., 1m, 5m, 15m, 1h, ...). "1h"
SLEEP_DURATION [RUNTIME] float 30.0 Delay (seconds) between loops to respect API limits. 10.0

Where to get API keys: Binance → API Management: https://www.binance.com/en/my/settings/api-management

Tips

  • Keep COIN_PRECISION in sync with exchangeInfo (lot/tick size) to avoid rejected orders.

▶️ How to Run

Ensure settings.toml is properly configured before running.

There are three ways to run the bot, and you may choose whichever best suits your needs.

1) Release

Download the latest release and run the executable.

2) Docker

# Build the image
docker build -t rembot .

# Run (Linux/macOS)
docker run --rm \
  -v "$(pwd)/src:/app/src" \
  rembot

# Run (Windows CMD)
docker run --rm \
  -v "%cd%\src:/app/src"
  rembot

The volumes mount your local src/ for output log files.

3) Python (virtualenv)

# Create a virtual environment
python -m venv .venv

# Activate
# Linux/macOS
source ./.venv/bin/activate
# Windows CMD
.\.venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run
python src/main.py   # direct module/script

⚠️ Warnings

Disclaimer: Trading cryptocurrencies — especially with leverage — involves significant risk. This bot is not financial advice and is provided for educational/experimental purposes only. Review the code and the strategy thoroughly, start small, and only trade with funds you can afford to lose. All P&L is your responsibility.

Protect your API keys, never commit secrets, and be aware of operational risks such as rate limits, network issues, exchange maintenance, and slippage, all of which can materially affect performance.