Skip to content

gem870/Trading_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trading Bot

Moving Average Crossover Strategy

Welcome to Simple Trading Bot, a modular, backtestable trading framework built in Python. This project showcases algorithmic strategy design, performance tracking, and real-time simulation, perfect for demonstrating trading logic, data handling, and system architecture.


Overview

This bot implements a classic Moving Average Crossover strategy:

  • Buy Signal: When short-term MA crosses above long-term MA
  • Sell Signal: When short-term MA crosses below long-term MA

It includes:

  • Strategy logic
  • Backtesting engine
  • Mock live execution
  • Trade logging
  • Performance visualization

Features

  • Modular strategy design (strategy/)
  • Historical backtesting with performance metrics (backtest/)
  • Mock live feed simulation (live/)
  • Trade logging and signal tracking (utils/)
  • Easy to extend with new strategies or data sources

Project Structure

Trading-bot/ ├── strategy/ └── moving_average_crossover.py ├── backtest/ └── backtest_engine.py ├── live/ └── mock_execution.py ├── utils/ └── logger.py ├── data/ └── sample_data.csv ├── requirements.txt └── README.md


Sample Output

BUY at $105.00 [Index: 4]
SELL at $110.00 [Index: 6]
Final Portfolio Value: $10,500.00

Visual output includes signal overlays and price charts using matplotlib.


Installation & Usage

1. Clone the repo

    git clone https://github.com/gem870/simple-trading-bot.git
    cd Trading-bot
    pip install -r requirements.txt
    python backtest/backtest_engine.py
    python live/mock_execution.py

Strategy Logic

The bot uses rolling averages to generate signals: data['short_ma'] = data['Close'].rolling(window=20).mean() data['long_ma'] = data['Close'].rolling(window=50).mean() data['signal'] = np.where(short_ma > long_ma, 1, -1)

Future Enhancements

  • Add RSI-based reversal strategy
  • Integrate with Binance or MetaTrader API
  • Build Qt GUI dashboard for live visualization
  • Add performance analytics (Sharpe ratio, drawdown, etc.)
  • Deploy on cloud for remote execution

About

Lightweight trading bot using python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages