Notebook

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

Trend Follow Algo. Just changed the dates to give it more time: total 10.25 years. No change to code.

In [1]:
bt = get_backtest('5b722142ddebf8440ce96414')
100% Time: 0:00:07|###########################################################|
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.7% 26.8% 36.7%
Cumulative returns 1280.8% 639.4% 86.7%
Annual volatility 26.0% 26.3% 24.5%
Sharpe ratio 1.10 1.04 1.40
Calmar ratio 1.05 1.05 1.34
Stability 0.96 0.95 0.59
Max drawdown -27.4% -25.6% -27.4%
Omega ratio 1.20 1.19 1.26
Sortino ratio 1.59 1.49 2.07
Skew -0.27 -0.28 -0.23
Kurtosis 2.29 2.38 1.71
Tail ratio 0.99 0.97 1.15
Daily value at risk -3.2% -3.2% -3.0%
Gross leverage 2.44 2.16 3.64
Daily turnover 4.7% 4.9% 3.8%
Alpha 0.27 0.27 0.21
Beta 0.12 0.08 0.85
Worst drawdown periods Net drawdown in % Peak date Valley date Recovery date Duration
0 27.38 2016-02-29 2016-11-11 2017-03-01 263
1 25.63 2011-04-29 2011-08-08 2013-04-04 505
2 20.19 2009-03-09 2009-06-15 2009-09-08 132
3 19.85 2008-07-02 2008-08-11 2008-10-08 71
4 18.92 2014-09-05 2014-10-16 2014-12-22 77
/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.08% -4.81% 6.77%
US downgrade/European Debt Crisis 0.35% -8.50% 7.77%
Fukushima 0.48% -2.57% 3.69%
EZB IR Event 0.05% -2.64% 3.24%
Aug07 -0.08% -3.75% 1.76%
Mar08 -0.43% -4.09% 1.61%
Sept08 0.36% -4.81% 6.77%
2009Q1 0.33% -2.91% 3.57%
2009Q2 -0.20% -3.23% 3.75%
Flash Crash -0.80% -5.53% 4.89%
Apr14 0.02% -5.54% 3.37%
Oct14 0.38% -3.38% 5.53%
Fall2015 0.00% -3.45% 2.12%
Low Volatility Bull Market 0.00% 0.00% 0.00%
GFC Crash 0.14% -5.36% 6.77%
Recovery 0.09% -9.16% 7.77%
New Normal 0.12% -7.23% 7.30%
/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))