GithubHelp home page GithubHelp logo

whchien / ai-trader Goto Github PK

View Code? Open in Web Editor NEW
113.0 3.0 10.0 419 KB

Implement AI Trading Strategies with Backtrader

Python 100.00%
ai algorithmic-trading backtrader portfolio-management stock-price-prediction trading

ai-trader's Introduction

ai-trader

中文版說明 (Chinese Subpage)

This repository demonstrates how to implement 20+ algorithmic trading strategies using Backtrader framework with a focus on AI. It includes examples for both the US and Taiwanese stock markets.

Some of the codes are still in development and not fully clean or functional at the moment, but I am actively working on updates and improvements.

For example, use a Triple RSI Rotation strategy to manage a stock portfolio. Demo GIF

Strategy overview

Single stock trading

  • SMA (Niave SMA & Cross SMA)
  • Bollinger Band
  • Momentum
  • RSI
  • Resistance Support Relative Strength (RSRS)
  • ROC
  • Double Top
  • Risk Averse
  • Turtle
  • Volatility Contraction Pattern (VCP)

Portfolio trading

  • ROC rotation
  • RSRS rotation
  • Triple RSI rotation
  • Multi Bollinger Bands rotation

Machine learning based (dev)

  • Logistic regression
  • Feature engineering
  • Gradient boosting
  • DNN
  • RNN
  • LSTM
  • Reinforcemnt learning
  • (More to come!)

How to Start

  1. Clone the repository:

    git https://github.com/whchien/ai-trader.git
    cd ai-trader
    
  2. Install the required dependencies:

    pip install -r requirements.txt
    
  3. (Optional) Download the data (you can also prepare your own).

    python ai_trader/loader.py
    
  4. Test the first strategy.

    python ai_trader/strategy/classic/bbands.py 
    

Tutorials

In the future, I will share some tutorial notebooks to share my learning with the community. If you find it helpful, please give the repo a star ⭐️. Your support would mean a lot to me.

ai-trader's People

Contributors

whchien avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ai-trader's Issues

How to debug strategy

Hi, this is a great project!

I am trying to add 'print' statements in order to understand how backtrader works.

Just started from your TripleRsiStrategy and added following two lines when buy signal triggered.
image

In stdout, I am able to see the correct daily closing and SMA value. However, the RSI_long, RSI_mid and RSI_short do not change.
May I know how to get the values correctly? Looking forwards to your guidance and help. Thanks.
image

No module named 'ai_trader' issue

安裝完測試環境後,執行
python ai_trader/strategy/classic/bbands.py
結果出現以下錯誤,請問如何調整?

raceback (most recent call last): File "/Volumes/Win11SSD/GitHub/ai-trader/ai_trader/strategy/classic/bbands.py", line 3, in <module> from ai_trader.trader import AITrader ModuleNotFoundError: No module named 'ai_trader'

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.