Tests the performance of systematic trading strategies using historical data, and provides/visualizes statistics such as P&L, portfolio value, risk (calculated as estimated tail loss), volatility (standard deviation of returns over the duration of the investment), mean return percentage, etc.
Code is provided inside main.py. Suppose we are trying to test performance of a EWMA crossover strategy (9/21 day for fast/slow windows) for a single stock MSFT.
With a few lines of code, we can backtest how this strategy would have performed over the last year:
from utils.FinanceDataReader import FinanceDataReader
from utils.EWMACrossoverStrategy import EWMACrossover
from Backtest import Backtest
data_reader = FinanceDataReader()
df = data_reader.get_historical_data("MSFT")
bt = Backtest(EWMACrossover, df, column_name='Close')
bt.run()Additional statistics are printed to the console, such as mean return, estimated tail loss, and volatility.


