Backtrader-for-backtesting
Backtrader-for-backtesting copied to clipboard
These are the code snippets used in the Backtrader for backtesting guide on the AlgoTrading101 website
============================================================================ Backtrader for Backtesting (Python) - A Complete Guide - AlgoTrading101 Blog
This is the code used in Backtrader for Backtesting (Python) <https://algotrading101.com/learn/backtrader-for-backtesting/>_ published on the Algotrading101 Blog
Table of Contents
What is Backtrader? <https://algotrading101.com/learn/backtrader-for-backtesting/#what-is-backtrader>_Why should I learn Backtrader? <https://algotrading101.com/learn/backtrader-for-backtesting/#why-learn-backtrader>_Why shouldn’t I learn Backtrader? <https://algotrading101.com/learn/backtrader-for-backtesting/#why-shouldnt-i-learn-backtrader>_Overview of how Backtrader works <https://algotrading101.com/learn/backtrader-for-backtesting/#backtrader-overview>_How to install Backtrader <https://algotrading101.com/learn/backtrader-for-backtesting/#how-to-install-backtrader>_Choosing which IDE to use with Backtrader <https://algotrading101.com/learn/backtrader-for-backtesting/#choosing-ide-to-use-with-backtrader>_How to configure the basic Backtrader setup <https://algotrading101.com/learn/backtrader-for-backtesting/#how-to-configure-the-basic-backtrader-setup>_How to get data and import it into Backtrader <https://algotrading101.com/learn/backtrader-for-backtesting/#get-data-and-import-to-backtrader>_How to print or log data using the strategy class in Backtrader <https://algotrading101.com/learn/backtrader-for-backtesting/#log-data-using-strategy-class-backtrader>_How to run a backtest using Backtrader <https://algotrading101.com/learn/backtrader-for-backtesting/#run-a-backtest-using-backtrader>_How to use the built-in crossover indicator <https://algotrading101.com/learn/backtrader-for-backtesting/#use-the-builtin-crossover-indicator>_How to run optimization in Backtrader <https://algotrading101.com/learn/backtrader-for-backtesting/#run-optimization-in-backtrader>_How to build a stock screener in Backtrader <https://algotrading101.com/learn/backtrader-for-backtesting/#build-a-stock-screener-in-backtrader>_How to code an indicator in Backtrader <https://algotrading101.com/learn/backtrader-for-backtesting/#code-an-indicator-in-backtrader>_How to plot in Backtrader <https://algotrading101.com/learn/backtrader-for-backtesting/#how-to-plot-in-backtrader>_How to use alternative data in Backtrader <https://algotrading101.com/learn/backtrader-for-backtesting/#use-alternative-data-in-backtrader>_How to add visual stats to a backtest <https://algotrading101.com/learn/backtrader-for-backtesting/#how-to-add-visual-stats-to-backtest>_How to save backtest data to a CSV file <https://algotrading101.com/learn/backtrader-for-backtesting/#how-to-save-backtest-data-to-csv>_Alternatives to Backtrader <https://algotrading101.com/learn/backtrader-for-backtesting/#alternatives-to-backtrader>_Final Thoughts on Backtrader <https://algotrading101.com/learn/backtrader-for-backtesting/#final-thoughts-on-backtrader>_
Requirements
python <https://www.python.org>_ >= 3.6+backtrader <https://github.com/mementum/backtrader>_ (tested to work with >= 1.9.76.123 )QuantStats <https://github.com/ranaroussi/quantstats>_ (tested to work with >= 0.0.25 )pandas <https://github.com/pandas-dev/pandas>_ (tested to work with >= 1.0.3 )
Author Info
:author: Jignesh Davda :author page: https://algotrading101.com/learn/author/jdavda/ :published: 2020-03-05