gitbuyer_

abelmiracle377-stack/Trade-bot

publicmain

This is an AI trading bot

README

AI Trading System

A modular, production-oriented AI-powered quantitative trading system written in Python.

It combines historical market data, rich technical feature engineering, machine-learning signal generation, volatility-targeted position sizing, stop-loss / take-profit rules, and a multi-asset backtester with realistic transaction costs.

Disclaimer: This is research / educational software only.
It is not financial advice. Past performance does not guarantee future results.
Always paper-trade and fully understand the risks before using real capital.


Fresh Clone – Exact Commands Buyers Run

git clone <repo-url> ai_trading_system
cd ai_trading_system

python -m venv .venv
source .venv/bin/activate          # Windows: .venv\Scripts\activate

pip install -r requirements.txt
pip install -r requirements-dev.txt

# THIS IS THE CRITICAL COMMAND – must succeed
pytest tests/ -v --cov=src --cov-report=term-missing

# Alternative
make test

Run tests in a completely isolated container

docker compose run --rm test
# or
make docker-test

Run the trading pipeline

python main.py
# or
make run

What the Test Suite Covers

File What it tests
tests/test_smoke.py Imports, config loading, basic objects
tests/test_data_fetcher.py Data fetching + caching (mocked)
tests/test_features.py Technical feature engineering
tests/test_predictor.py ML model fit / predict / save / load
tests/test_signal.py Signal generation from probabilities
tests/test_risk.py Position sizing, stops, drawdown checks
tests/test_backtest.py Full backtest engine + metrics

All tests run without network access or external credentials.


Project Structure

ai_trading_system/
├── .github/workflows/ci.yml      # Lint + type + test on every push
├── config/config.yaml
├── src/
│   ├── data/
│   ├── features/
│   ├── models/
│   ├── strategies/
│   ├── risk/
│   ├── backtest/
│   ├── portfolio/
│   └── utils/
├── tests/                        # Full pytest suite
├── main.py
├── Dockerfile                    # Multi-stage (production + test)
├── docker-compose.yml
├── Makefile
├── pytest.ini
├── requirements.txt              # Pinned runtime
├── requirements-dev.txt
├── requirements-lock.txt
├── pyproject.toml
├── .env.example
├── CONTRIBUTING.md
└── README.md

Development Commands

make help
make install-dev
make test
make lint
make format
make ci                 # full local CI
make docker-test        # tests inside Docker
make docker-run         # pipeline inside Docker

Configuration

Edit config/config.yaml for symbols, model type, risk limits, etc.

Copy .env.example → .env only if you later add live broker keys (never commit secrets).


CI

GitHub Actions (.github/workflows/ci.yml) runs on every push and pull request:

  • Multi-Python matrix (3.10 / 3.11 / 3.12)
  • Ruff lint + format check
  • Full pytest suite with coverage
  • Bandit + Safety security scans

Extending

  • New model → implement fit / predict_proba / save / load in src/models/
  • Change prediction target → edit _create_target in SignalPredictor
  • Live trading → replace backtester with a broker connector

License

MIT

39 files

every file readable free; the clone is the same bytes, packaged and agent-payable