Skip to content

Test performance of systematic trading strategies on historic data

Notifications You must be signed in to change notification settings

jeffreykaili/systematic-backtest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Systematic Strategy Backtesting

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.

Sample Usage

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.

image

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()

image image

Additional statistics are printed to the console, such as mean return, estimated tail loss, and volatility.

About

Test performance of systematic trading strategies on historic data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages