Algo Trading : A python framework to run backtest on stocks using your own custom algorithmic strategies
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE Update issue templates Jan 13, 2019
config moved up single directory Jan 12, 2019
helper moved up single directory Jan 12, 2019
indicators Initial commit Jan 12, 2019
network moved up single directory Jan 12, 2019
stockselection moved up single directory Jan 12, 2019
strategy typo fixes Jan 12, 2019
.gitignore clean up Jan 14, 2019
CONTRIBUTING.md Create CONTRIBUTING.md Jan 13, 2019
LICENSE Create LICENSE Jan 13, 2019
README.md Update README.md Jan 13, 2019
icon.png icon Jan 13, 2019
plutus.py typo fixes Jan 12, 2019
plutus_demo.py typo fixes Jan 12, 2019
requirements.txt moved up single directory Jan 12, 2019
sample_stock.png sample stock image Jan 12, 2019

README.md

A python framework to run backtest on stocks using your own combination of algorithmic strategies and technical indicators.

Sample Output Screenshot

Sample

Usage

Checkout plutus-demo.py file for demo

data_fetcher = YahooDataFetcher(symbol=config['symbol'], date_range=config['range'], interval=config['interval'])
strategy = MACrossoverStrategy()
plutus = Plutus(stock_fetcher=data_fetcher, signal_strategy=strategy)
plutus.backtest(BackTestType.SIGNAL_LONG)

Plutus takes in two arguments:

StockDataFetcher : a class used to fetch stock data. By default, use YahooDataFetcher which uses yahoo finance to fetch stock data based on the configuration.

SignalStrategy : This is where you define your buy and sell strategy. Implement the class and define your own strategy to buy and sell stocks. You can also specify the profit target and stop loss target.

Let us understand this with an example :

When you go long (ie where you buy the stock first and sell later) and your buy condition meets, the trader will place a buy order. The order bought will only be sold if it meets any of the three conditions :

  • Either your sell condition meets
  • Either the price hits the target you have defined
  • Else the price hits the stop loss defined.

Features

  • Backtesting with your own custom strategy
  • Create wishlist stocks and run tests against them
  • Outputs profit / loss for each stock
  • Support for some technical indicators
  • Python3 support

Technical Indicators

  • Relative Strength Index (RSI) - Momentum Indicator
  • Simple Moving Average (SMA) - Trend Indicator
  • Exponential Moving Average (EMA) - Trend Indicator
  • Moving Average Convergence Divergence (MACD) - Trend Indicator
  • Average True Range (ATR) - Volatility Indicator
  • Bollinger Band (BB) - Volatility Indicator

Upcoming Features

  • Plotting stocks
  • Adding support for more technical indicators
  • Enable unit testing

Contributing

The easiest way to contribute is by forking the repo, making your changes and creating a pull request.