Notebook

From: https://www.quantopian.com/algorithms/5b71fa2d9de4f300406e0f85/5b72dc687637474291b314a3/old

Trend Follow Algo. Increased initial capital to $10,000,000. No change to code. Duration: 10.25 years.

In [1]:
bt = get_backtest('5b72dc687637474291b314a3')
100% Time: 0:00:18|###########################################################|
In [2]:
bt.create_full_tear_sheet(round_trips=True, hide_positions=True, live_start_date = "2016-01-01")
Start date2007-08-02
End date2017-12-29
In-sample months100
Out-of-sample months23
All In-sample Out-of-sample
Annual return 28.2% 26.6% 35.4%
Cumulative returns 1230.5% 626.1% 83.2%
Annual volatility 26.1% 26.5% 24.4%
Sharpe ratio 1.08 1.02 1.37
Calmar ratio 0.97 1.02 1.21
Stability 0.96 0.94 0.55
Max drawdown -29.2% -26.1% -29.2%
Omega ratio 1.20 1.19 1.25
Sortino ratio 1.56 1.47 2.00
Skew -0.26 -0.25 -0.26
Kurtosis 2.19 2.23 1.77
Tail ratio 0.99 0.97 1.13
Daily value at risk -3.2% -3.2% -2.9%
Gross leverage 2.45 2.15 3.73
Daily turnover 4.4% 4.7% 3.2%
Alpha 0.27 0.26 0.21
Beta 0.14 0.10 0.78
Worst drawdown periods Net drawdown in % Peak date Valley date Recovery date Duration
0 29.20 2016-02-29 2016-11-11 2017-05-02 307
1 26.12 2013-05-20 2013-06-24 2014-07-16 303
2 25.80 2011-04-29 2011-08-08 2013-03-26 498
3 20.14 2008-07-02 2008-08-11 2008-10-09 72
4 19.29 2009-03-09 2009-06-15 2009-09-08 132
/usr/local/lib/python2.7/dist-packages/numpy/lib/function_base.py:3834: RuntimeWarning: Invalid value encountered in percentile
  RuntimeWarning)
Stress Events mean min max
Lehmann 0.04% -4.64% 6.77%
US downgrade/European Debt Crisis 0.46% -8.68% 7.46%
Fukushima 0.48% -2.57% 3.69%
EZB IR Event 0.06% -2.67% 4.08%
Aug07 -0.05% -3.09% 1.75%
Mar08 -0.44% -4.09% 1.58%
Sept08 0.27% -4.64% 6.77%
2009Q1 0.33% -2.91% 3.56%
2009Q2 -0.19% -3.24% 3.75%
Flash Crash -0.82% -5.50% 4.88%
Apr14 0.02% -5.53% 3.37%
Oct14 0.59% -3.38% 5.53%
Fall2015 0.01% -3.40% 1.99%
Low Volatility Bull Market 0.00% 0.00% 0.00%
GFC Crash 0.15% -4.64% 6.77%
Recovery 0.09% -9.17% 7.46%
New Normal 0.12% -7.34% 7.44%
/usr/local/lib/python2.7/dist-packages/matplotlib/axes/_base.py:2787: UserWarning: Attempting to set identical left==right results
in singular transformations; automatically expanding.
left=732889.0, right=732889.0
  'left=%s, right=%s') % (left, right))