April 2019
Intermediate to advanced
426 pages
11h 13m
English
With all of the required methods defined inside the BacktestEngine class, we may now go ahead and create an instance of this class with the following code:
engine = BacktestEngine(
'WIKI/AAPL', 1,
start='2015-01-01',
end='2017-12-31'
)
In this example, we are interested in trading one unit of AAPL stock each time, using three years of daily historical data for backtesting from the year 2015 to 2017.
Issue the start() command to run the backtesting engine:
engine.start(
lookback_intervals=20,
buy_threshold=-1.5,
sell_threshold=1.5
)
The lookback_interval parameter argument with a value of 20 tells our strategy to use the most recent 20 days' of daily historical prices in calculating z-scores. The buy_threshold ...
Read now
Unlock full access